private static void HandleBlindButtonPressedEvent(IRollerShutter rollerShutter, NamedComponentState direction) { if (direction == RollerShutterStateId.MovingUp && rollerShutter.GetState() == RollerShutterStateId.MovingUp) { rollerShutter.SetState(RollerShutterStateId.Off); } else if (direction == RollerShutterStateId.MovingDown && rollerShutter.GetState() == RollerShutterStateId.MovingDown) { rollerShutter.SetState(RollerShutterStateId.Off); } else if (direction == RollerShutterStateId.MovingDown) { rollerShutter.SetState(RollerShutterStateId.MovingDown); } else if (direction == RollerShutterStateId.MovingUp) { rollerShutter.SetState(RollerShutterStateId.MovingUp); } else { throw new InvalidOperationException(); } }
private static void HandleBlindButtonPressedEvent(IRollerShutter rollerShutter, RollerShutterButtonDirection direction) { if (direction == RollerShutterButtonDirection.Up && rollerShutter.GetState() == RollerShutterState.MovingUp) { rollerShutter.SetState(RollerShutterState.Stopped); } else if (direction == RollerShutterButtonDirection.Down && rollerShutter.GetState() == RollerShutterState.MovingDown) { rollerShutter.SetState(RollerShutterState.Stopped); } else if (direction == RollerShutterButtonDirection.Down) { rollerShutter.SetState(RollerShutterState.MovingDown); } else if (direction == RollerShutterButtonDirection.Up) { rollerShutter.SetState(RollerShutterState.MovingUp); } else { throw new InvalidOperationException(); } }
private static void HandleBlindButtonPressedEvent(IRollerShutter rollerShutter, ComponentState direction) { if (direction.Equals(RollerShutterStateId.MovingUp) && rollerShutter.GetState().Equals(RollerShutterStateId.MovingUp)) { rollerShutter.SetState(RollerShutterStateId.Off); } else if (direction.Equals(RollerShutterStateId.MovingDown) && rollerShutter.GetState().Equals(RollerShutterStateId.MovingDown)) { rollerShutter.SetState(RollerShutterStateId.Off); } else if (direction.Equals(RollerShutterStateId.MovingDown)) { rollerShutter.SetState(RollerShutterStateId.MovingDown); } else if (direction.Equals(RollerShutterStateId.MovingUp)) { rollerShutter.SetState(RollerShutterStateId.MovingUp); } else { throw new InvalidOperationException(); } }