tags:

views:

31

answers:

2

I have a function a time consuming operation that is done I want to start and end operations appear to be user (By statusbar control) But when performed function, both text executed at the end of function. (user can not sees "Start Operation ...") What solution do you recommend to me?

    private void btnUpdateDataBase_Click(object sender, RoutedEventArgs e)
    {
        TextBlockStatus.Text = "Start Operation ...";

        //Time consuming operation 

        TextBlockStatus.Text = "End Operation ...";
    }
+1  A: 

you need to move the execution to another thread. Do the following:

  1. Show the 'Processing' Message
  2. Spawn another thread to perform your calculation
  3. When the thread completes processing it should trigger an event in the main thread
  4. As a part of the event handler replace the "processing' message with the "Completed' message
mfeingold
A: 

The time consuming operation should be executed on a separate thread. When operation is completed it should notify the UI thread. More info is here.

Al Bundy