Exemplo n.º 1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            bool createNew;

            oneInstanceMutex = new Mutex(false, "BgInfo_OneInstanceMutex", out createNew);
            if (!createNew)
            {
                MessageBox.Show("Am running already!", "SimpleMan Blues", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                Shutdown();
                return;
            }

            commonService = CommonService.GetInstance();

            mainWindow = new Blues.MainWindow();
            commonService.CurrentMainWindow = mainWindow;
            infoWindow = new InfoWindow();
            commonService.CurrentInfoWindow = infoWindow;

            backgroundManager = BackgroundManager.GetInstance();
            backgroundManager.InitTray();
            backgroundManager.StartUnlockTimer();

            mainWindow.Show();

            var sysAction = new SystemAction {
                OrderNo = 1, CurrentAction = ActionType.StartUp, ActionTime = DateTime.Now
            };

            commonService.InfoViewModel.SystemActions.Add(sysAction);
            backgroundManager.SaveSystemAction(sysAction);

            Microsoft.Win32.SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;
        }
Exemplo n.º 2
0
 public TrayViewModel()
 {
     ExitCommand = new DelegateCommand(() => Application.Current.Shutdown());
     InfoCommand = new DelegateCommand(() => BackgroundManager.GetInstance().ShowInfo());
 }