private void hideToolStripMenuItem_Click(object sender, EventArgs e) { HideableProcess currentProc = lstBox_Process.SelectedItem as HideableProcess; if (currentProc != null) { currentProc.Hide(); } }
private void killToolStripMenuItem_Click(object sender, EventArgs e) { HideableProcess currentProc = lstBox_Process.SelectedItem as HideableProcess; if (currentProc != null) { currentProc.Kill(); lstBox_Process.Items.Remove(currentProc); lstBox_Process.SelectedIndex = -1; } }
private async void newToolStripMenuItem_Click(object sender, EventArgs e) { if (ofdSelect.ShowDialog() == DialogResult.OK) { HideableProcess hidProcess = new HideableProcess(); hidProcess.StartInfo.FileName = ofdSelect.FileName; await hidProcess.Start(); m_lstProcess.Add(hidProcess); lstBox_Process.Items.Add(hidProcess); } }
private void updateToolStripMenuItem_Click(object sender, EventArgs e) { for (int i = lstBox_Process.Items.Count - 1; i >= 0; i--) { HideableProcess currentProc = lstBox_Process.Items[i] as HideableProcess; if (currentProc == null) { continue; } if (currentProc.HasExited) { lstBox_Process.Items.Remove(currentProc); } } }
private void lstBox_Process_SelectedIndexChanged(object sender, EventArgs e) { if (lstBox_Process.SelectedIndex >= 0) { HideableProcess currentProc = lstBox_Process.SelectedItem as HideableProcess; if (currentProc == null) { lstBox_Process.SelectedIndex = -1; return; } showToolStripMenuItem.Visible = hideToolStripMenuItem.Visible = togleToolStripMenuItem.Visible = currentProc.IsHideable; selectedToolStripMenuItem.Visible = true; } else { selectedToolStripMenuItem.Visible = false; } }