private void btnSave_Click(object sender, EventArgs e) { string pwd = this.txtNewPwd.Text.Trim(); if (pwd.Length < 6) { this.lbHint.Text = "密码长度不能小于6位!"; this.lbHint.Visible = true; this.txtRepeatPwd.Text = this.txtNewPwd.Text = string.Empty; this.txtNewPwd.Focus(); return; } if (pwd != this.txtRepeatPwd.Text.Trim()) { this.lbHint.Text = "两次输入的密码不一致!"; this.lbHint.Visible = true; this.txtRepeatPwd.Text = this.txtNewPwd.Text = string.Empty; this.txtNewPwd.Focus(); } else { STWebContainerSetting set = StaticCacheManager.GetConfig <STWebContainerSetting>(); set.Pwd = pwd; StaticCacheManager.SaveConfig(set); this.Close(); } }
private void SettingForm_Load(object sender, EventArgs e) { STWebContainerSetting set = StaticCacheManager.GetConfig <STWebContainerSetting>(); this.txtUrl.Text = set.Url; DateTime now = System.DateTime.Now; DateTime dt = new DateTime(now.Year, now.Month, now.Day, set.Hour, set.Minute, 0); this.dateTimePicker1.Value = dt; this.cbIsTimer.Checked = set.IsTimer; this.cbShowToolBar.Checked = set.IsShowToolBar; }
private void btnSave_Click(object sender, EventArgs e) { STWebContainerSetting set = StaticCacheManager.GetConfig <STWebContainerSetting>(); set.Url = this.txtUrl.Text; StaticCacheManager.SaveConfig(set); set.Hour = this.dateTimePicker1.Value.Hour; set.Minute = this.dateTimePicker1.Value.Minute; set.IsTimer = this.cbIsTimer.Checked; set.IsShowToolBar = this.cbShowToolBar.Checked; MessageBox.Show("保存成功!"); this.Close(); }
private void btnIn_Click(object sender, EventArgs e) { STWebContainerSetting set = StaticCacheManager.GetConfig <STWebContainerSetting>(); if (set.Pwd == this.txtPwd.Text.Trim()) { this.txtPwd.Visible = false; this.Close(); Form frm = new SettingForm(); frm.ShowDialog(); } else { this.label2.Visible = true; this.txtPwd.Text = string.Empty; } }
private void timer1_Tick(object sender, EventArgs e) { STWebContainerSetting set = StaticCacheManager.GetConfig <STWebContainerSetting>(); DateTime now = System.DateTime.Now; if (now.Hour == set.Hour && now.Minute >= set.Minute) { this.timer1.Enabled = false; this.timer1.Stop(); try { //启动本地程序并执行命令 Process.Start("Shutdown.exe", " -s -t 0"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void Form1_Load(object sender, EventArgs e) { this.WindowState = FormWindowState.Maximized; STWebContainerSetting set = StaticCacheManager.GetConfig <STWebContainerSetting>(); if (set.Url.Length > 0) { this.webBrowser.Navigate(set.Url); } this.splitContainer2.Visible = set.IsShowToolBar; if (!set.IsShowToolBar) { //this.splitContainer1.Panel2.Height = 0; this.splitContainer1.FixedPanel = FixedPanel.None; this.splitContainer1.SplitterDistance = this.Height; // this.splitContainer1.Panel1. } if (set.IsTimer) { this.timer1.Start(); } }
private void btnHome_Click(object sender, EventArgs e) { STWebContainerSetting set = StaticCacheManager.GetConfig <STWebContainerSetting>(); this.webBrowser.Navigate(set.Url); }