/// <summary> /// Raises the pin state changed event. /// </summary> /// <param name="sender"> /// The object raising the event. /// </param> /// <param name="e"> /// The event arguments. /// </param> private void OnPinStateChanged(Object sender, PinStateChangeEventArgs e) { if (e.NewState != e.OldState) { base.OnStateChanged(new ButtonEventArgs(this)); } }
private static void OnPinStateChange(object sender, PinStateChangeEventArgs args) { if (args.Pin == ButtonDefinitions[args.IOWarrior.Type]) { args.IOWarrior.DigitalWrite(LedDefinitions[args.IOWarrior.Type], args.NewPinState); } }
/// <summary> /// Raises the <see cref="PinStateChanged"/> event. /// </summary> /// <param name="e"> /// The event arguments. /// </param> protected virtual void OnPinStateChanged(PinStateChangeEventArgs e) { if (this.PinStateChanged != null) { this.PinStateChanged(this, e); } }
/// <summary> /// Handles the pin state change event by firing the corresponding /// power state change event. /// </summary> /// <param name="sender"> /// The object (pin) that fired the event. /// </param> /// <param name="e"> /// The event arguments. /// </param> private void Output_StateChanged(Object sender, PinStateChangeEventArgs e) { if (e.NewState == this._onState) { base.OnStateChanged(new PowerStateChangeEventArgs(PowerState.Off, PowerState.On)); } else { base.OnStateChanged(new PowerStateChangeEventArgs(PowerState.On, PowerState.Off)); } }
/// <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); } }