示例#1
0
        private void tsDelete_Click(object sender, EventArgs e)
        {
            if (gdStop.Selection.IsEmpty())
            {
                return;
            }
            RangeRegion range = gdStop.Selection.GetSelectionRegion();

            foreach (var r in range)
            {
                for (int i = r.End.Row; i >= r.Start.Row; i--)
                {
                    if (gdStop[i, 0].Tag == null)
                    {
                        continue;
                    }
                    StopNotifyInfo info = (StopNotifyInfo)gdStop[i, 0].Tag;
                    StopNotifies[info.Server].Remove(info);
                    Util.Monitors[info.Server].RemoveStopNotify(info);
                    for (int col = 0; col < 4; col++)
                    {
                        gdStop[i, col].UnBindToGrid();
                    }
                    gdStop.Rows.Remove(i);
                }
            }
            tsDelete.Enabled = !gdStop.Selection.IsEmpty();
        }
示例#2
0
 private void _AddRow(StopNotifyInfo info)
 {
     gdStop.Redim(gdStop.RowsCount + 1, gdStop.ColumnsCount);
     gdStop[gdStop.RowsCount - 1, 0] = info.cServer.Field;
     gdStop[gdStop.RowsCount - 1, 1] = info.cChannel.Field;
     gdStop[gdStop.RowsCount - 1, 2] = info.cItem.Field;
     gdStop[gdStop.RowsCount - 1, 3] = info.cInterval.Field;
     gdStop.AutoSizeCells();
 }
示例#3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            ServerInfo     server = Util.Servers.Values.First(entry => entry.Name == cboServer.Text);
            StopNotifyInfo ainfo  = StopNotifyInfo.Create(server, txtChannel.Text, txtItem.Text, txtSeconds.Text);

            if (ainfo == null)
            {
                return;
            }
            _AddStopNotify(ainfo);
        }
示例#4
0
        private void _InitStopNotifies()
        {
            var stops = Util.INI["SETTING"]["STOPNOTIFY"].Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var item in stops)
            {
                var info = item.Split('|');

                var sn = StopNotifyInfo.Create(info);
                if (sn == null)
                {
                    continue;
                }
                _AddStopNotify(sn);
            }
        }
示例#5
0
        private void _AddStopNotify(StopNotifyInfo info)
        {
            if (!m_StopNotifies.ContainsKey(info.Server))
            {
                m_StopNotifies.Add(info.Server, new List <StopNotifyInfo>());
                m_StopNotifies[info.Server].Add(info);
            }
            else
            {
                m_StopNotifies[info.Server].Add(info);
            }
            _AddRow(info);

            if (!Util.Monitors.ContainsKey(info.Server))
            {
                var server = Monitor.Create(info.Server);
                if (server == null)
                {
                    return;
                }
                Util.Monitors.Add(info.Server, server);
                Util.Monitors[info.Server].MonitorStart();
            }
        }