示例#1
0
            public void sendMessage(Messages.LobbyViewMessage msg)
            {
                switch (msg)
                {
                case Messages.LobbyViewMessage.connect:
                    myController.MessageSentFromView(msg, new List <object> {
                        DisputeCommonGlobals.defaultAddress,
                        DisputeCommonGlobals.defaultPort, playerName
                    }, this);
                    break;

                default:
                    break;
                }
            }
 private void btnConnect_Click(object sender, EventArgs e)
 {
     if (!asDialog)
     {
         myController.MessageSentFromView(Messages.LobbyViewMessage.connect, new List <object> {
             txtAddress.Text, txtPort.Text, txtName.Text
         }, this);
     }
     else
     {
         if (String.IsNullOrEmpty(txtName.Text) || String.IsNullOrEmpty(txtPort.Text) ||
             String.IsNullOrEmpty(txtAddress.Text))
         {
             MessageBox.Show("Fill all info", "Error");
         }
         else
         {
             PlayerName = txtName.Text;
             Address    = txtAddress.Text;
             Port       = txtPort.Text;
             this.Close();
         }
     }
 }