using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace PDAForm.Comm { public partial class frmSetServer : Form { public frmSetServer() { InitializeComponent(); } private void frmSetServer_Load(object sender, EventArgs e) { this.txtWebService.Text = MyAppconfig.GetValue("WebService"); } private void btnTest_Click(object sender, EventArgs e) { try { PDAForm.Comm.PDAService.Service service = new PDAForm.Comm.PDAService.Service(); service.Url = this.txtWebService.Text; if (service.HelloWorld() == "Hello World") { MyMessageBox.ShowInfoMessage("测试成功!"); } } catch (Exception ex) { MyMessageBox.ShowErrorMessage("测试失败,详细原因如下:\r\n" + ex.Message); } } private void btnSave_Click(object sender, EventArgs e) { if (this.txtWebService.Text.Trim() != "") { MyAppconfig.SetValue("WebService", this.txtWebService.Text.Trim()); MyMessageBox.ShowInfoMessage("设置成功,重启程序生效!"); } else { MyMessageBox.ShowErrorMessage("请行输入服务器连接地址!"); } } private void btnClose_Click(object sender, EventArgs e) { this.Close(); } } }