namespace AsiaINFO.SMS.APPCMPP2 { using Common; using System; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; public class SysForm : Form { private TextBox ActiveTestInterval; private CheckBox AutoConnect; private Button Cancel; private IContainer components; private TextBox DBPassWD; private TextBox DBSource; private TextBox DBUserID; private GroupBox groupBox1; private GroupBox groupBox2; private GroupBox groupBox3; private GroupBox groupBox4; private GroupBox groupBox5; private GroupBox groupBox6; private TextBox InitialCatalog; private Label label1; private Label label10; private Label label11; private Label label12; private Label label13; private Label label14; private Label label15; private Label label16; private Label label17; private Label label18; private Label label19; private Label label2; private Label label20; private Label label3; private Label label4; private Label label5; private Label label6; private Label label7; private Label label8; private Label label9; private RadioButton LogDebugLevel; private RadioButton LogErrLevel; private RadioButton LogMsgLevel; private RadioButton LogSysLevel; private TextBox MsgListBoxMaxRow; private TextBox MTLimit; private Button OK; private TextBox PASSWD; private TextBox ProgramID; private TextBox ReSubmitInterval; private TextBox ServerIP; private TextBox ServerPort; private TextBox SlidingWindowSize; private TextBox SPCODE; private TextBox SPID; public SysForm() { this.InitializeComponent(); this.InitializeData(); } private void Cancel_Click(object sender, EventArgs e) { base.Close(); } protected override void Dispose(bool disposing) { if (disposing && (this.components != null)) { this.components.Dispose(); } base.Dispose(disposing); } private void InitializeComponent() { this.label10 = new Label(); this.label9 = new Label(); this.groupBox2 = new GroupBox(); this.DBPassWD = new TextBox(); this.DBUserID = new TextBox(); this.label7 = new Label(); this.DBSource = new TextBox(); this.groupBox1 = new GroupBox(); this.label6 = new Label(); this.label5 = new Label(); this.label1 = new Label(); this.label2 = new Label(); this.SPCODE = new TextBox(); this.ServerPort = new TextBox(); this.label3 = new Label(); this.ServerIP = new TextBox(); this.PASSWD = new TextBox(); this.label4 = new Label(); this.SPID = new TextBox(); this.Cancel = new Button(); this.OK = new Button(); this.groupBox3 = new GroupBox(); this.label12 = new Label(); this.MsgListBoxMaxRow = new TextBox(); this.groupBox4 = new GroupBox(); this.label8 = new Label(); this.label11 = new Label(); this.MTLimit = new TextBox(); this.LogDebugLevel = new RadioButton(); this.LogMsgLevel = new RadioButton(); this.LogErrLevel = new RadioButton(); this.groupBox5 = new GroupBox(); this.LogSysLevel = new RadioButton(); this.groupBox6 = new GroupBox(); this.label18 = new Label(); this.label16 = new Label(); this.label19 = new Label(); this.label15 = new Label(); this.label17 = new Label(); this.label14 = new Label(); this.ProgramID = new TextBox(); this.ActiveTestInterval = new TextBox(); this.label13 = new Label(); this.ReSubmitInterval = new TextBox(); this.SlidingWindowSize = new TextBox(); this.AutoConnect = new CheckBox(); this.label20 = new Label(); this.InitialCatalog = new TextBox(); this.groupBox2.SuspendLayout(); this.groupBox1.SuspendLayout(); this.groupBox3.SuspendLayout(); this.groupBox4.SuspendLayout(); this.groupBox5.SuspendLayout(); this.groupBox6.SuspendLayout(); base.SuspendLayout(); this.label10.AutoSize = true; this.label10.Location = new Point(6, 0x6b); this.label10.Name = "label10"; this.label10.Size = new Size(0x1d, 12); this.label10.TabIndex = 20; this.label10.Text = "密码"; this.label9.AutoSize = true; this.label9.Location = new Point(6, 80); this.label9.Name = "label9"; this.label9.Size = new Size(0x29, 12); this.label9.TabIndex = 0x12; this.label9.Text = "用户名"; this.groupBox2.Controls.Add(this.label20); this.groupBox2.Controls.Add(this.InitialCatalog); this.groupBox2.Controls.Add(this.label10); this.groupBox2.Controls.Add(this.label9); this.groupBox2.Controls.Add(this.DBPassWD); this.groupBox2.Controls.Add(this.DBUserID); this.groupBox2.Controls.Add(this.label7); this.groupBox2.Controls.Add(this.DBSource); this.groupBox2.Location = new Point(0xfe, 12); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new Size(0xe4, 0xa6); this.groupBox2.TabIndex = 10; this.groupBox2.TabStop = false; this.groupBox2.Text = "数据库(重启生效)"; this.DBPassWD.Location = new Point(80, 0x68); this.DBPassWD.Name = "DBPassWD"; this.DBPassWD.Size = new Size(100, 0x15); this.DBPassWD.TabIndex = 0x15; this.DBUserID.Location = new Point(80, 0x4d); this.DBUserID.Name = "DBUserID"; this.DBUserID.Size = new Size(100, 0x15); this.DBUserID.TabIndex = 0x13; this.label7.AutoSize = true; this.label7.Location = new Point(6, 0x1a); this.label7.Name = "label7"; this.label7.Size = new Size(0x1d, 12); this.label7.TabIndex = 14; this.label7.Text = "地址"; this.DBSource.Location = new Point(80, 0x17); this.DBSource.Name = "DBSource"; this.DBSource.Size = new Size(100, 0x15); this.DBSource.TabIndex = 15; this.groupBox1.Controls.Add(this.label6); this.groupBox1.Controls.Add(this.label5); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.label2); this.groupBox1.Controls.Add(this.SPCODE); this.groupBox1.Controls.Add(this.ServerPort); this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.ServerIP); this.groupBox1.Controls.Add(this.PASSWD); this.groupBox1.Controls.Add(this.label4); this.groupBox1.Controls.Add(this.SPID); this.groupBox1.Location = new Point(12, 12); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new Size(0xe4, 0xa6); this.groupBox1.TabIndex = 11; this.groupBox1.TabStop = false; this.groupBox1.Text = "连接信息(重连生效)"; this.label6.AutoSize = true; this.label6.Location = new Point(0xba, 50); this.label6.Name = "label6"; this.label6.Size = new Size(0x17, 12); this.label6.TabIndex = 0x12; this.label6.Text = "6位"; this.label5.AutoSize = true; this.label5.Location = new Point(6, 0x17); this.label5.Name = "label5"; this.label5.Size = new Size(0x29, 12); this.label5.TabIndex = 0x16; this.label5.Text = "接入号"; this.label1.AutoSize = true; this.label1.Location = new Point(6, 0x83); this.label1.Name = "label1"; this.label1.Size = new Size(0x41, 12); this.label1.TabIndex = 20; this.label1.Text = "服务器端口"; this.label2.AutoSize = true; this.label2.Location = new Point(6, 0x4d); this.label2.Name = "label2"; this.label2.Size = new Size(0x1d, 12); this.label2.TabIndex = 0x12; this.label2.Text = "密码"; this.SPCODE.Location = new Point(80, 20); this.SPCODE.Name = "SPCODE"; this.SPCODE.Size = new Size(100, 0x15); this.SPCODE.TabIndex = 0x17; this.ServerPort.Location = new Point(80, 0x80); this.ServerPort.Name = "ServerPort"; this.ServerPort.Size = new Size(100, 0x15); this.ServerPort.TabIndex = 0x11; this.label3.AutoSize = true; this.label3.Location = new Point(6, 0x68); this.label3.Name = "label3"; this.label3.Size = new Size(0x41, 12); this.label3.TabIndex = 0x10; this.label3.Text = "服务器地址"; this.ServerIP.Location = new Point(80, 0x65); this.ServerIP.Name = "ServerIP"; this.ServerIP.Size = new Size(100, 0x15); this.ServerIP.TabIndex = 0x15; this.PASSWD.Location = new Point(80, 0x4a); this.PASSWD.Name = "PASSWD"; this.PASSWD.Size = new Size(100, 0x15); this.PASSWD.TabIndex = 0x13; this.label4.AutoSize = true; this.label4.Location = new Point(6, 50); this.label4.Name = "label4"; this.label4.Size = new Size(0x35, 12); this.label4.TabIndex = 14; this.label4.Text = "企业代码"; this.SPID.Location = new Point(80, 0x2f); this.SPID.Name = "SPID"; this.SPID.Size = new Size(100, 0x15); this.SPID.TabIndex = 15; this.Cancel.Location = new Point(0x1a5, 340); this.Cancel.Name = "Cancel"; this.Cancel.Size = new Size(0x3a, 0x17); this.Cancel.TabIndex = 0x11; this.Cancel.Text = "取 消"; this.Cancel.UseVisualStyleBackColor = true; this.Cancel.Click += new EventHandler(this.Cancel_Click); this.OK.Location = new Point(340, 340); this.OK.Name = "OK"; this.OK.Size = new Size(0x3a, 0x17); this.OK.TabIndex = 0x10; this.OK.Text = "确 定"; this.OK.UseVisualStyleBackColor = true; this.OK.Click += new EventHandler(this.OK_Click); this.groupBox3.Controls.Add(this.label12); this.groupBox3.Controls.Add(this.MsgListBoxMaxRow); this.groupBox3.Location = new Point(0xfe, 0x105); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new Size(0xe4, 0x36); this.groupBox3.TabIndex = 0x12; this.groupBox3.TabStop = false; this.groupBox3.Text = "窗口"; this.label12.AutoSize = true; this.label12.Location = new Point(6, 0x17); this.label12.Name = "label12"; this.label12.Size = new Size(0x35, 12); this.label12.TabIndex = 14; this.label12.Text = "信息数量"; this.MsgListBoxMaxRow.Location = new Point(80, 20); this.MsgListBoxMaxRow.Name = "MsgListBoxMaxRow"; this.MsgListBoxMaxRow.Size = new Size(100, 0x15); this.MsgListBoxMaxRow.TabIndex = 15; this.groupBox4.Controls.Add(this.label8); this.groupBox4.Controls.Add(this.label11); this.groupBox4.Controls.Add(this.MTLimit); this.groupBox4.Location = new Point(12, 0x143); this.groupBox4.Name = "groupBox4"; this.groupBox4.Size = new Size(0xe4, 0x33); this.groupBox4.TabIndex = 0x15; this.groupBox4.TabStop = false; this.groupBox4.Text = "限速(重启生效)"; this.label8.AutoSize = true; this.label8.Location = new Point(0xbb, 0x16); this.label8.Name = "label8"; this.label8.Size = new Size(0x23, 12); this.label8.TabIndex = 0x16; this.label8.Text = "条/秒"; this.label11.AutoSize = true; this.label11.Location = new Point(6, 0x17); this.label11.Name = "label11"; this.label11.Size = new Size(0x35, 12); this.label11.TabIndex = 14; this.label11.Text = "下行限速"; this.MTLimit.Location = new Point(80, 0x13); this.MTLimit.Name = "MTLimit"; this.MTLimit.Size = new Size(100, 0x15); this.MTLimit.TabIndex = 15; this.LogDebugLevel.AutoSize = true; this.LogDebugLevel.Location = new Point(0xaf, 0x19); this.LogDebugLevel.Name = "LogDebugLevel"; this.LogDebugLevel.Size = new Size(0x2f, 0x10); this.LogDebugLevel.TabIndex = 0x16; this.LogDebugLevel.TabStop = true; this.LogDebugLevel.Text = "调试"; this.LogDebugLevel.UseVisualStyleBackColor = true; this.LogMsgLevel.AutoSize = true; this.LogMsgLevel.Location = new Point(0x7a, 0x19); this.LogMsgLevel.Name = "LogMsgLevel"; this.LogMsgLevel.Size = new Size(0x2f, 0x10); this.LogMsgLevel.TabIndex = 0x17; this.LogMsgLevel.TabStop = true; this.LogMsgLevel.Text = "信息"; this.LogMsgLevel.UseVisualStyleBackColor = true; this.LogErrLevel.AutoSize = true; this.LogErrLevel.Location = new Point(8, 0x19); this.LogErrLevel.Name = "LogErrLevel"; this.LogErrLevel.Size = new Size(0x2f, 0x10); this.LogErrLevel.TabIndex = 0x18; this.LogErrLevel.TabStop = true; this.LogErrLevel.Text = "错误"; this.LogErrLevel.UseVisualStyleBackColor = true; this.groupBox5.Controls.Add(this.LogSysLevel); this.groupBox5.Controls.Add(this.LogDebugLevel); this.groupBox5.Controls.Add(this.LogMsgLevel); this.groupBox5.Controls.Add(this.LogErrLevel); this.groupBox5.Location = new Point(0xfe, 0xc0); this.groupBox5.Name = "groupBox5"; this.groupBox5.Size = new Size(0xe4, 0x36); this.groupBox5.TabIndex = 0x19; this.groupBox5.TabStop = false; this.groupBox5.Text = "日志级别"; this.LogSysLevel.AutoSize = true; this.LogSysLevel.Location = new Point(0x41, 0x19); this.LogSysLevel.Name = "LogSysLevel"; this.LogSysLevel.Size = new Size(0x2f, 0x10); this.LogSysLevel.TabIndex = 0x1c; this.LogSysLevel.TabStop = true; this.LogSysLevel.Text = "系统"; this.LogSysLevel.UseVisualStyleBackColor = true; this.groupBox6.Controls.Add(this.label18); this.groupBox6.Controls.Add(this.label16); this.groupBox6.Controls.Add(this.label19); this.groupBox6.Controls.Add(this.label15); this.groupBox6.Controls.Add(this.label17); this.groupBox6.Controls.Add(this.label14); this.groupBox6.Controls.Add(this.ProgramID); this.groupBox6.Controls.Add(this.ActiveTestInterval); this.groupBox6.Controls.Add(this.label13); this.groupBox6.Controls.Add(this.ReSubmitInterval); this.groupBox6.Controls.Add(this.SlidingWindowSize); this.groupBox6.Location = new Point(12, 0xb8); this.groupBox6.Name = "groupBox6"; this.groupBox6.Size = new Size(0xe4, 0x85); this.groupBox6.TabIndex = 0x1a; this.groupBox6.TabStop = false; this.groupBox6.Text = "高级设置(重启生效)"; this.label18.AutoSize = true; this.label18.Location = new Point(0xba, 0x68); this.label18.Name = "label18"; this.label18.Size = new Size(0, 12); this.label18.TabIndex = 0x23; this.label16.AutoSize = true; this.label16.Location = new Point(0xba, 0x4d); this.label16.Name = "label16"; this.label16.Size = new Size(0x11, 12); this.label16.TabIndex = 0x20; this.label16.Text = "秒"; this.label19.AutoSize = true; this.label19.Location = new Point(6, 0x68); this.label19.Name = "label19"; this.label19.Size = new Size(0x35, 12); this.label19.TabIndex = 0x21; this.label19.Text = "实例编号"; this.label15.AutoSize = true; this.label15.Location = new Point(0xba, 50); this.label15.Name = "label15"; this.label15.Size = new Size(0x11, 12); this.label15.TabIndex = 0x1d; this.label15.Text = "秒"; this.label17.AutoSize = true; this.label17.Location = new Point(6, 0x4d); this.label17.Name = "label17"; this.label17.Size = new Size(0x35, 12); this.label17.TabIndex = 30; this.label17.Text = "链路测试"; this.label14.AutoSize = true; this.label14.Location = new Point(6, 50); this.label14.Name = "label14"; this.label14.Size = new Size(0x35, 12); this.label14.TabIndex = 0x1b; this.label14.Text = "重发间隔"; this.ProgramID.Location = new Point(80, 0x65); this.ProgramID.Name = "ProgramID"; this.ProgramID.ReadOnly = true; this.ProgramID.Size = new Size(100, 0x15); this.ProgramID.TabIndex = 0x22; this.ActiveTestInterval.Location = new Point(80, 0x4a); this.ActiveTestInterval.Name = "ActiveTestInterval"; this.ActiveTestInterval.Size = new Size(100, 0x15); this.ActiveTestInterval.TabIndex = 0x1f; this.label13.AutoSize = true; this.label13.Location = new Point(6, 0x17); this.label13.Name = "label13"; this.label13.Size = new Size(0x35, 12); this.label13.TabIndex = 14; this.label13.Text = "滑动窗口"; this.ReSubmitInterval.Location = new Point(80, 0x2f); this.ReSubmitInterval.Name = "ReSubmitInterval"; this.ReSubmitInterval.Size = new Size(100, 0x15); this.ReSubmitInterval.TabIndex = 0x1c; this.SlidingWindowSize.Location = new Point(80, 20); this.SlidingWindowSize.Name = "SlidingWindowSize"; this.SlidingWindowSize.Size = new Size(100, 0x15); this.SlidingWindowSize.TabIndex = 15; this.AutoConnect.AutoSize = true; this.AutoConnect.Location = new Point(0x106, 0x155); this.AutoConnect.Name = "AutoConnect"; this.AutoConnect.Size = new Size(0x48, 0x10); this.AutoConnect.TabIndex = 0x1b; this.AutoConnect.Text = "自动连接"; this.AutoConnect.UseVisualStyleBackColor = true; this.label20.AutoSize = true; this.label20.Location = new Point(6, 0x35); this.label20.Name = "label20"; this.label20.Size = new Size(0x35, 12); this.label20.TabIndex = 0x16; this.label20.Text = "数据库名"; this.InitialCatalog.Location = new Point(80, 50); this.InitialCatalog.Name = "InitialCatalog"; this.InitialCatalog.Size = new Size(100, 0x15); this.InitialCatalog.TabIndex = 0x17; base.AutoScaleDimensions = new SizeF(6f, 12f); //base.AutoScaleMode = AutoScaleMode.Font; base.ClientSize = new Size(0x1ef, 0x179); base.Controls.Add(this.AutoConnect); base.Controls.Add(this.groupBox6); base.Controls.Add(this.groupBox4); base.Controls.Add(this.groupBox3); base.Controls.Add(this.Cancel); base.Controls.Add(this.OK); base.Controls.Add(this.groupBox1); base.Controls.Add(this.groupBox2); base.Controls.Add(this.groupBox5); base.Name = "SysForm"; base.StartPosition = FormStartPosition.CenterScreen; this.Text = "设置"; this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.groupBox3.ResumeLayout(false); this.groupBox3.PerformLayout(); this.groupBox4.ResumeLayout(false); this.groupBox4.PerformLayout(); this.groupBox5.ResumeLayout(false); this.groupBox5.PerformLayout(); this.groupBox6.ResumeLayout(false); this.groupBox6.PerformLayout(); base.ResumeLayout(false); base.PerformLayout(); } private void InitializeData() { try { this.SPCODE.Text = SysConf.Instance.SpCode; this.SPID.Text = SysConf.Instance.SPID; this.PASSWD.Text = SysConf.Instance.PASSWD; this.ServerIP.Text = SysConf.Instance.ServerIP; this.ServerPort.Text = SysConf.Instance.ServerPort.ToString(); this.DBSource.Text = SysConf.Instance.DBSource; this.InitialCatalog.Text = SysConf.Instance.InitialCatalog; this.DBUserID.Text = SysConf.Instance.DBUserID; this.DBPassWD.Text = SysConf.Instance.DBPassWD; this.MsgListBoxMaxRow.Text = SysConf.Instance.MsgListBoxMaxRow.ToString(); this.MTLimit.Text = SysConf.Instance.MTLimit.ToString(); this.SlidingWindowSize.Text = SysConf.Instance.SlidingWindowSize.ToString(); this.ReSubmitInterval.Text = SysConf.Instance.ReSubmitInterval.ToString(); this.ActiveTestInterval.Text = SysConf.Instance.ActiveTestInterval.ToString(); switch (SysConf.Instance.CurrentMsgLevel) { case 0: this.LogErrLevel.Checked = true; break; case 1: this.LogSysLevel.Checked = true; break; case 2: this.LogMsgLevel.Checked = true; break; case 3: this.LogDebugLevel.Checked = true; break; } this.AutoConnect.Checked = SysConf.Instance.AutoConnection; this.ProgramID.Text = SysConf.Instance.ProgramID; } catch (Exception exception) { MessageBox.Show(exception.Message); } } private void OK_Click(object sender, EventArgs e) { try { SysConf.Instance.SpCode = this.SPCODE.Text; SysConf.Instance.SPID = this.SPID.Text; SysConf.Instance.PASSWD = this.PASSWD.Text; SysConf.Instance.ServerIP = this.ServerIP.Text; SysConf.Instance.ServerPort = Utils.StrToInt(this.ServerPort.Text, 0); SysConf.Instance.DBSource = this.DBSource.Text; SysConf.Instance.InitialCatalog = this.InitialCatalog.Text; SysConf.Instance.DBUserID = this.DBUserID.Text; SysConf.Instance.DBPassWD = this.DBPassWD.Text; SysConf.Instance.MsgListBoxMaxRow = Utils.StrToInt(this.MsgListBoxMaxRow.Text, 100); SysConf.Instance.MTLimit = Utils.StrToInt(this.MTLimit.Text, 10); SysConf.Instance.SlidingWindowSize = Utils.StrToInt(this.SlidingWindowSize.Text, 10); SysConf.Instance.ReSubmitInterval = Utils.StrToInt(this.ReSubmitInterval.Text, 30); SysConf.Instance.ActiveTestInterval = Utils.StrToInt(this.ActiveTestInterval.Text, 30); SysConf.Instance.AutoConnection = this.AutoConnect.Checked; SysConf.Instance.ProgramID = this.ProgramID.Text; if (this.LogErrLevel.Checked) { SysConf.Instance.CurrentMsgLevel = 0; } else if (this.LogSysLevel.Checked) { SysConf.Instance.CurrentMsgLevel = 1; } else if (this.LogMsgLevel.Checked) { SysConf.Instance.CurrentMsgLevel = 2; } else if (this.LogDebugLevel.Checked) { SysConf.Instance.CurrentMsgLevel = 3; } MainForm.CurrentMsgLevel = (MsgLevel) SysConf.Instance.CurrentMsgLevel; MainForm.MsgListBoxMaxRow = SysConf.Instance.MsgListBoxMaxRow; MessageBox.Show("设置成功"); base.Close(); } catch (Exception exception) { MessageBox.Show("设置错误:" + exception.Message); } } } }