Exemplo n.º 1
0
        private void ApplicationStartup(object sender, StartupEventArgs e)
        {
            Log.Information("Started Catapult.");

            if (!Directory.Exists(CatapultPaths.DataPath))
            {
                Directory.CreateDirectory(CatapultPaths.DataPath);
            }

            var loader = new JsonConfigLoader();

            var configuration = loader.LoadUserConfig(CatapultPaths.ConfigPath);

            loader.SaveUserConfig(configuration, CatapultPaths.ConfigPath);

            Task.Factory.StartNew(() =>
            {
                SearchResources.SetConfig(configuration);
                SearchResources.GetFiles();
            });

            _taskbarIcon = (TaskbarIcon)FindResource("MyNotifyIcon");
            InitializeTaskBarIcon(_taskbarIcon);

            _hotKeyManager = new HotKeyManager();

            RegisterHotKey(Key.Space, configuration.UseControlKey ? ModifierKeys.Control : ModifierKeys.Alt);

            _mainWindow = new MainWindow();

            _mainWindow.IsVisibleChanged += _mainWindow_IsVisibleChanged;

            if (Program.UseSingleLaunchMode)
            {
                ToggleMainWindow();
            }

            SquirrelIntegration.Instance.StartPeriodicUpdateCheck();
        }