Example #1
0
        protected virtual void OnRaiseStatusChangedEvent(StatusChangedEventArgs e)
        {
            // Make a temporary copy of the event to avoid possibility of
            // a race condition if the last subscriber unsubscribes
            // immediately after the null check and before the event is raised.
            StatusUpdateEventHandler handler = StatusChangedEvent;

            // Raise the event
            if (handler != null)
            {
                handler(this, e);
            }
        }
Example #2
0
 protected virtual void OnRaiseStatusChangedEvent(StatusChangedEventArgs e)
 {
     // Make a temporary copy of the event to avoid possibility of
     // a race condition if the last subscriber unsubscribes
     // immediately after the null check and before the event is raised.
     StatusUpdateEventHandler handler = StatusChangedEvent;
     // Raise the event
     if (handler != null)
         handler(this, e);
 }
Example #3
0
 void HandleStatusChangedEvent(object sender, StatusChangedEventArgs e)
 {
     //Console.WriteLine("Status: " + e.Message);
     //Have to do this because no other thread can update a UI element except the main thread.
     Dispatcher.BeginInvoke(new Action(() =>
     {
         lblStatusUpdate.Content = e.Message;
         // unselect and selected the selected library to fire a library change event and get it updated in the rest of the application
         if (e.Message.Equals("Finished updating music library.") || e.Message.Equals("Finished processing music library."))
         {
             int selectedIndex = lstLibraries.SelectedIndex;
             lstLibraries.SelectedIndex = -1;
             lstLibraries.SelectedIndex = selectedIndex;
         }
     }));
 }