Exemplo n.º 1
0
        private void mniEnter_Click(object sender, EventArgs e)
        {
            if (mniEnter.Text == "Login")
            {
                var dlg = new frmLogin(IPAddress.Parse("192.168.0.105"), 8001);
                dlg.ShowDialog();
                _client = dlg.Client;

                if (_client.Connected)
                {
                    _client.CommandReceived += client_CommandReceived;
                    _client.SendCommand(new Command(CommandType.FreeCommand, IPAddress.Broadcast, _client.Ip + ":" + _client.NetworkName));
                    _client.SendCommand(new Command(CommandType.SendClientList, _client.ServerIp));
                    AddToList(_client.Ip.ToString(), _client.NetworkName);
                    mniEnter.Text = "Log Off";
                }
            }
            else
            {
                mniEnter.Text = "Login";
                _privateWindowsList.Clear();
                _client.Disconnect();
                lstViwUsers.Items.Clear();
                txtNewMessage.Clear();
                txtNewMessage.Focus();
            }
        }
Exemplo n.º 2
0
        private void mniEnter_Click(object sender , EventArgs e)
        {
            if ( this.mniEnter.Text == "Login" )
            {
                frmLogin dlg = new frmLogin(IPAddress.Parse("127.0.0.1") , 8000);
                dlg.ShowDialog();
                this.client = dlg.Client;

                if ( this.client.Connected )
                {
                    this.client.CommandReceived += new Proshot.CommandClient.CommandReceivedEventHandler(client_CommandReceived);
                    this.client.SendCommand(new Command(CommandType.FreeCommand , IPAddress.Broadcast , this.client.IP + ":" + this.client.NetworkName));
                    this.client.SendCommand(new Proshot.CommandClient.Command(Proshot.CommandClient.CommandType.SendClientList , this.client.ServerIP));
                    this.AddToList(this.client.IP.ToString() , this.client.NetworkName);
                    this.mniEnter.Text = "Log Off";
                }
            }
            else
            {
                this.mniEnter.Text = "Login";
                this.privateWindowsList.Clear();
                this.client.Disconnect();
                this.lstViwUsers.Items.Clear();
                this.txtNewMessage.Clear();
                this.txtNewMessage.Focus();
            }
        }
Exemplo n.º 3
0
 private void mniEnter_Click(object sender, EventArgs e)
 {
     if (mniEnter.Text == "Вход")
     {
         if (!string.IsNullOrEmpty(_serverIp))
         {
             Messages.Text = secondMessage;
             var dlg = new frmLogin(IPAddress.Parse(_serverIp), 8001);
             dlg.ShowDialog();
             _client = dlg.Client;
             Messages.Text = thirdMessage;
             if (_client.Connected)
             {
                 _client.CommandReceived += client_CommandReceived;
                 _client.SendCommand(new Command(CommandType.FreeCommand, IPAddress.Broadcast,
                                                 _client.Ip + ":" + _client.NetworkName));
                 _client.SendCommand(new Command(CommandType.SendClientList, _client.ServerIp));
                 AddToList(_client.Ip.ToString(), _client.NetworkName);
                 mniEnter.Text = "Выход";
                 mniEnter.Enabled = splitContainer.Enabled = false;
                 Messages.Text = fourthMessage;
             }
         }
     }
     else
     {
         mniEnter.Text = "Вход";
         _privateWindowsList.Clear();
         _client.Disconnect();
         lstViwUsers.Items.Clear();
         mniEnter.Enabled = splitContainer.Enabled = true;
     }
 }