示例#1
0
 private void btnConnect_Click(object sender, EventArgs e)
 {
     if(txtUsername.Text != string.Empty)
     {
         StaticValues.self.Username = txtUsername.Text;
         StaticValues.self.IP = StaticMethods.GetUserIp();
         ivApi = new ApiCommunication();
         bool success = ivApi.Connect();
         if (success)
         {
             this.Hide();
             var DCSharpForm = new DCSharp();
             DCSharpForm.FormClosed += (s, args) => this.Close();
             DCSharpForm.Show();
         }
         else
         {
             MessageBox.Show("Username taken.");
         }
     }
     else
     {
         MessageBox.Show("Invalid username.");
     }
 }
示例#2
0
 public DCSharp()
 {
     InitializeComponent();
     this.FormClosed += DCSharp_FormClosed;
     this.listUsers.MouseDoubleClick += ListUsers_MouseDoubleClick;
     ivApi = new ApiCommunication();
     ivClient = new ClientCommunication();
     ivListener = new ClientListener(this.listFiles);
     ivApi.GetUsers(listUsers);
 }