private void GlobalHotkeyListener_Load(object sender, EventArgs e) {//Checks if warframe is running, if not, adds watchers try { trayIcon = new SystemTrayIcon(this); trayIcon.Initialize(); processDetector = new ProcessDetector(new string[] { "Notepad", "Notepad.x64" }, WarframeIsRunning); processDetector.Start(); } catch (SystemTrayIconException a) { string temp = a.Message; if (a.InnerException != null) { temp += "\nInner Message: " + a.InnerException.Message; } MessageBox.Show(this, temp, "System Tray Icon Error"); this.Close(); } catch (ProcessDetectorException a) { string temp = a.Message; if (a.InnerException != null) { temp += "\nInner Message: " + a.InnerException.Message; } MessageBox.Show(this, temp, "Process Detector Error"); this.Close(); } }
public GlobalHotkeyListener() { InitializeComponent(); this.WindowState = FormWindowState.Minimized; this.Hide(); //Makes it not show up on taskbar this.TopLevel = false; //Makes it not show up under Apps in Task Manager trayIcon = null; //Shows the system tray icon processDetector = null; queryHandler = null; warframeProcess = null; mainTrigger = null; }