/// <summary> /// Raises the switch state changed event. /// </summary> /// <param name="e"> /// The event arguments. /// </param> protected virtual void OnSwitchStateChanged(SwitchStateChangeEventArgs e) { if (this.StateChanged != null) { this.StateChanged(this, e); } }
/// <summary> /// Raises the state changed event. /// </summary> /// <param name="sender"> /// The object firing the event. /// </param> /// <param name="e"> /// The event arguments. /// </param> private void OnStateChanged(Object sender, PinStateChangeEventArgs e) { if (e.NewState != e.OldState) { SwitchStateChangeEventArgs changeArgs = null; if (e.NewState == ON_STATE) { changeArgs = new SwitchStateChangeEventArgs(SwitchState.Off, SwitchState.On); } else { changeArgs = new SwitchStateChangeEventArgs(SwitchState.On, SwitchState.Off); } base.OnSwitchStateChanged(changeArgs); } }
/// <summary> /// Handles the lock state changed. /// </summary> /// <param name="sender"> /// The object firing the event. Should be a reference to /// the switch instance that triggered the event. /// </param> /// <param name="e"> /// The event arguments. /// </param> private void OnLockStateChanged(Object sender, SwitchStateChangeEventArgs e) { base.OnLockChanged(new OpenerLockChangeEventArgs(((ISwitch)sender).IsOn)); }