Exemplo n.º 1
0
        /// <summary>
        /// Called to raise the MonitorUpdated event.
        /// </summary>
        /// <remarks>Any inheritors that override this event must add a call to Base.OnMonitorUpdated at the end of their routine to ensure the event is raised.</remarks>
        protected virtual void OnMonitorUpdated()
        {
            ProgressMonitorEventArgs e = new ProgressMonitorEventArgs(m_ProgressMonitors, this);

            //save the delegate field in a temporary field for thread safety
            EventHandler <ProgressMonitorEventArgs> tempEvent = Updated;

            if (tempEvent != null)
            {
                tempEvent(this, e);
            }
        }
        /// <summary>
        /// Called when the ProgressMonitor that is the top monitor is changed.
        /// </summary>
        /// <remarks>If overriding this method, be sure to call Base.OnChanged to ensure that the event is still raised to its caller.</remarks>
        protected virtual void OnChanged()
        {
            ProgressMonitor curTopMonitor = null;

            //if we have a current top monitor, we want to pass that along, but be careful in case we don't.
            if (m_Stack.Count > 0)
            {
                curTopMonitor = m_Stack.Peek();
            }

            //Notice that this is a different event argument type than we use in all our other events.
            ProgressMonitorEventArgs e = new ProgressMonitorEventArgs(this, curTopMonitor);

            //save the delegate field in a temporary field for thread safety
            EventHandler <ProgressMonitorEventArgs> tempEvent = Changed;

            if (tempEvent != null)
            {
                tempEvent(this, e);
            }
        }
 private void TopMonitor_MonitorUpdated(object sender, ProgressMonitorEventArgs e)
 {
     //when we are notified that the top monitor changed we need to update our progress
     UpdateProgress();
 }