| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.ERPCloudClient
- {
- public partial class frmLoginSettings : LYFZ.ComponentLibrary.BaseContentsFormMain
- {
- public frmLoginSettings()
- {
- InitializeComponent();
- this.btnEnter.Click += btnEnter_Click;
- this.btnClose.Click += btnClose_Click;
- this.Shown += frmLoginSettings_Shown;
- }
- void frmLoginSettings_Shown(object sender, EventArgs e)
- {
- this.txtHostName.Text = this.clientCon.ServerIP;
- this.txtHostPort.Text = this.clientCon.Port.ToString();
- }
-
- LYFZ.CloudServerData.Model.CloudClientConfig clientCon;
- public LYFZ.CloudServerData.Model.CloudClientConfig ClientCon
- {
- get { return clientCon; }
- set { clientCon = value; }
- }
- void btnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- void btnEnter_Click(object sender, EventArgs e)
- {
- this.ClientCon.ServerIP = this.txtHostName.Text.Trim();
- if (String.IsNullOrEmpty(this.ClientCon.ServerIP.Trim()))
- {
- MessageBoxCustom.Show(LYFZ.WinAPI.UserTips.GetCanNotBeEmptyTips(this.lbHostName.Text));
- return;
- }
- if (String.IsNullOrEmpty(this.txtHostPort.Text.Trim()))
- {
- MessageBoxCustom.Show(LYFZ.WinAPI.UserTips.GetCanNotBeEmptyTips(this.lbHostPort.Text));
- return;
- }
- try
- {
- this.ClientCon.Port = Convert.ToUInt16(this.txtHostPort.Text.Trim());
- }
- catch
- {
- MessageBoxCustom.Show(this.lbHostPort.Text + "输入的格式不正确");
- return;
- }
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
- {
- backgroundWorker.ReportProgress(0, "正在更新...");
- if (!LYFZ.CloudServerData.SystemConfig.WriteCloudClientConfig(this.ClientCon))
- {
- MessageBoxCustom.Show("更新失败,请重新启动程序后重试", backgroundWorker: backgroundWorker);
- }
- else {
- this.DialogResult = System.Windows.Forms.DialogResult.OK;
- }
- });
- }
- }
- }
|