예제 #1
0
 public MainWindow(Settings settings, MainViewModel mainVM)
 {
     InitializeComponent();
     DataContext = mainVM;
     _viewModel = mainVM;
     _settings = settings;
 }
예제 #2
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();
        }
예제 #3
0
 public SettingWindow(IPublicAPI api, SettingWindowViewModel viewModel)
 {
     InitializeComponent();
     _settings = viewModel.Settings;
     DataContext = viewModel;
     _viewModel = viewModel;
     _api = api;
 }
예제 #4
0
 public ActionKeywords(string pluginId, Settings settings)
 {
     InitializeComponent();
     _plugin = PluginManager.GetPluginForId(pluginId);
     _settings = settings;
     if (_plugin == null)
     {
         MessageBox.Show(_translater.GetTranslation("cannotFindSpecifiedPlugin"));
         Close();
     }
 }
예제 #5
0
파일: App.xaml.cs 프로젝트: cxfksword/Wox
        private void OnStartup(object sender, StartupEventArgs e)
        {
            Stopwatch.Normal("Startup Time", () =>
            {
                RegisterDispatcherUnhandledException();

                var settingVM = new SettingWindowViewModel();
                _settings = settingVM.Settings;

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

                ImageLoader.PreloadImages();

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

                RegisterExitEvents();

                AutoStartup();
                AutoUpdates();

                if (!_settings.HideOnStartup)
                {
                    mainVM.MainWindowVisibility = Visibility.Visible;
                }
            });
        }
 public CustomQueryHotkeySetting(SettingWindow settingWidow, Settings settings)
 {
     _settingWidow = settingWidow;
     InitializeComponent();
     _settings = settings;
 }