Beispiel #1
0
        private void bServiced_Click(object sender, EventArgs e)
        {
            var item = SerivceMonitorHelper.Instance.MonitorList[this.dGVItem.SelectedRows[0].Index];

            item.LastServiceTime = DateTime.Now;
            SerivceMonitorHelper.Save();
        }
Beispiel #2
0
        private void bDelete_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("是否删除该监控项目!!!", "警告", MessageBoxButtons.YesNo) != DialogResult.Yes)
            {
                return;
            }

            var item = SerivceMonitorHelper.Instance.MonitorList[this.dGVItem.SelectedRows[0].Index];

            SerivceMonitorHelper.Instance.MonitorList.Remove(item);
            this.dGVItem.Rows.RemoveAt(this.dGVItem.SelectedRows[0].Index);
            SerivceMonitorHelper.Save();
            this.bUpdate.Enabled = false;
        }
Beispiel #3
0
        private void bUpdate_Click(object sender, EventArgs e)
        {
            if (this.tItemName.Text == string.Empty)
            {
                MessageBox.Show("监控名称不能为空!!");
                return;
            }

            ServiceItem item = null;

            if (IsAdd)
            {
                item = new ServiceItem();
                item.LastServiceTime = DateTime.Now;
            }
            else
            {
                item = SerivceMonitorHelper.Instance.MonitorList[this.dGVItem.SelectedRows[0].Index];
            }

            item.ItemName = this.tItemName.Text;
            item.Span     = new TimeSpan(int.Parse(this.lMonitorValue.Text), 0, 0);
            item.Enable   = this.cbEnable.Checked;

            if (IsAdd)
            {
                SerivceMonitorHelper.Instance.MonitorList.Add(item);
                this.AddRow(item);
            }
            else
            {
                SerivceMonitorHelper.Instance.MonitorList[this.dGVItem.SelectedRows[0].Index] = item;
                UpdateRow(this.dGVItem.SelectedRows[0].Index, item);
            }

            SerivceMonitorHelper.Save();
            this.bUpdate.Enabled = false;
        }