Example #1
0
        /// <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);
        }
Example #2
0
        /// <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();
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="slave"></param>
        public FileManagerWindow(Slave slave) : base(slave)
        {
            InitializeComponent();

            Loaded += OnNavigate;

            FileTransactionsList.DataContext = ViewModelCommands;
            FilesList.DataContext            = ViewModelFiles = new ViewModelCollection <FileMeta>();
        }
Example #4
0
 public DelayTimeWindow(string flag, Slave slave)
     : base(slave)
 {
     InitializeComponent();
     action = flag;
 }
Example #5
0
 /// <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));
Example #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="slave"></param>
 private void FireSlaveDisconnected(Slave slave)
 {
     m_slaveById.Remove(slave.Id);
     Slave.PostEvent(new SlaveEvent(SlaveEventType.Disconnected, slave));
 }
Example #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="slave"></param>
 private void FireSlaveConnected(Slave slave) =>
 Slave.PostEvent(new SlaveEvent(SlaveEventType.Connected, slave));
Example #8
0
 /// <summary>
 /// 任务管理器窗口
 /// </summary>
 /// <param name="slave"></param>
 public TasksWindow(Slave slave)
     : base(slave)
 {
     InitializeComponent();
     Send(new StartTasksMessage());
 }
Example #9
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="slave"></param>
 /// <param name="message"></param>
 private void FireSlaveOutgoingMessage(Slave slave, NetMessage message) =>
 PostEvent(new SlaveEvent(SlaveEventType.OutgoingMessage, slave, message));