コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: Miners/MinusShare
        private static void CheckForUpdates(bool showResultsAlways)
        {
            KfUpdater updater = new KfUpdater(Settings.Default.VersionUrl, Settings.Default.DownloadUrlFormat);
            updater.CheckCompleted = () =>
            {
                if (updater.HasNewerVersion)
                {
                    MessageBoxResult dialogResult = MessageBox.Show(string.Format(Base.Resources.DialogVersionUpdateQuestionFormat,
                                                                                  updater.NewerVersion),
                                                                    Base.Resources.DialogVersionUpdate,
                                                                    MessageBoxButton.YesNo);

                    if (dialogResult == MessageBoxResult.Yes)
                    {
                        updater.Update();
                    }
                }
                else if (showResultsAlways)
                {
                    MessageBox.Show(Properties.Resources.DialogVersionUpdateNoUpdates, Base.Resources.DialogVersionUpdate, MessageBoxButton.OK);
                }
            };

            updater.Check();
        }
コード例 #2
0
        private void CheckForUpdates(bool showResultsAlways)
        {
            KfUpdater updater = new KfUpdater(Settings.Default.VersionUrl, Settings.Default.DownloadUrlFormat);
            imageLoading.Visibility = Visibility.Visible;
            updater.CheckCompleted = () =>
            {
                imageLoading.Visibility = Visibility.Collapsed;

                if (updater.HasError)
                {
                    if (showResultsAlways)
                    {
                        MessageBox.Show(Base.Resources.ConnectionError, Base.Resources.DialogVersionUpdate, MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                    else
                    {
                        OnErrorMessage(Base.Resources.ConnectionError);
                        DisableControls();
                    }
                }
                else if (updater.HasNewerVersion)
                {
                    MessageBoxResult dialogResult = MessageBox.Show(
                        string.Format(Base.Resources.DialogVersionUpdateQuestionFormat, updater.NewerVersion),
                        Base.Resources.DialogVersionUpdate,
                        MessageBoxButton.YesNo);

                    if (dialogResult == MessageBoxResult.Yes)
                    {
                        updater.Update();
                    }
                }
                else if (showResultsAlways)
                {
                    MessageBox.Show(Properties.Resources.DialogVersionUpdateNoUpdates, Base.Resources.DialogVersionUpdate, MessageBoxButton.OK);
                }
            };

            updater.Check();
        }