/// <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; } } } }
/// <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); } }
/// <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); }
/// <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; } } }