protected virtual void OnSendCommand( SendCommandEventArgs e ) { if ( SendCommand != null ) { SendCommand( this, e ); } }
/// <summary> /// Button send preview /// </summary> private void bPreview_SendCommand(object sender, SendCommandEventArgs e) { var cmd = ""; if (e.UsePrefix) { cmd += Pandora.Profile.General.CommandPrefix; } cmd += e.Command; MessageBox.Show(string.Format(Pandora.Localization.TextProvider["ButtonMenuEditor.PreviewMsg"], cmd)); }
private void GroupItem_OnSendCommand(object sender, SendCommandEventArgs e) { try { ApplicationData .Settings .CreateGateway() .SendCommandAsync(e.command, e.channel, e.brightness); } catch (Exception) { MessageBox.Show(AppResources.Common_SendCommandError); } }
protected virtual void OnSendCommand(GatewayCommand command, byte channel, byte brightness = 0) { var handler = SendCommand; if (handler != null) { var args = new SendCommandEventArgs { command = command, channel = channel, brightness = brightness }; handler(this, args); } }
public void ZoneCommand() { void check(ushort id, int code, string payload, enuUnitCommand command, bool ensureNull = false) { SendCommandEventArgs actual = null; omniLink.OnSendCommand += (sender, e) => { actual = e; }; messageProcessor.Process($"omnilink/zone{id}/command", payload); SendCommandEventArgs expected = new SendCommandEventArgs() { Cmd = command, Par = (byte)code, Pr2 = id }; if (ensureNull) { Assert.IsNull(actual); } else { Assert.AreEqual(expected, actual); } } // Standard format check(1, 0, "bypass", enuUnitCommand.Bypass); check(1, 0, "restore", enuUnitCommand.Restore); // Check all zones check(0, 0, "restore", enuUnitCommand.Restore); // Not allowed to bypass all zones check(0, 0, "bypass", enuUnitCommand.Bypass, true); // Check with optional code check(1, 1, "bypass,1", enuUnitCommand.Bypass); // Check case insensitivity check(2, 0, "BYPASS", enuUnitCommand.Bypass); }
/// <summary> /// Testing command sending /// </summary> private void m_Def_SendCommand(object sender, SendCommandEventArgs e) { string cmd = ""; if ( e.UsePrefix ) cmd += Pandora.Profile.General.CommandPrefix; cmd += e.Command; MessageBox.Show( string.Format( Pandora.Localization.TextProvider[ "ButtonMenuEditor.PreviewMsg" ], cmd ) ); }
protected void OnChildSendCommand( object sender, SendCommandEventArgs e ) { m_LastCommand = e; OnSendCommand( e ); UpdateToolTip(); }
/// <summary> /// 发送命令 /// </summary> /// <param name="args"></param> private void TestClientClientOnSendCommand(SendCommandEventArgs args) { ConsoleHelper.TestClientWriteLine(args.Command.StringData, "发送"); }
/// <summary> /// Send command /// </summary> private void m_Def_SendCommand(object sender, SendCommandEventArgs e) { OnSendCommand( e ); if ( m_IsActive && !e.Sent ) Pandora.SendToUO( e.Command, e.UsePrefix ); }
/// <summary> /// Sending a command to UO /// </summary> private void MenuDef_SendCommand(object sender, SendCommandEventArgs e) { OnSendCommand( e ); }