コード例 #1
0
 private void btnConnect_Click(object sender, EventArgs e)
 {
     if (_client.connected == false)
     {
         if (txtUser.Text.Length != 0 && txtIp.Text.Length != 0)
         {
             _client.InitializeConnection(txtIp.Text, txtUser.Text);
             btnConnect.Content = "Disconnect";
             txtIp.IsEnabled    = false;
             txtUser.IsEnabled  = false;
             txtMessage.Focus();
         }
         else
         {
             MessageBox.Show("Benutzername und Server IP müssen eingetragen sein!");
         }
     }
     else
     {
         btnConnect.Content = "Connect";
         txtIp.IsEnabled    = true;
         txtUser.IsEnabled  = true;
         _client.closeConnection();
     }
 }