/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Server_ReceiveReady(object sender, NetMQSocketEventArgs e) { NetMQMessage mqmessage = null; if (!e.Socket.TryReceiveMultipartMessage(ref mqmessage)) { return; } var identity = mqmessage.First.Buffer; var clientId = BitConverter.ToInt32(identity, 1); var message = NetMessage.Deserialize(mqmessage.Last.Buffer); Slave slave; if (!m_slaveById.ContainsKey(clientId)) { m_slaveById.Add(clientId, slave = new Slave(identity, clientId)); } else { slave = m_slaveById[clientId]; } FireSlaveIncommingMessage(slave, message); }
/// <summary> /// /// </summary> /// <param name="slave"></param> public WebcamWindow(Slave slave) : base(slave) { InitializeComponent(); // in case we leave the window withouth stopping Closing += (s, e) => StopCapture(); }
/// <summary> /// /// </summary> /// <param name="slave"></param> public FileManagerWindow(Slave slave) : base(slave) { InitializeComponent(); Loaded += OnNavigate; FileTransactionsList.DataContext = ViewModelCommands; FilesList.DataContext = ViewModelFiles = new ViewModelCollection <FileMeta>(); }
public DelayTimeWindow(string flag, Slave slave) : base(slave) { InitializeComponent(); action = flag; }
/// <summary> /// /// </summary> /// <param name="slave"></param> /// <param name="message"></param> private void FireSlaveIncommingMessage(Slave slave, NetMessage message) => Slave.PostEvent(new SlaveEvent(SlaveEventType.IncommingMessage, slave, message));
/// <summary> /// /// </summary> /// <param name="slave"></param> private void FireSlaveDisconnected(Slave slave) { m_slaveById.Remove(slave.Id); Slave.PostEvent(new SlaveEvent(SlaveEventType.Disconnected, slave)); }
/// <summary> /// /// </summary> /// <param name="slave"></param> private void FireSlaveConnected(Slave slave) => Slave.PostEvent(new SlaveEvent(SlaveEventType.Connected, slave));
/// <summary> /// 任务管理器窗口 /// </summary> /// <param name="slave"></param> public TasksWindow(Slave slave) : base(slave) { InitializeComponent(); Send(new StartTasksMessage()); }
/// <summary> /// /// </summary> /// <param name="slave"></param> /// <param name="message"></param> private void FireSlaveOutgoingMessage(Slave slave, NetMessage message) => PostEvent(new SlaveEvent(SlaveEventType.OutgoingMessage, slave, message));