I had this task of making a proof of concept sample that will allow users to use the User-Rich text editor Microsoft Word.
It is really challenging, since working with those object are not something we can do in a jiffy , well at least for someone like me who rarely do MSWord macro things.
Reading thru API and using the new features of C#4.0 thru dynamic types, I'm able to design and implement a class library that can simply use MS Word and perform saving to database. It involves checking MRU and also subscribe to events of the MS Word Interop object.
Since it is in Silvelight, data access and operations should be thru WCF. I completed the solution, and only later figured out that my ADO.NET class won't work in silvelright.
(x_x) <= sick due to stress
Showing posts with label silverlight. Show all posts
Showing posts with label silverlight. Show all posts
Getting reference to Controls in Lightswitch
While trying something in Lightswitch, we encountered a problem that involves using different controls (non-default), like Textbox,Stackpanels, etc. Now, the problem is, the data that will be displayed using those custom controls are not really part of the actual data model.
HttpRequests, Browser, UI Invokes, asynchronous ways in Silverlight 4.0
I had difficulties making HttpRequests/Response handling in Silverlight since it most of the events are asynchronous by nature. It all rooted on a task that involves data to be exported on CSV format. This is really easy (first approach) as I only have to format it accordingly using commas, but unfortunately this was not the case. SaveFileDialog must be invoked on a UI thread, meaning constructing it on non-UI event handlers will throw an exception (must be User invoked), which makes sense since we're dealing with client side here and placing files on a client side without the user's conscent is like planting something wicked on their machine.
With this, I have decided to just have Silverlight post to a server then store those data on the context of Application's Cache. With this, I don't need to worry about getting the stream and deal with the security. So, I did a quick handler hack. At first, I made a synchronous one. After I got it working, I considered a concurrent user request performance and converted it to asynchronous. I noticed slight difference here. The file received from a synchronous handler indicates the complete size of the file, while asynchronous handler don't. It doesn't affect how the request is handled, meaning if your usual query for a resource took 5 seconds, asynchronous handler can't change that. The performance benefit takes place when multiple users performs the same query. Since it doesn't have to wait for the handle to process the request and instead start on a new thread, it offers better performance.
But, I have to write HttpRequest, then another HttpRequest after the asynchronous callback fires, where I can write POST datas, then submit it again and take the response back. It was really different on what I used to do in web, but somehow I starting to find a bit of liking to it.
Things that I found useful:
Dispatcher.BeginInvoke();// Use anonymous method to invoke or set properties
With this, I have decided to just have Silverlight post to a server then store those data on the context of Application's Cache. With this, I don't need to worry about getting the stream and deal with the security. So, I did a quick handler hack. At first, I made a synchronous one. After I got it working, I considered a concurrent user request performance and converted it to asynchronous. I noticed slight difference here. The file received from a synchronous handler indicates the complete size of the file, while asynchronous handler don't. It doesn't affect how the request is handled, meaning if your usual query for a resource took 5 seconds, asynchronous handler can't change that. The performance benefit takes place when multiple users performs the same query. Since it doesn't have to wait for the handle to process the request and instead start on a new thread, it offers better performance.
But, I have to write HttpRequest, then another HttpRequest after the asynchronous callback fires, where I can write POST datas, then submit it again and take the response back. It was really different on what I used to do in web, but somehow I starting to find a bit of liking to it.
Things that I found useful:
Dispatcher.BeginInvoke();// Use anonymous method to invoke or set properties
getting my hands dirty on Silverlight 4
I was too busy doing silverlight 4 related works that I'm unable to blog here. And since it was a client-side application, I don't have to worry much about the control states , unlike web development , but still I prefer doing web development since I'll have some time reading those MCTS learning kit while doing some quality deliverables of work.
Anyway, I'm able to familiarize myself that controls without actual click or selectedindexchanged events are only solid on their borders. Filtering datas from DomainDataSource is quite a pain, since nested filters doesn't work with DDS... unless one can bear with a ContainedIn method with non-accurate result and the asynchronous way of loading data, I missed Dataset based manipulation, although it seems that Microsoft believed that DomainDataSource is the right direction and Datasets are history.
Another thing that gave me sleepless nights are the the SaveFileDialog objects. These things protect client side things that sometimes they are a pain to deal with. For example, if I have an asynchronous data from DB or from a Service call, and I need to save the result of the query or service call somewhere in the client PC. Showing the SaveFileDialog in non-UI related events (like button click, selected index changed, etc) will throw an exception that "Dialog must be user initiated".
I understand that Silverlight was a client-side application and if SFD won't do it like this, client PC are at big risk to malicious things, but because of this restriction, it is hard or maybe impossible to keep the saving and loading of data in sync, even with sleeping threads, on assumption that it runs on different thread..
I hope they made some fix for those issues in SL 5.0
Anyway, I'm able to familiarize myself that controls without actual click or selectedindexchanged events are only solid on their borders. Filtering datas from DomainDataSource is quite a pain, since nested filters doesn't work with DDS... unless one can bear with a ContainedIn method with non-accurate result and the asynchronous way of loading data, I missed Dataset based manipulation, although it seems that Microsoft believed that DomainDataSource is the right direction and Datasets are history.
Another thing that gave me sleepless nights are the the SaveFileDialog objects. These things protect client side things that sometimes they are a pain to deal with. For example, if I have an asynchronous data from DB or from a Service call, and I need to save the result of the query or service call somewhere in the client PC. Showing the SaveFileDialog in non-UI related events (like button click, selected index changed, etc) will throw an exception that "Dialog must be user initiated".
I understand that Silverlight was a client-side application and if SFD won't do it like this, client PC are at big risk to malicious things, but because of this restriction, it is hard or maybe impossible to keep the saving and loading of data in sync, even with sleeping threads, on assumption that it runs on different thread..
I hope they made some fix for those issues in SL 5.0
Learning Silverlight 4.0 from 1.0
Finally! Maybe I should thank my previous manager. Now I have this much awaited chance to continue my Silverlight 1.0 experience to Silverlight 4.0 and maybe 5.0. When Silverlight was on pilot version, I was enthusiast enough to apply it to a task, 2008 (I'm still on Tokyo that time). It was completely a client-side thing, that I have to make AJAX request just to make a server-side request and back to XAML.
I noticed the great addition since version 1.0. There are many controls now, which I also expected. I remember my nostalgic 1.0 days making animations using simple ellipses, rectangles, some fills and few images. Now, there are controls. I'm starting to feel that, it was like an ASPX/Windows Form hybrid which have mutated over time , but for good.
But, I still have something that I'm expecting Silverlight team to draw. I'm sure every youtube fans already know that they can record a video using their computer's built in camera and have it uploaded in youtube servers. I've long expected Silverlight to have this, without having users make a custom control, at least for the part that accepts the data binaries and have it collected at serverside (like aspx posted file, or wcf way).
Or maybe, I'll just implement one, if I can grab some reference on how to use video devices and have the stream buffered and then send to server.
Subscribe to:
Posts (Atom)

