Пример #1
0
 private void tbNewVersion_MouseUp(object sender, MouseButtonEventArgs e)
 {
     Release newRelease = new UpdateChecker().CheckUpgrade();
     if (newRelease != null)
     {
         Process.Start("http://www.getwox.com/release/version/" + newRelease.version);
     }
 }
Пример #2
0
        public NewVersionWindow()
        {
            InitializeComponent();

            tbCurrentVersion.Text = ConfigurationManager.AppSettings["version"];
            Release newRelease = new UpdateChecker().CheckUpgrade();
            if (newRelease == null)
            {
                tbNewVersion.Visibility = Visibility.Collapsed;
            }
            else
            {
                tbNewVersion.Text = newRelease.version;
            }
        }
Пример #3
0
        private void Setting_Loaded(object sender, RoutedEventArgs ev)
        {
            #region General

            cbHideWhenDeactive.Checked += (o, e) =>
            {
                UserSettingStorage.Instance.HideWhenDeactive = true;
                UserSettingStorage.Instance.Save();
            };

            cbHideWhenDeactive.Unchecked += (o, e) =>
            {
                UserSettingStorage.Instance.HideWhenDeactive = false;
                UserSettingStorage.Instance.Save();
            };

            cbDontPromptUpdateMsg.Checked += (o, e) =>
            {
                UserSettingStorage.Instance.DontPromptUpdateMsg = true;
                UserSettingStorage.Instance.Save();
            };

            cbDontPromptUpdateMsg.Unchecked += (o, e) =>
            {
                UserSettingStorage.Instance.DontPromptUpdateMsg = false;
                UserSettingStorage.Instance.Save();
            };

            comboMaxResultsToShow.SelectionChanged += (o, e) =>
            {
                UserSettingStorage.Instance.MaxResultsToShow = (int)comboMaxResultsToShow.SelectedItem;
                UserSettingStorage.Instance.Save();
                MainWindow.pnlResult.lbResults.GetBindingExpression(MaxHeightProperty).UpdateTarget();
            };

            cbStartWithWindows.IsChecked = File.Exists(woxLinkPath);
            cbHideWhenDeactive.IsChecked = UserSettingStorage.Instance.HideWhenDeactive;
            cbDontPromptUpdateMsg.IsChecked = UserSettingStorage.Instance.DontPromptUpdateMsg;

            comboMaxResultsToShow.ItemsSource = Enumerable.Range(2, 16);
            var maxResults = UserSettingStorage.Instance.MaxResultsToShow;
            comboMaxResultsToShow.SelectedItem = maxResults == 0 ? 6 : maxResults;

            #endregion

            #region Theme

            if (!string.IsNullOrEmpty(UserSettingStorage.Instance.QueryBoxFont) &&
                Fonts.SystemFontFamilies.Count(o => o.FamilyNames.Values.Contains(UserSettingStorage.Instance.QueryBoxFont)) > 0)
            {
                cbQueryBoxFont.Text = UserSettingStorage.Instance.QueryBoxFont;

                cbQueryBoxFontFaces.SelectedItem = SyntaxSugars.CallOrRescueDefault(() => ((FontFamily)cbQueryBoxFont.SelectedItem).ConvertFromInvariantStringsOrNormal(
                    UserSettingStorage.Instance.QueryBoxFontStyle,
                    UserSettingStorage.Instance.QueryBoxFontWeight,
                    UserSettingStorage.Instance.QueryBoxFontStretch
                    ));
            }
            if (!string.IsNullOrEmpty(UserSettingStorage.Instance.ResultItemFont) &&
                Fonts.SystemFontFamilies.Count(o => o.FamilyNames.Values.Contains(UserSettingStorage.Instance.ResultItemFont)) > 0)
            {
                cbResultItemFont.Text = UserSettingStorage.Instance.ResultItemFont;

                cbResultItemFontFaces.SelectedItem = SyntaxSugars.CallOrRescueDefault(() => ((FontFamily)cbResultItemFont.SelectedItem).ConvertFromInvariantStringsOrNormal(
                    UserSettingStorage.Instance.ResultItemFontStyle,
                    UserSettingStorage.Instance.ResultItemFontWeight,
                    UserSettingStorage.Instance.ResultItemFontStretch
                    ));
            }
            resultPanelPreview.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/work.png",
                    PluginDirectory = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath)
                },
                new Result()
                {
                    Title = "Search applications",
                    SubTitle = "Search applications, files (via everything plugin) and browser bookmarks",
                    IcoPath = "Images/work.png",
                    PluginDirectory = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath)
                },
                new Result()
                {
                    Title = "Search web contents with shortcuts",
                    SubTitle = "e.g. search google with g keyword or youtube keyword)",
                    IcoPath = "Images/work.png",
                    PluginDirectory = Path.GetDirectoryName(Application.ExecutablePath)
                },
                new Result()
                {
                    Title = "clipboard history ",
                    IcoPath = "Images/work.png",
                    PluginDirectory = Path.GetDirectoryName(Application.ExecutablePath)
                },
                new Result()
                {
                    Title = "Themes support",
                    SubTitle = "get more themes from http://www.getwox.com/theme",
                    IcoPath = "Images/work.png",
                    PluginDirectory = Path.GetDirectoryName(Application.ExecutablePath)
                },
                new Result()
                {
                    Title = "Plugins support",
                    SubTitle = "get more plugins from http://www.getwox.com/plugin",
                    IcoPath = "Images/work.png",
                    PluginDirectory = Path.GetDirectoryName(Application.ExecutablePath)
                },
                new Result()
                {
                    Title = "Wox is an open-source software",
                    SubTitle = "Wox benefits from the open-source community a lot",
                    IcoPath = "Images/work.png",
                    PluginDirectory = Path.GetDirectoryName(Application.ExecutablePath)
                }
            });

            foreach (string theme in LoadAvailableThemes())
            {
                string themeName = System.IO.Path.GetFileNameWithoutExtension(theme);
                themeComboBox.Items.Add(themeName);
            }

            themeComboBox.SelectedItem = UserSettingStorage.Instance.Theme;
            slOpacity.Value = UserSettingStorage.Instance.Opacity;
            CbOpacityMode.SelectedItem = UserSettingStorage.Instance.OpacityMode;

            var wallpaper = WallpaperPathRetrieval.GetWallpaperPath();
            if (wallpaper != null && File.Exists(wallpaper))
            {
                var brush = new ImageBrush(new BitmapImage(new Uri(wallpaper)));
                brush.Stretch = Stretch.UniformToFill;
                PreviewPanel.Background = brush;
            }
            else
            {
                var wallpaperColor = WallpaperPathRetrieval.GetWallpaperColor();
                PreviewPanel.Background = new SolidColorBrush(wallpaperColor);
            }

            //PreviewPanel
            App.Window.SetTheme(UserSettingStorage.Instance.Theme);

            #endregion

            #region Plugin

            ctlHotkey.OnHotkeyChanged += ctlHotkey_OnHotkeyChanged;
            ctlHotkey.SetHotkey(UserSettingStorage.Instance.Hotkey, false);
            lvCustomHotkey.ItemsSource = UserSettingStorage.Instance.CustomPluginHotkeys;

            var plugins = new CompositeCollection
            {
                new CollectionContainer
                {
                    Collection =
                        PluginLoader.Plugins.AllPlugins.Where(o => o.Metadata.PluginType == PluginType.System)
                            .Select(o => o.Plugin)
                            .Cast<ISystemPlugin>()
                },
                FindResource("FeatureBoxSeperator"),
                new CollectionContainer
                {
                    Collection =
                        PluginLoader.Plugins.AllPlugins.Where(o => o.Metadata.PluginType == PluginType.ThirdParty)
                }
            };
            lbPlugins.ItemsSource = plugins;
            lbPlugins.SelectedIndex = 0;

            #endregion

            #region Proxy

            cbEnableProxy.Checked += (o, e) => EnableProxy();
            cbEnableProxy.Unchecked += (o, e) => DisableProxy();
            cbEnableProxy.IsChecked = UserSettingStorage.Instance.ProxyEnabled;
            tbProxyServer.Text = UserSettingStorage.Instance.ProxyServer;
            tbProxyPort.Text = UserSettingStorage.Instance.ProxyPort.ToString();
            tbProxyUserName.Text = UserSettingStorage.Instance.ProxyUserName;
            tbProxyPassword.Password = UserSettingStorage.Instance.ProxyPassword;
            if (UserSettingStorage.Instance.ProxyEnabled)
            {
                EnableProxy();
            }
            else
            {
                DisableProxy();
            }

            #endregion

            #region About

            tbVersion.Text = ConfigurationManager.AppSettings["version"];
            Release newRelease = new UpdateChecker().CheckUpgrade();
            if (newRelease == null)
            {
                tbNewVersionAvailable.Visibility = Visibility.Collapsed;
            }
            else
            {
                tbNewVersionAvailable.Text = newRelease.version + " available";
            }

            #endregion

            settingsLoaded = true;
        }