ConClientBroadcast.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows.Forms;
  7. namespace ErgometerDoctorApplication
  8. {
  9. public class ConClientBroadcast : Panel
  10. {
  11. public ConClientBroadcast() : base()
  12. {
  13. this.Dock = System.Windows.Forms.DockStyle.Fill;
  14. this.Location = new System.Drawing.Point(0, 0);
  15. this.Name = "ConClientBroadcast";
  16. this.Size = new System.Drawing.Size(584, 459);
  17. this.TabIndex = 0;
  18. buttonBroadcast = new Button();
  19. textBoxBroadcast = new TextBox();
  20. //
  21. // buttonLogin
  22. //
  23. this.buttonBroadcast.Anchor = AnchorStyles.Left | AnchorStyles.Top;
  24. this.buttonBroadcast.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
  25. this.buttonBroadcast.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  26. this.buttonBroadcast.Location = new System.Drawing.Point(200, 20);
  27. this.buttonBroadcast.Name = "buttonCreate";
  28. this.buttonBroadcast.Size = new System.Drawing.Size(168, 31);
  29. this.buttonBroadcast.TabIndex = 3;
  30. this.buttonBroadcast.Text = "Broadcast";
  31. this.buttonBroadcast.UseVisualStyleBackColor = true;
  32. this.buttonBroadcast.Click += new System.EventHandler(this.buttonBroadcast_Click);
  33. //
  34. // textBoxPassword
  35. //
  36. this.textBoxBroadcast.Anchor = AnchorStyles.Left | AnchorStyles.Top;
  37. this.textBoxBroadcast.Location = new System.Drawing.Point(20, 20);
  38. this.textBoxBroadcast.MaxLength = 16;
  39. this.textBoxBroadcast.Name = "textBoxPassword";
  40. this.textBoxBroadcast.Size = new System.Drawing.Size(167, 20);
  41. this.textBoxBroadcast.TabIndex = 2;
  42. this.textBoxBroadcast.KeyDown += TextBoxBroadcast_KeyDown;
  43. this.Controls.Add(textBoxBroadcast);
  44. this.Controls.Add(buttonBroadcast);
  45. }
  46. private void TextBoxBroadcast_KeyDown(object sender, KeyEventArgs e)
  47. {
  48. if (e.KeyCode == Keys.Enter)
  49. {
  50. buttonBroadcast_Click(this, new EventArgs());
  51. }
  52. }
  53. private void buttonBroadcast_Click(object sender, EventArgs e)
  54. {
  55. MainClient.SendNetCommand(new ErgometerLibrary.NetCommand(textBoxBroadcast.Text, MainClient.Session));
  56. textBoxBroadcast.Text = "";
  57. }
  58. public System.Windows.Forms.TextBox textBoxBroadcast;
  59. public System.Windows.Forms.Button buttonBroadcast;
  60. }
  61. }