コード例 #1
0
 /// <summary>
 /// Raises the TargetChanging event, giving listeners an opportunity to cancel the event
 /// or to modify the target info</summary>
 /// <param name="e">Target change event args</param>
 protected virtual void OnTargetChanging(TargetChangeEventArgs e)
 {
     if (TargetChanging != null)
     {
         foreach (Delegate listener in TargetChanging.GetInvocationList())
         {
             listener.DynamicInvoke(this, e);
             if (e.Cancel)
             {
                 return;
             }
         }
     }
 }
コード例 #2
0
        /// <summary>
        /// Sets the target whose performance we are monitoring. Raises the OnTargetChanging event.</summary>
        /// <param name="target">Target whose performance we are monitoring</param>
        /// <param name="name">>User readable name of the target</param>
        public void SetTarget(object target, string name)
        {
            var performanceTarget = target as IPerformanceTarget;

            if (performanceTarget == null)
            {
                var controlTarget = target as Control;
                if (controlTarget != null)
                {
                    performanceTarget = new PerformanceMonitorControl.ControlAdapter(controlTarget);
                }
            }

            var targetEventArgs = new TargetChangeEventArgs(performanceTarget, name);

            OnTargetChanging(targetEventArgs);

            if (!targetEventArgs.Cancel)
            {
                m_perfControl.Bind(targetEventArgs.Target, targetEventArgs.Name);
            }
        }
コード例 #3
0
        /// <summary>
        /// Sets the target whose performance we are monitoring. Raises the OnTargetChanging event.</summary>
        /// <param name="target">Target whose performance we are monitoring</param>
        /// <param name="name">>User readable name of the target</param>
        public void SetTarget(object target, string name)
        {
            var performanceTarget = target as IPerformanceTarget;
            if (performanceTarget == null)
            {
                var controlTarget = target as Control;
                if (controlTarget != null)
                    performanceTarget = new PerformanceMonitorControl.ControlAdapter(controlTarget);
            }

            var targetEventArgs = new TargetChangeEventArgs(performanceTarget, name);
            OnTargetChanging(targetEventArgs);

            if (!targetEventArgs.Cancel)
                m_perfControl.Bind(targetEventArgs.Target, targetEventArgs.Name);
        }
コード例 #4
0
 /// <summary>
 /// Raises the TargetChanging event, giving listeners an opportunity to cancel the event
 /// or to modify the target info</summary>
 /// <param name="e">Target change event args</param>
 protected virtual void OnTargetChanging(TargetChangeEventArgs e)
 {
     if (TargetChanging != null)
     {
         foreach (Delegate listener in TargetChanging.GetInvocationList())
         {
             listener.DynamicInvoke(this, e);
             if (e.Cancel)
                 return;
         }
     }
 }