|
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.
|
|
|
|
|
It is hard for me to cut and paste code because I develop on one network and access the internet on another. But my code looks something like this:
Backgroundworker bw = new Backgroundworker();
public void Constructor ()
{
bw.DoWork += new DoWorkEventHandler(bw_DoWork);
bw.RunWorkerCompleted +=
new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
}
private void Update()
{
bw.bw_DoWorkAsync();
while (!autoEvent.WaitOne())
{
Dispatcher.BeginInvoke(timeline.UpdateEvents)
}
}
private void bw_DoWork(Object sender, DoWorkEventArgs e)
{
Dispatcher.beginInvoke(GetFreshData);
// This event is where I refresh the collection data
}
private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
Dispatcher.BeginInvoke(timeline.UpdateEvents)
//updates the timeline control where my refreshed collecton exists
}
Now, I put a break point in the bw_DoWork and bw_RunWorkerComplete which gets hit every time; however, the timeline control refresh never occurs except for the first time.
Thanks,
Steve Holdorf
-- modified 27-Jan-13 19:17pm.
|
|
|
|
|
What is the Do work complete? also what does the timeline.UpdateEvents do?
Are you using MVVM? I dont think so looking at the code you supplied but just wondered what the actual dataset was that the UI binds too?
|
|
|
|
|
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!
Thanks,
Steve Holdorf
-- modified 27-Jan-13 20:31pm.
|
|
|
|
|
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.
Thanks in advance.
|
|
|
|
|
You cannot open exe files in Web browsers, it would compromise the security of the client system.
|
|
|
|
|
Hello Richard,
Thank you for reply. Is there any possible way to open exe file(like notepad) on client system through web browser? or any third party tool available?
|
|
|
|
|
Well, as I said before it's a security measure. And indeed, why would you want to open it with Notepad? Maybe you should explain what problem you are trying to solve.
|
|
|
|
|
Hello Richard,
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.
|
|
|
|
|
Sorry, I'm not sure how to do that; but you could try a Google search or look on the ASP.NET website for suggestions.
|
|
|
|
|
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..
|
|
|
|
|
|
Hello richard,
Thank you very much for your response, Finally, I want to know. How to implement the error border as a wavy line? and how it is apply in Silver light, Not in WPF.
Regards
Salam
|
|
|
|
|
Silverlight and WPF are very much the same. Read the article I pointed you at and implement the validation rules.
|
|
|
|
|
Hello,
I'm creating a log in window with 2 text boxes.
One text box for user name and the second text box for password.
I want the text boxes to show default almost transparent text and when the user starts to type inside the text box the text will disappear.
For example in the password text box will be written "PASSWORD".
How can i do this in WPF text box.
Thanks
|
|
|
|
|
|
Dear Buddies,
Required your help / suggestion.
I have created a WPF windows application. Now for some reason i wanted to convert the same to web application.
Can any one please give suggestion on how to convert the same with minimal effort?
Converting the application to silverlight would be easier? if so i googled on the same i am getting reply that need to use prism and all to acheive the same.
Can you guys please suggest the way to convert my wpf application to web application with minimal effort.
Thanks in advance.
|
|
|
|
|
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.
|
|
|
|
|
Dear hari,
Thanks for your suggestion will try the same and get back.
|
|
|
|
|
|
Dear Abinav,
Thanks for your time in replying.
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.
Thanks in advance.
|
|
|
|
|
Hema Bairavan wrote: 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.
Silverlight will be no different. A Xap file will be downloaded on your client.
Infact, SIlverlight does not support ADO.Net directly. You will need to use WCF (or the entity framework) on the server to communicate with the database.
Isolated storage would be faster, but fairly limited - so its good for a limited number of images.
|
|
|
|
|
Dear Abinav,
Thanks for reply.
1) So you mean even though i move to silver light also my issue wont get solved?
2)if i go with WCF or entity with local servers wont it help me regarding handling data and image data types with centralized server?
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 rt?
Sorry for asking couple of questions as i am in critial phase.
Thanks in advance
|
|
|
|
|
Hema Bairavan wrote: 1) So you mean even though i move to silver light also my issue wont get solved?
You will be able to access isolated storage if that was your main requirement.
Hema Bairavan wrote: 2)if i go with WCF or entity with local servers wont it help me regarding handling data and image data types with centralized server?
Sorry but I dont understand your conecrn here.
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 rt?
Yes, an xbap file will be downloaded to you machine.
|
|
|
|