frm_Connection.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. namespace RemoteClient
  9. {
  10. /// <summary>
  11. /// 建立连接的对话框
  12. /// </summary>
  13. public partial class frm_Connection : Form
  14. {
  15. /// <summary>
  16. /// 获取要连接的主机IP
  17. /// </summary>
  18. public string ServerIP
  19. {
  20. get { return (rdb_IsIP.Checked ? ipc_ServerIP.Text : RemoteControlLib.Common.Network.GetIpAdrress(HostName)); }
  21. }
  22. /// <summary>
  23. /// 获取要连接的主机名
  24. /// </summary>
  25. public string HostName
  26. {
  27. get { return txt_Hostname.Text; }
  28. }
  29. public frm_Connection()
  30. {
  31. InitializeComponent();
  32. ipc_ServerIP.Enabled = true;
  33. txt_Hostname.Enabled = false;
  34. ipc_ServerIP.Focus();
  35. }
  36. private void btn_Enter_Click(object sender, EventArgs e)
  37. {
  38. this.Close();
  39. }
  40. private void btn_Cancel_Click(object sender, EventArgs e)
  41. {
  42. this.Close();
  43. }
  44. private void rdb_IsIP_CheckedChanged(object sender, EventArgs e)
  45. {
  46. txt_Hostname.Enabled = false;
  47. ipc_ServerIP.Enabled = true;
  48. ipc_ServerIP.Focus();
  49. }
  50. private void rdb_Hostname_CheckedChanged(object sender, EventArgs e)
  51. {
  52. ipc_ServerIP.Enabled = false;
  53. txt_Hostname.Enabled = true;
  54. txt_Hostname.Focus();
  55. }
  56. }
  57. }