CodeImp.Gluon.RemoteCommand.CreateReply C# (CSharp) Метод

CreateReply() публичный Метод

public CreateReply ( string command ) : RemoteCommand
command string
Результат RemoteCommand
        public RemoteCommand CreateReply(string command)
        {
            RemoteCommand newcmd = new RemoteCommand(client);
            newcmd.source = this.target;
            newcmd.target = this.source;
            newcmd.command = command;
            return newcmd;
        }

Usage Example

Пример #1
0
        // Receive messages from remote service
        private void remote_ReceiveCommand(RemoteCommand cmd)
        {
            RemoteCommand reply;

            // Title requested
            switch (cmd.Command)
            {
            case "STATUS":
                reply = cmd.CreateReply("STATUS");
                string statusinfo;
                if (isplaying)
                {
                    if (ispaused)
                    {
                        statusinfo = "PAUSED\r\n";
                    }
                    else
                    {
                        statusinfo = "PLAYING\r\n";
                    }

                    statusinfo += itemtitle.Text + "\r\n";
                    statusinfo += medialength + "\r\n";
                    statusinfo += currentmediapos + "\r\n";
                }
                else
                {
                    statusinfo = "STOPPED\r\n";
                }
                reply.SetData(statusinfo);
                remote.SendCommand(reply);
                break;

            case "STOP":
                reply = cmd.CreateReply("OK");
                remote.SendCommand(reply);
                stopbutton_Click(stopbutton, EventArgs.Empty);
                break;

            case "PAUSE":
                reply = cmd.CreateReply("OK");
                remote.SendCommand(reply);
                pausebutton_Click(pausebutton, EventArgs.Empty);
                break;
            }
        }
All Usage Examples Of CodeImp.Gluon.RemoteCommand::CreateReply