コード例 #1
0
        private void ApplicationGrid_StartClick(object sender, RoutedEventArgs e)
        {
            MonitoredApp monitoredApp = ((FrameworkElement)sender).DataContext as MonitoredApp;

            StartApplication(monitoredApp);

            if (!AppMonitor.IsEnabled)
            {
                AppMonitor.Start();
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: seddik/ActivityMonitor
        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();
            }
        }