/// <summary> /// Raises ValueChanged event. /// </summary> /// <param name="e">Provides event arguments.</param> protected virtual void OnValueChanged(EventSourceArgs e) { EventHandler handler = ValueChanged; if (handler != null) handler(this, e); }
/// <summary> /// Sets the value of the control and specifies the source of the action. /// </summary> /// <param name="newValue">New value for Value property.</param> /// <param name="source">Source of the action.</param> public void SetValue(bool newValue, eEventSource source) { CancelableEventSourceArgs cancelEventArgs = new CancelableEventSourceArgs(source); OnValueChanging(cancelEventArgs); if (cancelEventArgs.Cancel) { SwitchOffset = 0; this.Refresh(); return; } _Value = newValue; _AsyncValue = newValue; if (ShouldSyncProperties) BarFunctions.SyncProperty(this, "Value"); SwitchOffset = 0; if (this.Displayed) this.Refresh(); ExecuteCommand(); EventSourceArgs sourceEventArgs = new EventSourceArgs(source); OnValueChanged(sourceEventArgs); }