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(); }); }
protected override void OnStartup(StartupEventArgs e) { Stopwatch.Debug("Startup Time", () => { base.OnStartup(e); RegisterUnhandledException(); ThreadPool.QueueUserWorkItem(o => { ImageLoader.ImageLoader.PreloadImages(); }); Window = new MainWindow(); PluginManager.Init(Window); CommandArgsFactory.Execute(e.Args.ToList()); }); }
protected override void OnStartup(StartupEventArgs e) { Stopwatch.Debug("Startup Time", () => { base.OnStartup(e); RegisterUnhandledException(); Task.Factory.StartNew(ImageLoader.PreloadImages); MainViewModel mainVM = new MainViewModel(); API = new PublicAPIInstance(mainVM, mainVM._settings); PluginManager.InitializePlugins(API); mainVM._settings.UpdatePluginSettings(); Window = new MainWindow(mainVM._settings, mainVM); NotifyIconManager notifyIconManager = new NotifyIconManager(API); CommandArgsFactory.Execute(e.Args.ToList()); }); }
private void OnThemeTabSelected() { Stopwatch.Debug("theme load", () => { var s = Fonts.SystemFontFamilies; }); if (themeTabLoaded) { return; } themeTabLoaded = true; if (!string.IsNullOrEmpty(_settings.QueryBoxFont) && Fonts.SystemFontFamilies.Count(o => o.FamilyNames.Values.Contains(_settings.QueryBoxFont)) > 0) { cbQueryBoxFont.Text = _settings.QueryBoxFont; cbQueryBoxFontFaces.SelectedItem = SyntaxSugars.CallOrRescueDefault( () => ((FontFamily)cbQueryBoxFont.SelectedItem).ConvertFromInvariantStringsOrNormal( _settings.QueryBoxFontStyle, _settings.QueryBoxFontWeight, _settings.QueryBoxFontStretch )); } if (!string.IsNullOrEmpty(_settings.ResultFont) && Fonts.SystemFontFamilies.Count(o => o.FamilyNames.Values.Contains(_settings.ResultFont)) > 0) { ResultFontComboBox.Text = _settings.ResultFont; ResultFontFacesComboBox.SelectedItem = SyntaxSugars.CallOrRescueDefault( () => ((FontFamily)ResultFontComboBox.SelectedItem).ConvertFromInvariantStringsOrNormal( _settings.ResultFontStyle, _settings.ResultFontWeight, _settings.ResultFontStretch )); } ResultListBoxPreview.AddResults(new List <Result> { new Result { Title = "Wox is an effective launcher for windows", SubTitle = "Wox provide bundles of features let you access infomations quickly.", IcoPath = "Images/app.png", PluginDirectory = Path.GetDirectoryName(Infrastructure.Constant.ProgramDirectory) }, new Result { Title = "Search applications", SubTitle = "Search applications, files (via everything plugin) and browser bookmarks", IcoPath = "Images/app.png", PluginDirectory = Path.GetDirectoryName(Infrastructure.Constant.ProgramDirectory) }, new Result { Title = "Search web contents with shortcuts", SubTitle = "e.g. search google with g keyword or youtube keyword)", IcoPath = "Images/app.png", PluginDirectory = Path.GetDirectoryName(Infrastructure.Constant.ProgramDirectory) }, new Result { Title = "clipboard history ", IcoPath = "Images/app.png", PluginDirectory = Path.GetDirectoryName(Infrastructure.Constant.ProgramDirectory) }, new Result { Title = "Themes support", SubTitle = "get more themes from http://www.getwox.com/theme", IcoPath = "Images/app.png", PluginDirectory = Path.GetDirectoryName(Infrastructure.Constant.ProgramDirectory) }, new Result { Title = "Plugins support", SubTitle = "get more plugins from http://www.getwox.com/plugin", IcoPath = "Images/app.png", PluginDirectory = Path.GetDirectoryName(Infrastructure.Constant.ProgramDirectory) }, new Result { Title = "Wox is an open-source software", SubTitle = "Wox benefits from the open-source community a lot", IcoPath = "Images/app.png", PluginDirectory = Path.GetDirectoryName(Infrastructure.Constant.ProgramDirectory) } }); foreach (string theme in ThemeManager.Instance.LoadAvailableThemes()) { string themeName = Path.GetFileNameWithoutExtension(theme); themeComboBox.Items.Add(themeName); } themeComboBox.SelectedItem = _settings.Theme; var wallpaper = WallpaperPathRetrieval.GetWallpaperPath(); if (wallpaper != null && File.Exists(wallpaper)) { var memStream = new MemoryStream(File.ReadAllBytes(wallpaper)); var bitmap = new BitmapImage(); bitmap.BeginInit(); bitmap.StreamSource = memStream; bitmap.EndInit(); var brush = new ImageBrush(bitmap); brush.Stretch = Stretch.UniformToFill; PreviewPanel.Background = brush; } else { var wallpaperColor = WallpaperPathRetrieval.GetWallpaperColor(); PreviewPanel.Background = new SolidColorBrush(wallpaperColor); } }