private void HandleDataProgressEvent(object sender, DataProviderEventArgs e)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            if (TaskbarManager.IsPlatformSupported)
            {
                taskbarManager.SetProgressState(TaskbarProgressBarState.Normal);
                taskbarManager.SetProgressValue(e.Result, 100);
            }
            MainView.ProgressBar.Minimum = 0;
            MainView.ProgressBar.Maximum = 100;
            MainView.ProgressBar.Value = e.Result;
            MainView.Status.Text = e.Message;
            ShowProgressTime(e.Time);

            Trace.WriteLine("MainWindow received this message: " + e.Message);
        }
Beispiel #2
0
		protected virtual void OnRaiseDataProgressEvent(DataProviderEventArgs 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.
			EventHandler<DataProviderEventArgs> handler = null;

			lock (this)
			{
				handler = RaiseDataProgressEvent;
			}
			// Event will be null if there are no subscribers

			if (handler != null)
			{
				foreach (EventHandler<DataProviderEventArgs> _handler in handler.GetInvocationList())
				{
					try
					{

						System.Windows.Application.Current.Dispatcher.Invoke(_handler,new object[]{this, e});
					}
					catch (Exception ex)
					{
						Debug.WriteLine("Error in the handler {0}: {1}", handler.Method.Name, ex.Message);
					}
				}
			}
		}
        private void HandleDataLoadedEvent(object sender, DataProviderEventArgs e)
        {
            pageViewModel.DataProvider.RaiseDataProgressEvent -= HandleDataProgressEvent;
            pageViewModel.DataProvider.RaiseDataLoadedEvent -= HandleDataLoadedEvent;

            if (TaskbarManager.IsPlatformSupported)
                taskbarManager.SetProgressState(TaskbarProgressBarState.NoProgress);
            MainView.ProgressBar.Value = 0;
            MainView.Status.Text = "Ready";
            MainView.Time.Text = "00:00:00";

            Mouse.OverrideCursor = null;
            MainView.PageViews.IsEnabled = true;

            Trace.WriteLine("MainWindow received this message: " + e.Message);
        }