Example #1
0
		protected virtual void OnSendCommand( SendCommandEventArgs e )
		{
			if ( SendCommand != null )
			{
				SendCommand( this, e );
			}
		}
Example #2
0
        /// <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));
        }
Example #3
0
 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);
     }
 }
Example #4
0
        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);
            }
        }
Example #5
0
        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);
        }
Example #6
0
		/// <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 ) );
		}
Example #7
0
		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, "发送");
 }
Example #9
0
		/// <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 );
		}
Example #10
0
		/// <summary>
		/// Sending a command to UO
		/// </summary>
		private void MenuDef_SendCommand(object sender, SendCommandEventArgs e)
		{
			OnSendCommand( e );
		}