using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace RDClient { /// /// 建立连接的对话框 /// public partial class frm_Connection : Form { public NetworkRemoteControlLib.ConnectionItem HostConnectionItem { get; set; } public frm_Connection() { InitializeComponent(); this.Load += Frm_Connection_Load; } private void Frm_Connection_Load(object sender, EventArgs e) { if (this.HostConnectionItem == null) { this.HostConnectionItem = new NetworkRemoteControlLib.ConnectionItem(); } this.txt_Hostname.Text = this.HostConnectionItem.HostNameIP; this.nuprot.Value = this.HostConnectionItem.HostPort; this.txtDName.Text = this.HostConnectionItem.DescriptionName; this.txtDinfo.Text = this.HostConnectionItem.DescriptionInformation; } private void btn_Enter_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.txt_Hostname.Text)) { MessageBox.Show($"{this.label3.Text}不能为空"); return; } if (string.IsNullOrEmpty(this.txtDName.Text)) { MessageBox.Show($"{this.label1.Text}不能为空"); return; } this.HostConnectionItem.HostNameIP = this.txt_Hostname.Text.Trim(); this.HostConnectionItem.HostPort=Convert.ToInt32(this.nuprot.Value); this.HostConnectionItem.DescriptionName = this.txtDName.Text; this.HostConnectionItem.DescriptionInformation= this.txtDinfo.Text; this.DialogResult=DialogResult.OK; } private void btn_Cancel_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.Cancel; } } }