Пример #1
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 (dlg.IsLoginSuccessful)
                {
                    if (this.client.Connected)
                    {
                        this.mniEnter.Text           = "Log Off";
                        this.txtMessages.Text        = dlg.MessageRecievedFromServer;
                        this.client.CommandReceived += new Project.CommandClient.CommandReceivedEventHandler(client_CommandReceived);
                        this.client.SendCommand(new Project.CommandClient.Command(Project.CommandClient.CommandType.SendClientList, this.client.ServerIP));
                        //this.AddToList(this.client.IP.ToString(), this.client.NetworkName);
                    }
                }
                else
                {
                    this.txtMessages.Text = dlg.MessageRecievedFromServer;
                }
            }
            else
            {
                this.mniEnter.Text = "Login";
                this.privateWindowsList.Clear();
                this.client.Disconnect();
                this.lstViwUsers.Items.Clear();
                this.txtNewMessage.Clear();
                this.txtNewMessage.Focus();
            }
        }
Пример #2
0
 public frmMain()
 {
     InitializeComponent();
     this.privateWindowsList = new List <frmPrivate>();
     this.client             = new Project.CommandClient.CMDClient(IPAddress.Parse("127.0.0.1"), 8000, "None");
 }