public async Task SetState([FromRoute] string id, [FromBody] SwitchAction action) { var switchName = id; Logger.LogDebug($"Request to set state of switch {switchName} to {action.Action}"); switch (action.Action) { case SwitchActionType.On: await TurnOn(id); break; case SwitchActionType.Off: await TurnOff(id); break; case SwitchActionType.Toggle: await Toggle(id); break; default: throw new InvalidOperationException($"Unknown action {action} request for switch {id}"); } }
BasicAction GetSecondaryAction(InteractableRaw thisInteractable, InteractorRaw interactor) { BasicAction action = null; switch (secondary) { case SecondGrab.None: action = new NothingAction(thisInteractable, interactor); break; case SecondGrab.Switch: action = new SwitchAction(thisInteractable, interactor); break; case SecondGrab.Scale: break; case SecondGrab.LookAt: var updateType = followType == FollowType.Transform ? UpdateEvents.BeforeRender : UpdateEvents.FixedUpdate; action = new LookAtAction(thisInteractable, interactor, ((FollowAction)grab.grabbedObjects[0].action).offset, true, updateType); break; } return(action); }
public IResponse Ctrl(int switchId, SwitchAction action, string response = null) { try { string result = _client.Get(new Uri(SwitchEndpoint.Ctrl(switchId, action, response), UriKind.Relative)); IResponse iResponse = null; if (response != null) { iResponse = new SwitchCtrlResponse(response); } else { SwitchCtrlResponseJson ctrlResponse = JsonConvert.DeserializeObject <SwitchCtrlResponseJson>(result); if (ctrlResponse.Success) { iResponse = new SwitchCtrlResponse(null); } else { iResponse = Utils.ErrorResponse(result); } } return(iResponse); } catch { throw; } }
private void ToolStripMenuItemHide_Click(object sender, EventArgs e) { SwitchAction sv = SwitchVisible; SwitchAction sv_altn = delegate() { bool x = this.Visible; if (x) { this.Hide(); } else { this.Show(); } }; ToolStripMenuItem i = (ToolStripMenuItem)sender; if (i.Checked) { sv_altn(); i.Checked = false; } else { sv_altn(); i.Checked = true; } }
protected virtual void DispatchAction(int index) { currentActionIndex = index; SwitchAction action = Actions[currentActionIndex]; action.Events.Invoke(); spriteRenderer.sprite = action.Sprite; }
public void Reset() { AsyncReporting = true; HapticFeedback = true; DoublePress = SwitchAction.Barcode; SinglePress = SwitchAction.Inventory; SwitchStateChanged = null; }
public void Switch(SwitchNumber number, SwitchAction action) { var write = new byte[] { 0xFF, /* whatever... */ (byte)number, (byte)action }; _port.Write(write, 0, write.Length); }
private void ExecuteButtonAction(string ButtonName, SwitchAction action) { if (Input.GetButtonDown(ButtonName)) { action(true); } if (Input.GetButtonUp(ButtonName)) { action(false); } }
private void Start() { _name = "Forgeron"; _questManager = GameObject.Find("QuestTable").GetComponent <QuestManager>(); _toggle = new Toggle(); _eventDialogue = new EventDialogue(); _switchQuest = new SwitchQuest(); _switchState = new SwitchState(); _switchAction = new SwitchAction(); }
public override void MouseDown(Point location) { _mouseAction = false; if (ClickType == LinearClickType.Swipe) { _mouseDownLocation = location; if (DesignMode && HasIndicator) { IndicatorOn = !IndicatorOn; } } else if (ClickType == LinearClickType.Touch) { SwitchAction action = SwitchAction.Increment; switch (Orientation) { case ToggleSwitchOrientation.Vertical: if (location.Y < Height / 2d) { action = SwitchAction.Decrement; } break; case ToggleSwitchOrientation.VerticalReversed: if (location.Y > Height / 2d) { action = SwitchAction.Decrement; } break; case ToggleSwitchOrientation.Horizontal: if (location.X < Width / 2d) { action = SwitchAction.Decrement; } break; case ToggleSwitchOrientation.HorizontalReversed: if (location.X > Width / 2d) { action = SwitchAction.Decrement; } break; } if (action != SwitchAction.None) { ThrowSwitch(action); _mouseAction = true; } } }
internal static string Ctrl(int switchId, SwitchAction action, string response) { string api = "/api/switch/ctrl"; api = string.Concat(api, "?switch=", switchId); api = string.Concat(api, "&action=", action.ToString().ToLower()); if (response != null) { api = string.Concat(api, "&response=", response); } return(api); }
protected override void ThrowSwitch(SwitchAction action) { if (action == SwitchAction.Increment) { switch (SwitchPosition) { case ToggleSwitchPosition.One: SwitchPosition = ToggleSwitchPosition.Two; break; } } else if (action == SwitchAction.Decrement) { switch (SwitchPosition) { case ToggleSwitchPosition.Two: SwitchPosition = ToggleSwitchPosition.One; break; } } }
public override void MouseDrag(Point location) { if (ClickType == Controls.ClickType.Swipe) { Vector swipeVector = location - _mouseDownLocation; SwitchAction action = SwitchAction.None; switch (Orientation) { case ToggleSwitchOrientation.Vertical: if (swipeVector.Y < -5) { action = SwitchAction.Decrement; } else if (swipeVector.Y > 5) { action = SwitchAction.Increment; } break; case ToggleSwitchOrientation.Horizontal: if (swipeVector.X < -5) { action = SwitchAction.Decrement; } else if (swipeVector.X > 5) { action = SwitchAction.Increment; } break; } if (_mouseAction == false && action != SwitchAction.None) { ThrowSwitch(action); _mouseAction = true; } } }
protected abstract void ThrowSwitch(SwitchAction action);
public byte[] AutoIris(uint deviceAddress, SwitchAction action) { return Message.GetMessage(deviceAddress,0x00,0x2D,0x00,(byte)action); }
public byte[] AGC(uint deviceAddress, SwitchAction action) { return(Message.GetMessage(deviceAddress, 0x00, 0x2F, 0x00, (byte)action)); }
public Switch(SwitchAction action) { this.action = action; }