Пример #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);
        }
Пример #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();
        }
Пример #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>();
        }
Пример #4
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));
Пример #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="slave"></param>
 private void FireSlaveDisconnected(Slave slave)
 {
     m_slaveById.Remove(slave.Id);
     Slave.PostEvent(new SlaveEvent(SlaveEventType.Disconnected, slave));
 }
Пример #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="slave"></param>
 private void FireSlaveConnected(Slave slave) =>
 Slave.PostEvent(new SlaveEvent(SlaveEventType.Connected, slave));
Пример #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="slave"></param>
 public CredentialsWindow(Slave slave)
     : base(slave)
 {
     InitializeComponent();
 }
Пример #8
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));