/// <summary> /// Create a new monitor changed event arguments object. /// </summary> /// <param name="progressMonitors">The monitor stack that changed</param> /// <param name="statusMessage">A user display message for the current status</param> /// <param name="completedSteps">The current progress step (between zero and the maximum number of steps)</param> /// <param name="maximumSteps">The current maximum number of steps</param> public ProgressMonitorStackEventArgs(ProgressMonitorStack progressMonitors, string statusMessage, int completedSteps, int maximumSteps) { m_ProgressMonitors = progressMonitors; m_StatusMessage = statusMessage; m_CompletedSteps = completedSteps; m_MaximumSteps = maximumSteps; }
internal ProgressMonitor(ProgressMonitorStack progressMonitors, object owner, string status, int maxSteps) { m_Owner = owner; m_ProgressMonitors = progressMonitors; m_PercentComplete = 0.0; m_CompletedSteps = 0; m_MaxSteps = maxSteps; StatusMessage = status; m_PercentCompleteValid = true; m_Complete = false; m_ReadOnly = false; }
private bool m_ReadOnly; //prevents subsequent events from displaying if they come after our canceled or complete event. #region Public Properties and Methods /// <summary> /// Execute the requested delegate asynchronously with the specified arguments. /// </summary> /// <remarks>A progress dialog is displayed after a few moments and updated asynchronously as the task continues. If the user /// elects ot cancel the task, execution attempts to stop immediately and True is returned indicating the user canceled.</remarks> /// <param name="callBack">The method to be executed asynchronously</param> /// <param name="title">An end-user display title for this task.</param> /// <param name="state">Arguments to pass to the callBack delegate</param> public void Execute(WaitCallback callBack, string title, object state) { AsyncTaskArguments arguments = new AsyncTaskArguments(title, state); m_ProgressMonitors = arguments.ProgressMonitors; //and initialize our different UI elements m_ProgressMonitors.Canceled += Monitors_Canceled; m_ProgressMonitors.Completed += Monitors_Completed; //we are going to have the thread pool asynchronously execute our async interface. ThreadPool.QueueUserWorkItem(AsyncTaskExec, new object[] { callBack, arguments }); //and we return right away. The whole point is that the caller can check status as they wish. }
/// <summary> /// Create a new monitor changed event arguments object. /// </summary> /// <param name="progressMonitors">The monitor stack that changed.</param> /// <param name="progressMonitor">The monitor object (if any) affected by the change.</param> public ProgressMonitorEventArgs(ProgressMonitorStack progressMonitors, ProgressMonitor progressMonitor) { m_ProgressMonitors = progressMonitors; m_ProgressMonitor = progressMonitor; }
/// <summary> /// Create a new asynchronous execution task /// </summary> /// <param name="title"></param> /// <param name="state"></param> /// <remarks>Creates its own progress monitor stack</remarks> public AsyncTaskArguments(string title, object state) { m_Title = title; m_State = state; m_ProgressMonitors = new ProgressMonitorStack(title); }