Пример #1
0
 public StoreAppsPicker(PersistentSettings.StartObjects.StartObjectsManager startObjectsManager)
 {
     _appsManager = new PersistentSettings.StoreAppsManager(startObjectsManager.GetAllStartObjects().Where(s => s is PersistentSettings.StartObjects.StartApplication).Select(s => s.Location));
     InitializeComponent();
 }
Пример #2
0
        public ShutdownTimer(int secondsToShutdown, Controls.ProgressBarWithText progressBar, App app, ShutdownTimerPicker.ShutdownTimerAction action, PersistentSettings.StartObjects.StartObjectsManager startObjects)
        {
            AutoShutdownCancelled = false;
            timerSecondsRemaining = secondsToShutdown;
            _progresBar           = progressBar;
            _app = app;
            _progresBar.Bar.Maximum = secondsToShutdown;
            _progresBar.Bar.Value   = secondsToShutdown;
            switch (action)
            {
            case ShutdownTimerPicker.ShutdownTimerAction.Quit:
                shutdownAction = () => _app.Shutdown();
                break;

            case ShutdownTimerPicker.ShutdownTimerAction.LaunchAndQuit:
                shutdownAction = () => { startObjects.LaunchAllInCurrentProfile().Wait(); _app.Shutdown(); };
                break;

            default:
                break;
            }
            _timer = new System.Windows.Threading.DispatcherTimer
            {
                Interval = System.TimeSpan.FromSeconds(1)
            };
            _timer.Tick += Timer_Tick;
            _timer.Start();
        }