I'm guessing here but it may be possible that your loop is being done on the UI thread thus blocking it. The dispatcher is supposed to take care of that but I think that's on the assumption that your code is running on a background thread. There's no point in using the Dispatcher if your code is already running on the UI thread.
So, if that's the case (like I said I'm guessing) perhaps you could try running it on a background thread. I've used BackgroundWorker before which allows you to set up a a method for your Work, Progress changed, and completed. http://msdn.microsoft.com/en-us/library/cc221403(v=vs.95).aspx That would also solve your problem of doing the work without needing the user to click a button. hope that helps curb your pain. :) cheers, Stephen On Wed, Apr 6, 2011 at 12:42 PM, Peter Maddin <[email protected]>wrote: > My mistake. > > > > I was using the wrong event handler to trigger the parsing of my xml file. > > However I am still having a problem with > > · How to get the dialog to start without having to have the user > to use a control (aka button) to start the file parsing. > > · The progress bar is not being updated even though I am using the > mechanism in http://www.codeproject.com/KB/WPF/WpfProgressBar.aspx to > update it. > > > > I don’t know why it should be this hard. > > > > Regards Peter > > > > *From:* [email protected] [mailto:[email protected]] > *On Behalf Of *Peter Maddin > *Sent:* Wednesday, 6 April 2011 11:39 AM > *To:* [email protected] > *Subject:* WPF dialog never displayed > > > > I need to display a small wpf windows that shows a progress bar while > parsing an xml file and using this to add content to a flowdocument. > > > > This is done from within a user control. > > > > The dialog sets DialogResult to true if it works or false if an exception > occurs. > > > > The dialog is working except it is never displayed. > > > > What does one need to do so that it is displayed. > > > > Code > > > > if (LogFilePath != null) > > { > > if (parentWindow != null) > > { > > var processingDialog = new PleaseWaitDialog(); > > processingDialog.Owner = parentWindow; > > processingDialog.LogFilePath = LogFilePath + "\\" > + logFile; > > processingDialog.IsForPrinter = false; > > processingDialog.IntializeDialog(); > > if (processingDialog.ShowDialog() == true) > > { > > > logDocumentUserControl.logFlowDocumentViewer.Document > = processingDialog.LogDocument; > > } > > } > > } > > > > While it functions, nothing is shown. > > > > Any clues as to what to do? > > > > > > > > > > *Regards Peter Maddin* > *Applications Development Officer* > *Path**West Laboratory Medicine WA* > *Phone : +618 6396 4285 > Mobile: 0414 240 307* > *E-Mail : [email protected]; [email protected]* > *The contents of this e-mail transmission outside of the WAGHS network are > intended solely for the named recipient's), may be confidential, and may be > privileged or otherwise protected from disclosure in the public interest. > The use, reproduction, disclosure or distribution of the contents of this > e-mail transmission by any person other than the named recipient(s) is > prohibited. If you are not a named recipient please notify the sender > immediately**.* > > > > > > _______________________________________________ > ozwpf mailing list > [email protected] > http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf > >
_______________________________________________ ozwpf mailing list [email protected] http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf
