public void SetNginxMonitorUrl(NginxMonitorUrl pro) { this.pro = pro; stb_url.Text = pro.url; stb_host.Text = pro.host; cb_check.Checked = pro.check; }
private void visit2ToolStripMenuItem_Click(object sender, EventArgs e) { if (projects.SelectedItems.Count > 0) { try { ListViewItem item = projects.SelectedItems[0]; NginxMonitorUrl pro = (NginxMonitorUrl)item.Tag; Process.Start(pro.host); } catch { } } }
public void SetListItemStatus(ListViewItem item, int status) { this.BeginInvoke((MethodInvoker) delegate() { NginxMonitorUrl pro = (NginxMonitorUrl)item.Tag; if (status == 1) { pro.RunStatus = RunState.Normal; item.ImageIndex = 1; } else if (status == 2) { pro.RunStatus = RunState.AbNormal; item.ImageIndex = 2; } }); }
private void editToolStripMenuItem_Click(object sender, EventArgs e) { if (projects.SelectedItems.Count > 0) { try { ListViewItem item = projects.SelectedItems[0]; NginxMonitorUrl pro = (NginxMonitorUrl)item.Tag; NginxMappingItemForm form = new NginxMappingItemForm(seConfig, itemConfig); form.SetNginxMonitorUrl(pro); form.ShowDialog(this); ReflushMonitorUrl(); } catch { } } }
public void StartCheckItems() { ThreadPool.QueueUserWorkItem((a) => { this.BeginInvoke((MethodInvoker) delegate() { NginxMonitorUrl pro = null; foreach (ListViewItem item in projects.Items) { pro = (NginxMonitorUrl)item.Tag; if (pro.check) { CheckItem(pro.url, item); } } }); }); }
private void button1_Click(object sender, EventArgs e) { bool isnew = false; if (this.pro == null) { pro = new NginxMonitorUrl(); pro.RunStatus = RunState.NoCheck; isnew = true; } pro.url = stb_url.Text; pro.host = stb_host.Text; pro.check = cb_check.Checked; if (isnew) { itemConfig.nginx.MonitorList.Add(pro); } this.Close(); }