void btnStartSession_Click(object sender, EventArgs e) { DialogInput dlg = new DialogInput("Please enter target user name:"); if (dlg.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } client.RequestSession(dlg.Result, (senderClient, args) => { if (args.IsConfirmed) { Status("Session started with " + dlg.Result); InvokeUI(() => { btnSendMessage.Enabled = true; btnRemoteDesktop.Enabled = true; btnUploadFile.Enabled = true; btnEndSession.Enabled = true; }); } else { Status(args.Exception.ToString()); } }); }
void btnLogin_Click(object sender, EventArgs e) { DialogInput dlg = new DialogInput("Please enter your user name:"); if (dlg.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } client.Login(dlg.Result, (senderClient, args) => { if (args.IsValid) { Status("User Validated!"); this.InvokeUI(() => { this.Text = "Client - " + dlg.Result; btnStartSession.Enabled = true; btnLogin.Enabled = false; }); } if (args.HasError) { Status(args.Exception.ToString()); } }); }
void btnSendMessage_Click(object sender, EventArgs e) { DialogInput dlg = new DialogInput("Enter text message:"); if (dlg.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } client.SendTextMessage(dlg.Result); }