using System; using System.Collections.Generic; using System.ComponentModel; using System.Configuration; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Microsoft.VisualBasic; namespace wcfControlMonitorClient { /// /// Creator:Richard.liu /// 黑匣子维护 /// public partial class FrmDarkCasket : Form { private static FrmDarkCasket _formInstance; public static FrmDarkCasket FormInstance { get { if (_formInstance == null) { _formInstance = new FrmDarkCasket(); } return _formInstance; } set { _formInstance = value; } } public FrmDarkCasket() { InitializeComponent(); _formInstance = this; } private void button1_Click(object sender, EventArgs e) { try { int a = 0; if (int.TryParse(this.tbDarkCasketDays.Text.Trim(),out a) == false) { MessageBox.Show("黑匣子文件的保留个数必须是数字!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Error); this.tbDarkCasketDays.Focus(); return; } if (int.TryParse(this.tbDarkCasketSize.Text.Trim(),out a) == false) { MessageBox.Show("黑匣子文件大小的最大值必须是数字!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Error); this.tbDarkCasketSize.Focus(); return; } double ssize; ssize = 1048576 * Convert.ToDouble( this.tbDarkCasketSize.Text); CommonClassLib.AppSettings.SetValue("DarkCasketSize", ssize.ToString()); CommonClassLib.AppSettings.SetValue("DarkCasketSum", this.tbDarkCasketDays.Text); MessageBox.Show("保存成功!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.Close(); } catch (Exception ex) { throw ex; } } private void FrmDarkCasket_Load(object sender, EventArgs e) { //20100521 this.tbDarkCasketDays.Text=CommonClassLib.AppSettings.GetValue("DarkCasketSum"); this.tbDarkCasketSize.Text = Convert.ToString(Convert.ToDouble( CommonClassLib.AppSettings.GetValue("DarkCasketSize")) / 1048576); } private void FrmDarkCasket_FormClosing(object sender, FormClosingEventArgs e) { _formInstance = null; } } }