public void updateContextMenu(L2Watcher watcher) { this.Invoke(new Action(() => { contextProcessSelector.Items.Clear(); })); if (watcher.processes.Count > 0) { foreach (Process process in watcher.processes.Values) { this.Invoke(new Action(() => { ToolStripItem item = contextProcessSelector.Items.Add(process.StartTime.ToLongTimeString(), PrettyClick.Properties.Resources.Lineage_II, new EventHandler(onContextClicked)); item.Tag = process.Id; })); } } else { this.Invoke(new Action(() => { ToolStripItem item = contextProcessSelector.Items.Add("Запущенных процессов не найдено"); item.Enabled = false; })); } }
private void NewForm_Load(object sender, EventArgs e) { watcher = new L2Watcher("L2.bin"); watcher.Add += watcher_Add; watcher.Remove += watcher_Remove; }
private void Form2_Load(object sender, EventArgs e) { watcher = new L2Watcher("L2.bin"); this.processControl1.watcher = watcher; }