Esempio n. 1
0
 private static void socketListener_ClientLeft(object sender, ClientEventArgs e)
 {
     var client = _clients.FirstOrDefault(c => Equals(c.Connection, e.Connection));
     if (client != null)
     {
         _clients.Remove(client);
         SMLogger.LogThis("Client left");
     }
 }
Esempio n. 2
0
 private static void socketListener_ClientConnected(object sender, ClientEventArgs e)
 {
     try
     {
         var client = new ClientHandler(e.Connection);
         _clients.Add(client);
         SMLogger.LogThis("Client connected");
     }
     catch (Exception ex)
     {
         SMLogger.LogThis(ex.ToString());
     }
 }
Esempio n. 3
0
        private void socketListener_ClientLeft(object sender, ClientEventArgs e)
        {
            ClientTabs.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
                {
                    TabItem[] tabs = new TabItem[ClientTabs.Items.Count];
                    ClientTabs.Items.CopyTo(tabs, 0);
                    foreach (TabItem tab in tabs)
                    {
                        if (tab.Content is ClientStatusDisplay && ((ClientStatusDisplay)tab.Content) == _tabContents[e.Connection]) ClientTabs.Items.Remove(tab);
                    }

                    _connections--;
                    statConnections.Text = _connections.ToString();
                }));
        }
Esempio n. 4
0
        void socketListener_ClientConnected(object sender, ClientEventArgs e)
        {
            ClientTabs.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
                  {
                      ClientStatusDisplay csd = new ClientStatusDisplay(new ClientHandler(e.Connection));
                      _tabContents[e.Connection] = csd;
                      TabItem tab = new TabItem();
                      tab.Content = csd;
                      tab.Header = e.Connection.ClientSocket.Client.RemoteEndPoint.ToString();
                      ClientTabs.Items.Add(tab);

                      _connections++;
                      statConnections.Text = _connections.ToString();
                  }));
        }