TPL .net 4.0 messageBox with time elapsed
What is the best way in C# 4.0 to show MessageBox (or other form) in which elapsed time is presented till different method is done?
I would like to know how to do this using TPL in .net 4.0
thanks for any gui开发者_开发技巧deness
I don't think you'll be able to use a MessageBox. But if you're using WPF, you could create a form with controls that are bound to a data object implementing INotifyPropertyChanged which contains the data you want to display (i.e., the number of seconds remaining). You would just then display that form as a modal dialog box in the UI thread, and then update the values of the data object in one of your backgrounds threads (using Dispatcher.BeginInvoke() of course to make sure that the actual update gets marshaled to the UI thread).
精彩评论