示例#1
0
        private async void Btn_SearchUpdates(object sender, RoutedEventArgs e)
        {
            Button btn = sender as Button;

            if (btn != null)
            {
                btn.IsEnabled = false;
            }

            //Show Progress Indicator
            _window?.ShowProgressIndicator();

            BtnUpdate.IsEnabled = await InstallerHelper.CheckForUpdates(_window, true);

            //Hide Progress Indicator
            _window?.HideProgressIndicator();

            if (btn != null)
            {
                btn.IsEnabled = true;
            }
        }
示例#2
0
        private async void Load()
        {
            _window?.ShowProgressIndicator();

            //Update Loading Indicator
            _window?.SetProgressStatus(strings.loadConf);

            try {
                Settings settings = ConfigHelper.JsonConfig;

                bool   usePrint   = settings.UsePrint;
                bool   runOnBoot  = settings.RunOnBoot;
                bool   autoUpdate = settings.AutoUpdate;
                string language   = settings.Language;
                Key    imgKey     = settings.ShortcutImgKey;
                Key    gifKey     = settings.ShortcutGifKey;

                //Use Print Key instead of default Shortcut
                PrintKeyBox.IsChecked = usePrint;

                //Run ImgurSniper on boot
                if (runOnBoot)
                {
                    RunOnBoot.IsChecked = true;
                    InstallerHelper.Autostart(true);
                }

                //Auto search for Updates
                if (autoUpdate)
                {
                    AutoUpdateBox.IsChecked = true;
                }

                //Set correct Language for Current Language Box
                switch (language)
                {
                case "en":
                    LanguageBox.SelectedItem = En;
                    break;

                case "de":
                    LanguageBox.SelectedItem = De;
                    break;
                }
                LanguageBox.SelectionChanged += LanguageBox_SelectionChanged;

                //GIF Hotkey
                HotkeyGifBox.Text = gifKey.ToString();

                //Image Hotkey
                HotkeyImgBox.Text = imgKey.ToString();
            } catch {
                await Dialog.ShowOkDialog(strings.couldNotLoad,
                                          string.Format(strings.errorConfig, ConfigHelper.ConfigPath));
            }

            //Search for Updates
            if (_window != null)
            {
                _window.SetProgressStatus(strings.checkingUpdate);
                BtnUpdate.IsEnabled = await InstallerHelper.CheckForUpdates(_window, false);
            }

            //Remove Loading Indicator
            _window?.HideProgressIndicator();
        }