Ultra cool project

So.. I’ve been lately kinda busy with the project we currently do with team. I gotta admit, that project is super-cool, I’ve tested/tried so many different things, and pretty much anyone would be amazed what kind of stuff one application CAN have, lol.

I am gonna tell about it, because as right now, I’ve finished my current things.

1) PDF Component – Okay, we needed to make our custom PDF component, so we could control everything. (The Adobe PDF control was not good enough). So we went through few libraries and finally found what we needed. We could convert each page into BMP, however the problem that it wasnt vector, still remained. We went through few components more until we found something that we can use for WPF+PDF[PDFRasterizer]. It can also read PDF directly from memory :)

2) Display HTML and EDIT it – Okay, this took shitloads of research but we found combination of embedding some kind of webbrowser control + TinyMCE worked best. DevExpress had also some cool RTFEditor which was perfect, however the RTF/HTML conversation was kinda bad, it added many unnecessary tags.(C#), TinyMCE is really easily configurable and has many options.

3) WebBrowser control, by default WPF has WebBrowser control, however IE is bad, for many reasons. It’s ActiveX wrapper, meaning we cant draw on it, without using WinFormHost in WPF. It also doesn’t directly approach IE functions(Copying, Selecting text, rendering process). IE is also one inconsistent motherphoker. For example: Zoom works on IE6, but then, IE7 does it differently, zoom factors are different. There will also be problems with Javascript. We didn’t have good way to protect source code of the page we we’re showing.

We finally found Awesomium(basically C# wrapper for Chromium), it gave us control for pretty much everything. We could make webbrowser what we can rotate, how awesome is that? Having total control over webbrowser control is awesome. We restricted copying/selecting anything. That fixes every problem we had with IE control. The control also gave us way to communicate between JavaScript and C# easily. (Though IE provided that too, but not so easily), not only does Awesomium give you all that, but we also got access to object serialization(transfer objects from C# to JavaScript).

4) Displaying Math – Ah that was fun, we went through IE MathPlayer and many other possible solutions, we ended up with MathJax(JavaScript based MathML renderer).

5) Playing flash – baah, flash provides us ActiveX component however they say that they dont officially support it. Only browser version. Though it did work with WPF, and it can also play flash files from memory, so that is cool! There are many different versions of flash, to really use ActiveX component, you need to take care of many things. (Register ActiveX component based on version, admin rights). But that wasnt actually challenge – the real challenge was to make flash player play another flashplayer which then plays flash. It wasnt that hard to get it working on local webserver, however things got tricky when I started to try it without webserver. As the HTML file which had embbeded flash in it, required parameters.

Like this: file://myfile.html?PARAMTERSHERE&BLABLA&BLABLA(JavaScript can parse parameters), Awesomium did not allow me to pass filename like that, nor did explorer or any other kind of option I had. So What I really did, was that I hardcoded every parameter(soon to change!), pain in ass. Still didnt work, I didnt have access to flash file either(only swf). Debugging was real pain, oldschool style – add alerts everywhere, didnt provide me with a much of information.

until it just popped into my mind => I asked myself, “do you need admin/special rights to communicate between JavaScript and flash on local machine?” the answer is NO, however it lead me to a discovery that if you have flash file which tries to read .xml file on same directory as the flash, you do need to set up Trusted path on Flash.

That was actually super easy.
I created file C:\Users\erti\AppData\Roaming\Macromedia\Flash Player\#Security\FlashPlayerTrust\RANDOMBLABLA.txt, added my flash path there(with nam, absolute path), and it worked.

6) Ive finished reading few WPF books, and dayum, WPF is so powerful and easy to use.
7) Loading font resources into HDD – see my other post somewhere.
8) Displaying base64 images in WebBrowser, pretty neat, right?

9) Multimonitor programming – we needed a way to see if monitors are extended/cloned/one off/powered off/whatever, and depending that, switch the modes. XP nor Win7 dont have any good library what would capture differences between two platforms(XP and Vista have different display models afaik), so we needed to make seperate libraries for each. We used C++ currently, but soon probably gonna port it to C#. The subject itself is not much explored in google, there are few snippets floating around, some Library(UltraMon) that didnt provide us neccesiary functions.

10) Playing encrypted videos in WPF – woah, see my post here =>
DRM seemed like a good option for us, however (IMO) DRM lacked information on the things we we’re interested. We ordered Microsoft license(to generate licenses for videos), we have not yet tested it. DRM also does not restrict the application range we can use. We wanted to play video only on specific app.
We ended up devising our own encryptiong algorithm(whic I wont talk here for now!)

+ plus other smaller things


Your email addres will not be published. All fields are required.