public CreateReply ( string command ) : |
||
command | string | |
return |
// 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; } }
// 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; } }