private void Workspace_Changed(Events.Abstract e) { Changed = true; switch (e.type) { case Blockly.Events.CREATE: var cre = (Events.Create)e; BlockCreated?.Invoke(this, cre); break; case Blockly.Events.DELETE: var del = (Events.Delete)e; BlockDeleted?.Invoke(this, del); break; case Blockly.Events.CHANGE: var chg = (Events.Change)e; BlockChanged?.Invoke(this, chg); break; case Blockly.Events.MOVE: var mov = (Events.Move)e; BlockMoveed?.Invoke(this, mov); break; case Blockly.Events.UI: var ui = (Events.Ui)e; UiEvent?.Invoke(this, ui); break; } }
protected override void OnMessage(MessageEventArgs e) { Console.WriteLine("Got command from ui: " + e.Data); var command = JsonConvert.DeserializeObject <TerminalCommand>(e.Data); var eventArgs = new UIEventArgs(); switch (command.Action) { case "ConfirmTransaction": eventArgs.UIEvent = UIEvent.ConfirmTransaction; break; case "DeclineTransaction": eventArgs.UIEvent = UIEvent.DeclineTransaction; break; case "ConfirmPayment": eventArgs.UIEvent = UIEvent.ConfirmPayment; break; case "DeclinePayment": eventArgs.UIEvent = UIEvent.DeclinePayment; break; case "ConfirmAll": eventArgs.UIEvent = UIEvent.ConfirmAll; break; default: break; } UiEvent?.Invoke(this, eventArgs); }