Example #1
0
 public Client()
 {
     SrvInfoList = new List<ServerInfo>();
     LoadSrvInfoList();
     connectedServer = new Server();
     connectedServer.Disconnected += new Server.ServerDisconnectedHandler(server_Disconnected);
 }
 public Client()
 {
     this.ServerInfoList = new List<ServerInfo>();
     this.LoadServerInfoList();
     this.connectedServer = new Server();
     this.connectedServer.Disconnected += new Server.ServerDisconnectedHandler(this.ServerDisconnected);
 }
        public void server_Disconnected(Server sender)
        {
            if (InvokeRequired)
            {

                Invoke(new server_DisconnectedDlg(server_Disconnected),
                    new object[] { sender });
            }
            else
            {
            tsmiDisconnect.Enabled = false;
            sblConnectionStatus.Text = "Disconnected";
            sblConnectionStatus.ForeColor = Color.Red;
            tsmiQuickConnect.Enabled = true;
            }
        }
 private void server_Connected(Server sender)
 {
     tsmiDisconnect.Enabled = true;
     sblConnectionStatus.Visible = true;
     sblConnectionStatus.Text = "Connected";
     sblConnectionStatus.ForeColor = Color.LightGreen;
 }
Example #5
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            this.m_windows = new Hashtable();
            this.ContactsCollection = new ContactCollection();

            this.m_contacts = new Contacts(Properties.Settings.Default.ServerIp, Properties.Settings.Default.ServerPort);
            this.m_contacts.Nickname = tbNickname.Text.ToString();
            this.m_contacts.Reconnect = Properties.Settings.Default.Reconnect;
            this.m_contacts.ReconnectTimeout = Properties.Settings.Default.ReconnectTimeout;
            this.m_contacts.ConnectionStateChanged += new Contacts.ConnectionStateHandler(Contacts_ConnectionStateChanged);
            this.m_contacts.ContactsList += new Contacts.ContactsHandler(Contacts_ContactsList);
            this.m_contacts.ContactsAdd += new Contacts.ContactsHandler(Contacts_ContactsAdd);
            this.m_contacts.ContactsUpdate += new Contacts.ContactsHandler(Contacts_ContactsUpdate);
            this.m_contacts.ContactsDelete += new Contacts.ContactsHandler(Contacts_ContactsDelete);
            this.m_contacts.Connect();

            this.m_server = new Server(Properties.Settings.Default.ClientPort);
            this.m_server.ConnectionAccepted += new Server.ConnectionAcceptedHandler(Server_ConnectionAccepted);
            this.m_server.Listen();

            this.m_messenger = new Messenger();
            this.m_messenger.Nameserver.SignedIn += new EventHandler<EventArgs>(Nameserver_SignedIn);
            this.m_messenger.Nameserver.SignedOff += new EventHandler<SignedOffEventArgs>(Nameserver_SignedOff);
            this.m_messenger.Owner.DisplayImageChanged += new EventHandler<EventArgs>(Owner_DisplayImageChanged);
            this.m_messenger.ConversationCreated += new EventHandler<ConversationCreatedEventArgs>(m_messenger_ConversationCreated);
            this.m_messenger.ContactService.ReverseAdded += new EventHandler<ContactEventArgs>(ContactService_ReverseAdded);
        }