I'm building WPF(MDI) application.
I want my main window to have some constant header and footer(like in a browser) and the area between the header and the footer will change dynamically.
I googled but didn't find any thing useful, can someone help on this one?
I got the next message at the designer: System.NullReferenceException
Object reference not set to an instance of an object.
at WPF.MDI.MdiContainer.MdiContainer_Loaded(Object sender, RoutedEventArgs e)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
I have a application that has a page that receives multiple packets from a TCP/IP server. Every time it receives it tries to run an event using Dispatcher.BeginInvoke which runs the event. The problem is that the event only runs on the first time Dispatcher.BeginInvoke. I believe that the reason for this is that because the thread is already running it can not be started again. Also, I have tried the Backgroundworker class and as soon as it hits my code I get an "Invalid cross thread access" error which makes me put the code back into the Silverlight Dispatcher.BeginInvoke and the origional problem occurs. How do I fix my problem?
Without seeing your code it is hard to say. I think the issue here is that you are using the Dispatcher.BeginInvoke which is actually saying, marshal any work onto the UI thread. what could be happening is that if you first action does not complete or blocks the UI then subsequent events may not bubble up to the UI thread which would not show anything.
You were right in trying another thread. Firstly do your work on another thread. At the point of updating the UI, put that bit in the Dispatcher call. So what you are saying is: Do my work on another thread. Once it is complete and I want to update my UI, marshal it onto the UI thread using the dispatcher.
Please remember that the actual code is at my office at work and I am at home. I have network security rules that don't allow me to bring code home. However, this is a Silverlight page control the Do Work Complete bw_RunWorkerCompleted is the Async event that is called once the bw_DoWork is finishes. Now, 'TimeLine timeline' is a codeplex control which is a sub-control on the main page control that displays a Silverlight timeline. How it works is that a wcf call is made which fills the timeline's List<Event> events collection that is a property of the TimeLine control. Now, when timeline.UpdateEvents is called the timeline control iterates the list and re-draws the timeline with each of the collection's event objects. The Backgroundworker class provides an Async run event and on event complete combination. I have to put the 'while (!autoEvent.WaitOne())', sorry I forgot the while in the while loop, to wait until the main thread signals so that the Dispatch.BeginInvoke(timeline.UpdateEvents) is blocked unitl the collection is updated by the wcf call or I get an exception. I know that my discription is a bit sketchy but this is all I can go on as far a specifics until in the morning. If you can help that would be great!
I have created a simple silverlight application in VS2010(Silverlight 5) for open exe file. I host the application on my iis 7 and it is working fine. when i host in online(server), the elevated permission is failed and not entered to automationfactory. kindly suggest for open exe in online.
Actually, i used image capturing in my project. I would like to open the saved picture from client machine through web browser, same time i have to save image in database. For that only i simply ask, how to open a file.
Hello Code Project,
I have a requirement in Silverlight, that If a TextBox[ContentControl] have validation error, then the appearence should be like a red wavy line, with a tool tip of error content. If it is possible , please help me with a sample silverlight application..
Correct, you have to go with silverlight only. Prism is one of the popular MVVM frame work. there no mandatory that you need to use all of these things, You can create your app with out them as well. But Building WPF/Silverlight is advisable.
Strictly speaking, PRISM is not an MVVM framework. Yes, it has some MVVM features, but it is better regarded as an application composition framework. If the OP didn't build his original app with PRISM then he's got a whole host of work in trying to convert it into PRISM.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
Yes we can go with xbap application even i too thought that also.
But my basic requirement of converting this wpf to an web application is that
1) I am connecting centralized sql server with ado.net which have image data type also, so when i connect to the centralized database and fetch the data and also image am getting huge delay on getting the same.
I even asked a question on C# discussion forum on the same and they suggested me to go with image storage in physical drive and use web browser control to access the image. And instead of ado.net can use webservices.
But my thought is that if we create an web application and host the application in same server where the data base server exists will solve my problem. Thats the reason i wanted to convert into web application.
2) According to my understanding xbap application is that, when we trigger that it will download the exe to the local desktop through browser and run from local machine. If that is the case once again i hope i will be getting the same issue. If its is not the case i hope xbap would be the right option for me.
Please correct my if my understanding is wrong.
2)if i go with WCF or entity with local
servers wont it help me regarding handling data and image data types with
Sorry but I dont understand your conecrn
No, Actually my issue was to handle the image through centralized server. So i thought to host the web application and db server in the same machine. if i use ado.net it will work fine and also its working fine now. But if i go for wcf or entity model, will it also take more time to give me data having image data type?
Abhinav S wrote:
Hema Bairavan wrote:
3) And regarding XBAP, Will it
download the xbap file exe to the local machine and it will work from local
desktop like windows application like that it will connect db via internet only
Yes, an xbap file will be downloaded to you machine.
Ok thanks for your reply. So, xbap will behave like local windows application, if i use ado.net to connect centralized sql server to get data having image data type it will also take time like windows application???
i hope with this reply our conversation will come to end
By your requirement, changing the application to a webapplication (be it by web forms, silverlight or XBAP) will not solve your problem. In fact, you will only lose yet more performance.
If your application is loading images from a centralized server and that is making things slow, I think your problem is on the transfer rate of those images. If you can change your application to do a local cache of the images, you will only need to go to the server the first time (the first download) of that image, and later you can use it locally.
Surely it is good to use some mechanism to check if the image needs to be updated or not (considering the server image changes), but that's all.
Doing an web page, you will:
Have to send the application throgh tcp/ip + the images through tcp/ip. Even if the webserver does a local access, the client will use tcp/ip to get to the webserver.
The only advantage is that browsers deal with the cache for you (but considering you will need to rewrite the application, it is not a real advantage).
For the item 2. All web applications do almost the same. HTML applications can have code that executes on the server, but they will send such HTML to the client. That HTML can then asks for postbacks or call a web-service, but it executes locally (on the client).
WPF (as XBAP) and Silverlight are like the HTML code in the sense they execute on the client machine, but for anything else, they should call the webserver (a service call... WCF, for example). So, I am sure your problem is not there.
It all depends how you created your WPF app, and what resources it uses; e.g. does it use the local file system, are you using custom printing, etc. Is it written using an MVVM framework, or is it written using code behind?
There is no magic bullet - we can't give you a hard and fast figure I'm afraid.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
No, You cannot "convert" to a web application. This would be a massive re-work.
Silverlight however would be a very good way to get your application to be viewed in the web as this is in effect an application plugin hosted in a browser. You do not need Prism or any other framework but I would strongly recommend using one as it stops you re-writing many boiler plate code or functionality that is already written and tested.
With WPF and Silverlight, you can create an application and then share the same code across your platforms. I would recommend downloading the Prism framework. In there the Stock_RI application has a couple of samples, one being cross platform development / Multi target.
Without ratting through your code I would guess that you are passing in the row object into the query and it is turning the object into a string(). You should be passing in the SelectedValue from the combo not the SelectedItem.
Never underestimate the power of human stupidity
If you are using bytes to store a byte array, this[^] would give you an idea on what you need to do to display a random image.
Note that all API's may not be available in WP so you may have to improvise to achieve similar results.