public void Initialize()
        {
            _runOnStartup = new RunOnStartup();

            _mainViewModel = new MainViewModel();
            _mainViewModel.SplashScreenComplete += SplashScreenComplete;
            WindowManager.Instance.ShowWindow(_mainViewModel);

            _hotkeyManager = new HotkeyManager(_mainViewModel.View);
            try
            {
                _hotkeyManager.Register(new Hotkey(ModifierKeys.Windows, Key.G));
            }
            catch (Win32Exception)
            {
                // hotkey already registered by another program
            }
            _hotkeyManager.HotkeyPressed += (sender, args) => DisplaySplashScreen();

            _tray = new Tray();
            _tray.RunAtStartup = _runOnStartup.GetRunStartup();

            _tray.ChangeRunAtStartup += ChangeRunAtStartup;
            _tray.ExitApplication += ExitApplication;
            _tray.DisplayAboutDialog += DisplayAboutDialog;
            _tray.DisplaySplashScreen += (sender, args) => DisplaySplashScreen();
            _tray.Show();
        }
Пример #2
0
            public HotkeyServiceHelper(Window window)
            {
                _window = window;
                _window.Closed += OnWindowClosed;

                _manager = new HotkeyManager(window);
                _manager.HotkeyPressed += new HotkeyEventHandler(OnHotkeyPressed);

            }