private void gdInfo_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { if (e.KeyCode == Keys.Delete) { if (gdInfo.Selection.IsEmpty()) { return; } RangeRegion range = gdInfo.Selection.GetSelectionRegion(); foreach (var r in range) { for (int i = r.End.Row; i >= r.Start.Row; i--) { if (gdInfo[i, 0].Tag == null) { continue; } InfoNotifyInfo info = (InfoNotifyInfo)gdInfo[i, 0].Tag; InfoNotifies[info.Server].Remove(info); Util.Monitors[info.Server].RemoveInfoNotify(info); for (int col = 0; col < 3; col++) { gdInfo[i, col].UnBindToGrid(); } gdInfo.Rows.Remove(i); } } } }
private void _AddRow(InfoNotifyInfo info) { gdInfo.Redim(gdInfo.RowsCount + 1, gdInfo.ColumnsCount); gdInfo[gdInfo.RowsCount - 1, 0] = info.cServer.Field; gdInfo[gdInfo.RowsCount - 1, 1] = info.cChannel.Field; gdInfo[gdInfo.RowsCount - 1, 2] = info.cItem.Field; gdInfo.AutoSizeCells(); }
private void btnAdd1_Click(object sender, EventArgs e) { ServerInfo server = Util.Servers.Values.First(entry => entry.Name == cboServer2.Text); InfoNotifyInfo info = InfoNotifyInfo.Create(server, txtChannel2.Text, txtItem2.Text, cboStyle2.Text); if (info == null) { return; } _AddInfoNotify(info); }
private void _InitInfoNotifies() { var infos = Util.INI["SETTING"]["INFONOTIFY"].Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); foreach (var item in infos) { var info = item.Split('|'); var inn = InfoNotifyInfo.Create(info); if (inn == null) { continue; } _AddInfoNotify(inn); } }
private void _AddInfoNotify(InfoNotifyInfo info) { if (!m_InfoNotifies.ContainsKey(info.Server)) { m_InfoNotifies.Add(info.Server, new List <InfoNotifyInfo>()); m_InfoNotifies[info.Server].Add(info); } else { m_InfoNotifies[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(); } }