private void SendControlCommand(IControlCommand command) { _logger.Trace("Sending control command {0}, {1}", command.DataType, command.Action); _isSending = true; // send var rawCommand = command.ToByteArray(); Socket.SendAsync(rawCommand); }
public Window() { CloseButton = new ExitButton() { Text = "Çıkış", Location = new Point(200, 200), Width = 100 }; MaximizeButton = new MaxButton() { Text = "Max", Location = new Point(1200, 10), Width = 50 }; timer = new Timer(); }
/// <summary> /// Sends the specified command to the client. /// </summary> /// <param name="command">The command to send.</param> public void Send(IControlCommand command) { Guard(); _logger.Trace("Send request for control command {0}, {1}", command.DataType, command.Action); lock (_commandQueue) { if (_isSending) { _commandQueue.Enqueue(command); } else { SendControlCommand(command); } } }
public void SetCommand(int index, IControlCommand command) { Commands[index] = command; }
/// <summary> /// Initializes a new instance of the <see cref="ControlCommandReceivedEventArgs"/> class. /// </summary> /// <param name="controlCommand">The control command that was received.</param> public ControlCommandReceivedEventArgs(IControlCommand controlCommand) { ControlCommand = controlCommand; }
private void RaiseControlCommandReceivedEvent(IControlCommand command) { _logger.Trace("Raising ControlCommandReceivedEvent for {0}, {1}", command.DataType, command.Action); var handlers = ControlCommandReceived; if (handlers != null) { // raise event handlers(this, new ControlCommandReceivedEventArgs(command)); } }
/// <summary> /// This method is not supported on the phone and throws a <c>NotSupportedException</c> when it's used. /// </summary> public void Send(IControlCommand command) { // we need to implement this method on the phone (to comply with the interface) // but of course the phone cannot send control commands. throw new NotSupportedException("Send is not supported on the phone."); }
/// <summary> /// Asynchronously sends a control command to the phone client. /// </summary> /// <param name="command">The control command to send.</param> public void SendCommandAsync(IControlCommand command) { try { // let the control channel handle send requests one at a time lock (_locker) { Guard(); _logger.Trace("Sending control command: {0}, {1}", command.DataType, command.Action); _controlChannel.Send(command); } } catch (Exception ex) { throw new PhoneControllerException("Error while send control command: " + ex.Message, ex); } }