Example #1
0
        public MainViewModel(Settings settings)
        {
            _saved = false;
            _queryTextBeforeLeaveResults = "";
            _queryText = "";
            _lastQuery = new Query();

            _settings = settings;

            _historyItemsStorage       = new JsonStrorage <History>();
            _userSelectedRecordStorage = new JsonStrorage <UserSelectedRecord>();
            _topMostRecordStorage      = new JsonStrorage <TopMostRecord>();
            _history            = _historyItemsStorage.Load();
            _userSelectedRecord = _userSelectedRecordStorage.Load();
            _topMostRecord      = _topMostRecordStorage.Load();

            ContextMenu      = new ResultsViewModel(_settings);
            Results          = new ResultsViewModel(_settings);
            History          = new ResultsViewModel(_settings);
            _selectedResults = Results;

            InitializeKeyCommands();
            RegisterResultsUpdatedEvent();

            SetHotkey(_settings.Hotkey, OnHotkey);
            SetCustomPluginHotkey();
        }
Example #2
0
        public MainViewModel(Settings settings)
        {
            _saved = false;
            _queryTextBeforeLoadContextMenu = "";
            _queryText = "";
            _lastQuery = new Query();

            _settings = settings;

            // happlebao todo temp fix for instance code logic
            HttpProxy.Instance.Settings = _settings;
            InternationalizationManager.Instance.Settings = _settings;
            InternationalizationManager.Instance.ChangeLanguage(_settings.Language);
            ThemeManager.Instance.Settings = _settings;

            _queryHistoryStorage       = new JsonStrorage <QueryHistory>();
            _userSelectedRecordStorage = new JsonStrorage <UserSelectedRecord>();
            _topMostRecordStorage      = new JsonStrorage <TopMostRecord>();
            _queryHistory       = _queryHistoryStorage.Load();
            _userSelectedRecord = _userSelectedRecordStorage.Load();
            _topMostRecord      = _topMostRecordStorage.Load();

            InitializeResultListBox();
            InitializeContextMenu();
            InitializeKeyCommands();
            RegisterResultsUpdatedEvent();

            SetHotkey(_settings.Hotkey, OnHotkey);
            SetCustomPluginHotkey();
        }
Example #3
0
        public MainViewModel(Settings settings)
        {
            _saved = false;
            _queryTextBeforeLoadContextMenu = "";
            _queryText = "";
            _lastQuery = new Query();

            _settings = settings;

            // happlebao todo temp fix for instance code logic
            HttpProxy.Instance.Settings = _settings;
            InternationalizationManager.Instance.Settings = _settings;
            InternationalizationManager.Instance.ChangeLanguage(_settings.Language);
            ThemeManager.Instance.Settings = _settings;

            _queryHistoryStorage = new JsonStrorage<QueryHistory>();
            _userSelectedRecordStorage = new JsonStrorage<UserSelectedRecord>();
            _topMostRecordStorage = new JsonStrorage<TopMostRecord>();
            _queryHistory = _queryHistoryStorage.Load();
            _userSelectedRecord = _userSelectedRecordStorage.Load();
            _topMostRecord = _topMostRecordStorage.Load();

            InitializeResultListBox();
            InitializeContextMenu();
            InitializeKeyCommands();
            RegisterResultsUpdatedEvent();

            SetHotkey(_settings.Hotkey, OnHotkey);
            SetCustomPluginHotkey();
        }
Example #4
0
        private void OnStartup(object sender, StartupEventArgs e)
        {
            Stopwatch.Debug("Startup Time", () =>
            {
                RegisterDispatcherUnhandledException();

                ImageLoader.PreloadImages();

                var storage = new JsonStrorage <Settings>();
                _settings   = storage.Load();

                PluginManager.LoadPlugins(_settings.PluginSettings);
                var vm     = new MainViewModel(_settings, storage);
                var window = new MainWindow(_settings, vm);
                API        = new PublicAPIInstance(_settings, vm);
                PluginManager.InitializePlugins(API);

                Current.MainWindow       = window;
                Current.MainWindow.Title = Infrastructure.Constant.Wox;

                RegisterExitEvents();

                AutoStartup();
                AutoUpdates();

                window.Show();
            });
        }
Example #5
0
        public MainViewModel()
        {
            _queryTextBeforeLoadContextMenu = "";
            _queryText = "";
            _lastQuery = new Query();

            _settingsStorage = new JsonStrorage <Settings>();
            _settings        = _settingsStorage.Load();

            // happlebao todo temp fix for instance code logic
            HttpProxy.Instance.Settings      = _settings;
            UpdaterManager.Instance.Settings = _settings;
            InternationalizationManager.Instance.Settings = _settings;
            ThemeManager.Instance.Settings = _settings;

            _queryHistoryStorage       = new JsonStrorage <QueryHistory>();
            _userSelectedRecordStorage = new JsonStrorage <UserSelectedRecord>();
            _topMostRecordStorage      = new JsonStrorage <TopMostRecord>();
            _queryHistory       = _queryHistoryStorage.Load();
            _userSelectedRecord = _userSelectedRecordStorage.Load();
            _topMostRecord      = _topMostRecordStorage.Load();

            InitializeResultListBox();
            InitializeContextMenu();
            InitializeKeyCommands();
        }
Example #6
0
        public MainViewModel(Settings settings)
        {
            _saved = false;
            _queryTextBeforeLeaveResults = "";
            _queryText = "";
            _lastQuery = new Query();

            _settings = settings;

            _historyItemsStorage = new JsonStrorage<History>();
            _userSelectedRecordStorage = new JsonStrorage<UserSelectedRecord>();
            _topMostRecordStorage = new JsonStrorage<TopMostRecord>();
            _history = _historyItemsStorage.Load();
            _userSelectedRecord = _userSelectedRecordStorage.Load();
            _topMostRecord = _topMostRecordStorage.Load();

            ContextMenu = new ResultsViewModel(_settings);
            Results = new ResultsViewModel(_settings);
            History = new ResultsViewModel(_settings);
            _selectedResults = Results;

            InitializeKeyCommands();
            RegisterResultsUpdatedEvent();

            SetHotkey(_settings.Hotkey, OnHotkey);
            SetCustomPluginHotkey();
        }
Example #7
0
 public SettingWindowViewModel()
 {
     _storage = new JsonStrorage <Settings>();
     Settings = _storage.Load();
     Settings.PropertyChanged += (s, e) =>
     {
         if (e.PropertyName == nameof(Settings.ActivateTimes))
         {
             OnPropertyChanged(nameof(ActivatedTimes));
         }
     };
 }
Example #8
0
        public SettingWindowViewModel()
        {
            _storage = new JsonStrorage<Settings>();
            Settings = _storage.Load();
            Settings.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == nameof(Settings.ActivateTimes))
                {
                    OnPropertyChanged(nameof(ActivatedTimes));
                }
            };

            // happlebao todo temp fix for instance code logic
            InternationalizationManager.Instance.Settings = Settings;
            InternationalizationManager.Instance.ChangeLanguage(Settings.Language);
            ThemeManager.Instance.Settings = Settings;
            Http.Proxy = Settings.Proxy;
        }
Example #9
0
        public SettingWindowViewModel()
        {
            _storage = new JsonStrorage <Settings>();
            Settings = _storage.Load();
            Settings.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == nameof(Settings.ActivateTimes))
                {
                    OnPropertyChanged(nameof(ActivatedTimes));
                }
            };

            // happlebao todo temp fix for instance code logic
            InternationalizationManager.Instance.Settings = Settings;
            InternationalizationManager.Instance.ChangeLanguage(Settings.Language);
            ThemeManager.Instance.Settings = Settings;
            Http.Proxy = Settings.Proxy;
        }
Example #10
0
 public SettingsViewModel()
 {
     _storage = new PluginJsonStorage<Settings>();
     Settings = _storage.Load();
 }
Example #11
0
 public SettingWindowViewModel()
 {
     _storage = new JsonStrorage <Settings>();
     Settings = _storage.Load();
 }
Example #12
0
 public SettingsViewModel()
 {
     _storage = new PluginJsonStorage <Settings>();
     Settings = _storage.Load();
 }