private void ApplicationGrid_StartClick(object sender, RoutedEventArgs e) { MonitoredApp monitoredApp = ((FrameworkElement)sender).DataContext as MonitoredApp; StartApplication(monitoredApp); if (!AppMonitor.IsEnabled) { AppMonitor.Start(); } }
public AppTrayIconContext() { //Initialize Objects AppSettings = new SettingsManager.Settings(); // Check if Runs Hidden if (!AppSettings.RunHidden) { //Build Menu ContextMenu mnu = new ContextMenu(); mnu.MenuItems.Add(new MenuItem(ResFiles.GlobalRes.traymenu_Activity, OpenStats)); if (!AppSettings.LockSettings) { mnu.MenuItems.Add(new MenuItem(ResFiles.GlobalRes.traymenu_Settings, OpenSettings)); } if (!AppSettings.HideMenuExit) { mnu.MenuItems.Add(new MenuItem(ResFiles.GlobalRes.traymenu_Exit, Exit)); } mnu.MenuItems.Add(new MenuItem(ResFiles.GlobalRes.traymenu_About, About)); trayIcon = new NotifyIcon() { Icon = Resources.ClockIcon, ContextMenu = mnu, Visible = true }; trayIcon.DoubleClick += new System.EventHandler(OpenStats); AppDomain.CurrentDomain.ProcessExit += new System.EventHandler(Exit); } usrSession = new UserSession(); appMon = new AppMonitor(); Database = new DB(); DBDumper = new DataDumper(appMon, Database, AppSettings.DBDumprate); appMon.Start(); //TODO: Start DB dumper anyway if (setDBConfig()) { DBDumper.Start(); } }