Ejemplo n.º 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);
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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>();
        }
Ejemplo n.º 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));
Ejemplo n.º 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));
 }
Ejemplo n.º 6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="slave"></param>
 private void FireSlaveConnected(Slave slave) =>
 Slave.PostEvent(new SlaveEvent(SlaveEventType.Connected, slave));
Ejemplo n.º 7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="slave"></param>
 public CredentialsWindow(Slave slave)
     : base(slave)
 {
     InitializeComponent();
 }
Ejemplo n.º 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));