Esempio n. 1
0
        private void AutoUpdaterOnCheckForUpdateEvent(UpdateInfoEventArgs args)
        {
            if (args != null)
            {
                if (args.IsUpdateAvailable)
                {
                    var dialogResult =
                        MessageBox.Show(
                            string.Format(
                                "There is new version {0} available. You are using version {1}. Do you want to update the application now?",
                                args.CurrentVersion, args.InstalledVersion), @"Update Available",
                            MessageBoxButtons.YesNo,
                            MessageBoxIcon.Information);

                    if (dialogResult.Equals(DialogResult.Yes))
                    {
                        try
                        {
                            //You can use Download Update dialog used by AutoUpdater.NET to download the update.

                            AutoUpdater.DownloadUpdate();
                        }
                        catch (Exception exception)
                        {
                            MessageBox.Show(exception.Message, exception.GetType().ToString(), MessageBoxButtons.OK,
                                            MessageBoxIcon.Error);
                        }
                    }
                }
                else
                {
                    MessageBox.Show(@"There is no update available please try again later.", @"No update available",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show(
                    @"There is a problem reaching update server please check your internet connection and try again later.",
                    @"Update check failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void AutoUpdaterOnCheckForUpdateEvent(UpdateInfoEventArgs args)
        {
            Serilog.Log.Information("AutoUpdaterOnCheckForUpdateEvent called.");
            if (args != null)
            {
                if (args.IsUpdateAvailable)
                {
                    try
                    {
                        Serilog.Log.Information("Update available, trying to download.");
                        MessageBox.Show("An update for XIVLauncher is available. It will now be downloaded, the application will restart.",
                                        "XIVLauncher Update", MessageBoxButton.OK, MessageBoxImage.Asterisk);

                        if (AutoUpdater.DownloadUpdate())
                        {
                            Environment.Exit(0);
                        }
                        else
                        {
                            Util.ShowError($"Could not download update. Please try again later.", "Update failed");
                            Environment.Exit(0);
                        }
                    }
                    catch (Exception exc)
                    {
                        new ErrorWindow(exc, $"Update failed. Please report this error and try again later. \n\n{exc}", "UpdateAvailableFail").ShowDialog();
                        Environment.Exit(0);
                    }
                }
                else
                {
                    Serilog.Log.Information("No update: {0}", args.CurrentVersion);
                    InitializeWindow();
                }
            }
            else
            {
                Util.ShowError($"Could not check for updates. Please try again later.", "Update failed");
                Serilog.Log.Error("Update check failed.");
                Environment.Exit(0);
            }
        }
Esempio n. 3
0
        void Message(UpdateInfoEventArgs args)
        {
            if (args.Mandatory.Value)
            {
                dialogResult =
                    MessageBox.Show(
                        $@"Yeni bir versiyon {args.CurrentVersion} bulunmakta. Suanda  {
                                args.InstalledVersion
                            } versiyonunu kullanmaktasiniz. Simdi guncellemek istermisiniz?",
                        @"Update Available",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
            }
            else
            {
                dialogResult =
                    MessageBox.Show(
                        $@"Yeni bir versiyon {args.CurrentVersion} bulunmakta. Suanda  {
                                args.InstalledVersion
                            } versiyonunu kullanmaktasiniz. Simdi guncellemek istermisiniz?", @"Update Available",
                        MessageBoxButtons.YesNo,
                        MessageBoxIcon.Information);
            }
            if (dialogResult.Equals(DialogResult.Yes) || dialogResult.Equals(DialogResult.OK))
            {
                try
                {
                    //You can use Download Update dialog used by AutoUpdater.NET to download the update.

                    if (AutoUpdater.DownloadUpdate(args))
                    {
                        Application.Exit();
                    }
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message, exception.GetType().ToString(), MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 4
0
        //  Void de atualização
        private void Atualizar()
        {
            //  Avisamos que o download está em execução
            //  E escondemos a label 2
            Label1.Content    = "BAIXANDO";
            Label2.Visibility = Visibility.Collapsed;

            //  Mudamos o icone para o icone de download
            Icon.Kind = PackIconKind.FileDownloadOutline;

            //  Escondemos o painel de update (o com as opções para aceitar ou não, o update...)
            StackPanelUpdate.Visibility = Visibility.Collapsed;

            //  Tentamos baixar o update
            try
            {
                //  Baixamos o update, e ao concluir, fecharmos o programa
                if (AutoUpdater.DownloadUpdate())
                {
                    Application.Current.Shutdown();
                }
            }
            catch (Exception exception)
            {
                //  Erro ao realizar update

                //  Mudamos o icone para o iconde de erro
                Icon.Kind = PackIconKind.ErrorOutline;
                //  Alteramos o texto da label 1
                Label1.Content = "ERRO";
                //  Esondemos a label 2
                Label2.Visibility = Visibility.Collapsed;

                //  Informamos o erro
                MessageBox.Show(exception.Message, exception.GetType().ToString(), MessageBoxButton.OK, MessageBoxImage.Error);
            }

            //  Fecha o programa
            Application.Current.Shutdown();
        }
Esempio n. 5
0
        public AppUpdateWindow()
        {
            InitializeComponent();

            var obj = TryFindResource("DefaultMarkdown");

            if (obj != null && obj is Markdown markdown)
            {
                _defaultMarkdown = markdown;
            }

            ConfirmButton.Click += (o, e) =>
            {
                try
                {
                    if (AutoUpdater.DownloadUpdate(UpdateArgs))
                    {
                        System.Windows.Application.Current.Shutdown();
                    }
                }
                catch (Exception exception)
                {
                    MessageBox.Show(new MessageBoxModel
                    {
                        Caption = exception.GetType().ToString(),
                        Text    = exception.Message,
                        Icon    = MessageBoxImage.Error,
                        Buttons = new IMessageBoxButtonModel[1] {
                            MessageBoxButtons.Ok()
                        },
                    });
                    Hide();
                }
            };

            SkipButton.Click += (o, e) =>
            {
                Hide();
            };
        }
Esempio n. 6
0
 private bool DownloadAndUnzipUpdatePackage(string url)
 {
     AutoUpdater.RunUpdateAsAdmin = ShellService.IsWriteProtectedInstallation;
     AutoUpdater.UpdateMode       = Mode.ForcedDownload;
     try
     {
         UpdateInfoEventArgs args = new UpdateInfoEventArgs {
             DownloadURL = url
         };
         if (AutoUpdater.DownloadUpdate(args))
         {
             ((IShellView)_shellViewModel.Value.View).Close();
             return(true);
         }
     }
     catch (Exception e)
     {
         Logger.Error("ModuleController.DownloadAndUnzipUpdatePackage: {0}", e.ToString());
         MessageService.ShowError(e.Message, e.GetType().ToString());
     }
     return(false);
 }
 private void AutoUpdater_CheckForUpdateEvent(UpdateInfoEventArgs args)
 {
     if (args != null)
     {
         if (args.IsUpdateAvailable)
         {
             if (args.InstalledVersion != args.CurrentVersion)
             {
                 bool downloaded = AutoUpdater.DownloadUpdate();
                 if (!downloaded)
                 {
                     MessageBox.Show("Dogodila se greška prilikom preuzimanja nove verzije aplikacije!\nBiće pokrenuta prethodna verzija!");
                     return;
                 }
                 else
                 {
                     System.Windows.Application.Current.Shutdown();
                 }
             }
         }
     }
 }
Esempio n. 8
0
        private void AutoUpdaterOnCheckForUpdateEvent(UpdateInfoEventArgs args)
        {
            _lightSleeper.Cancel();

            if (args != null)
            {
                if (args.IsUpdateAvailable)
                {
                    var msg = "Update terbaru versi {0} sudah tersedia. Saat ini Anda sedang menggunakan Versi {1}\n\nApakah Anda ingin memperbarui aplikasi ini sekarang ?";

                    var installedVersion = string.Format("{0}.{1}.{2}.{3} (v{0}.{1}.{2}{4})", args.InstalledVersion.Major, args.InstalledVersion.Minor, args.InstalledVersion.Build, args.InstalledVersion.Revision, MainProgram.stageOfDevelopment);
                    var currentVersion   = string.Format("{0}.{1}.{2}.{3}", args.CurrentVersion.Major, args.CurrentVersion.Minor, args.CurrentVersion.Build, args.CurrentVersion.Revision);

                    var dialogResult = MessageBox.Show(string.Format(msg, currentVersion, installedVersion), "Update Tersedia",
                                                       MessageBoxButtons.YesNo,
                                                       MessageBoxIcon.Information);

                    if (dialogResult.Equals(DialogResult.Yes))
                    {
                        try
                        {
                            AutoUpdater.DownloadUpdate();
                        }
                        catch (Exception exception)
                        {
                            MessageBox.Show(exception.Message, exception.GetType().ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Tidak ada update yang tersedia, silahkan dicoba lagi nanti.", "Update belum tersedia", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("Gagal melakukan koneksi ke server, silahkan dicoba lagi nanti.", "Cek update terbaru gagal", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void AutoUpdaterOnCheckForUpdateEvent(UpdateInfoEventArgs args)
        {
            if (args != null)
            {
                if (args.IsUpdateAvailable)
                {
                    try
                    {
                        MessageBox.Show("An update is available. It will now be downloaded, the application will restart.",
                                        "XIVLauncher Update", MessageBoxButton.OK, MessageBoxImage.Asterisk);

                        if (AutoUpdater.DownloadUpdate())
                        {
                            Environment.Exit(0);
                        }
                        else
                        {
                            Util.ShowError($"Could not download update. Please try again later.", "Update failed");
                            Environment.Exit(0);
                        }
                    }
                    catch (Exception exc)
                    {
                        Util.ShowError($"Update failed. Please report this error and try again later. \n\n{exc}", "Update failed");
                        Environment.Exit(0);
                    }
                }
                else
                {
                    InitializeWindow();
                }
            }
            else
            {
                Util.ShowError($"Could not check for updates. Please try again later.", "Update failed");
                Environment.Exit(0);
            }
        }
Esempio n. 10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="args"></param>
        private static void AutoUpdaterOnCheckForUpdateEvent(UpdateInfoEventArgs args)
        {
            switch (args.Error)
            {
            case null when args.IsUpdateAvailable:
                MainWindow.Settings.FirstTimeOpenAfterUpdate = true;
                MainWindow.Window.SetStatus("A new update is available. Downloading installer...");
                XtraMessageBox.Show(MainWindow.Window, $"There is a new version available ({GitHubData.Name})", @"Update Available", MessageBoxButtons.OK, MessageBoxIcon.Information);

                try
                {
                    if (AutoUpdater.DownloadUpdate(args))
                    {
                        Application.Exit();
                    }
                }
                catch (Exception ex)
                {
                    XtraMessageBox.Show(MainWindow.Window, ex.Message, ex.GetType().ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                break;

            case null:
                MainWindow.Window.SetStatus($"You're currently using the latest version of ModioX ({CurrentVersionName})");
                break;

            case WebException:
                MainWindow.Window.SetStatus($"Unable to check application version at this current time. Error: {args.Error.Message}", args.Error);
                XtraMessageBox.Show(MainWindow.Window, @"There is a problem reaching update server. Please check your internet connection and try again later.", @"Update Check Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                break;

            default:
                MainWindow.Window.SetStatus($"Unable to check application for a new version. Error Message: {args.Error.Message}", args.Error);
                XtraMessageBox.Show(MainWindow.Window, args.Error.Message, args.Error.GetType().ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
                break;
            }
        }
Esempio n. 11
0
 private void AutoUpdaterOnCheckForUpdateEvent(UpdateInfoEventArgs args)
 {
     if (args == null)
     {
         Logger.Log("INFO", "网络错误或服务器错误");
     }
     else if (!args.IsUpdateAvailable)
     {
         Logger.Log("INFO", "未检测到更新");
     }
     else
     {
         try
         {
             AutoUpdater.DownloadUpdate();
         }
         catch (Exception exception)
         {
             Logger.Log("ERROR", exception.Message);
         }
     }
     AutoUpdater_ApplicationExitEvent();
 }
Esempio n. 12
0
        /// <summary>
        /// Event handler for the AutoUpdater.   This will get if an update is available
        /// and if so, which version is available.
        /// </summary>
        /// <param name="args">Results for checking if an update exist.</param>
        private void AutoUpdaterOnCheckForUpdateEvent(UpdateInfoEventArgs args)
        {
            if (args != null)
            {
                if (!args.IsUpdateAvailable)
                {
                    PulseVersionUpdateToDate = string.Format("Pulse is up to date");
                    PulseUpdateUrl           = "";
                }
                else
                {
                    PulseVersionUpdateToDate = string.Format("Pulse version {0} is available", args.CurrentVersion);
                    PulseUpdateUrl           = args.DownloadURL;
                }
                // Unsubscribe
                AutoUpdater.CheckForUpdateEvent -= AutoUpdaterOnCheckForUpdateEvent;
                IsCheckingForUpdates             = false;


                if (args.IsUpdateAvailable)
                {
                    MessageBoxResult dialogResult;
                    if (args.Mandatory)
                    {
                        dialogResult =
                            MessageBox.Show(@"There is new version " + args.CurrentVersion + "  available. \nYou are using version " + args.InstalledVersion + ". \nThis is required update. \nPress Ok to begin updating the application.",
                                            @"Update Available",
                                            MessageBoxButton.OK,
                                            MessageBoxImage.Information);
                    }
                    else
                    {
                        dialogResult =
                            MessageBox.Show(
                                @"There is new version " + args.CurrentVersion + " available. \nYou are using version " + args.InstalledVersion + ".  \nDo you want to update the application now?",
                                @"Update Available",
                                MessageBoxButton.YesNo,
                                MessageBoxImage.Information);
                    }

                    if (dialogResult.Equals(MessageBoxResult.Yes))
                    {
                        try
                        {
                            if (AutoUpdater.DownloadUpdate())
                            {
                                //Application.Current.Exit();
                                System.Windows.Application.Current.Shutdown();
                            }
                        }
                        catch (Exception exception)
                        {
                            MessageBox.Show(exception.Message,
                                            exception.GetType().ToString(),
                                            MessageBoxButton.OK,
                                            MessageBoxImage.Error);
                        }
                    }
                }
                else
                {
                    //MessageBox.Show(@"There is no update available please try again later.",
                    //                @"No update available",
                    //                MessageBoxButton.OK,
                    //                MessageBoxImage.Information);
                }
            }
            else
            {
                //MessageBox.Show(
                //        @"There is a problem reaching update server please check your internet connection and try again later.",
                //        @"Update check failed",
                //        MessageBoxButton.OK,
                //        MessageBoxImage.Error);
            }
        }
Esempio n. 13
0
        public static void AutoUpdaterOnCheckForUpdateEvent(UpdateInfoEventArgs args)
        {
            if (args != null)
            {
                if (args.IsUpdateAvailable)
                {
                    DebugHelper.WriteLine("AutoUpdater: Update available");
                    DebugHelper.WriteLine("AutoUpdater: Installed version: " + args.InstalledVersion);
                    DebugHelper.WriteLine("AutoUpdater: Available version: " + args.CurrentVersion);

                    MessageBoxResult dialogResult;
                    if (args.Mandatory)
                    {
                        dialogResult =
                            DarkMessageBox.ShowOK(
                                $"FModel {args.CurrentVersion} is available. You are using version {args.InstalledVersion}. This is a required update. Press Ok to begin updating the application.",
                                "Update Available",
                                "OK",
                                MessageBoxImage.Information);
                    }
                    else
                    {
                        dialogResult =
                            DarkMessageBox.ShowYesNoCancel(
                                $"FModel {args.CurrentVersion} is available. You are using version {args.InstalledVersion}. Do you want to update the application now?",
                                "Update Available",
                                "Yes (See the changelog)",
                                "Yes",
                                "No");
                    }

                    if (dialogResult == MessageBoxResult.Yes)
                    {
                        DebugHelper.WriteLine("AutoUpdater: User is checking the changelog");
                        Process.Start(args.ChangelogURL);
                    }

                    //yes if clicked on changelog (show changelog + update kthx)
                    //no if clicked on ShowYesNoCancel Yes (do not show changelog but update kthx)
                    //ok if force update
                    if (dialogResult == MessageBoxResult.Yes || dialogResult == MessageBoxResult.No || dialogResult == MessageBoxResult.OK)
                    {
                        DebugHelper.WriteLine("AutoUpdater: Updating");
                        try
                        {
                            if (AutoUpdater.DownloadUpdate())
                            {
                                Application.Current.Shutdown();
                            }
                        }
                        catch (Exception exception)
                        {
                            DebugHelper.WriteException(exception);
                            DarkMessageBox.ShowOK(exception.Message, exception.GetType().ToString(), "OK", MessageBoxImage.Error);
                        }
                    }
                    else
                    {
                        DebugHelper.WriteLine("AutoUpdater: Do not wanna update");
                    }
                }
                else
                {
                    DebugHelper.WriteLine("AutoUpdater: No update available");
                }
            }
            else
            {
                DebugHelper.WriteLine("AutoUpdater: There is a problem reaching update server please check your internet connection and try again later.");

                DarkMessageBox.ShowOK(
                    "There is a problem reaching update server please check your internet connection and try again later.",
                    "Update check failed", "OK", MessageBoxImage.Error);
            }
        }
Esempio n. 14
0
        private static void AutoUpdater_CheckForUpdateEvent(UpdateInfoEventArgs uargs)
        {
            if ((CurrentUpdateMode == UpdateMode.Normal || CurrentUpdateMode == UpdateMode.Notification) && uargs != null && uargs.IsUpdateAvailable)
            {
                if (ConfigManager.Config.UpdateConfig.LatestVersionRun != null &&
                    ConfigManager.Config.UpdateConfig.VersionSkip != uargs.CurrentVersion.ToString())
                {
                    var acceptVer = new Version(ConfigManager.Config.UpdateConfig.LatestVersionRun);
                    if (acceptVer.CompareTo(new Version(Application.ProductVersion)) > 0)
                    {
                        // user has downgraded, skip available update

                        ConfigManager.Config.UpdateConfig.VersionSkip = uargs.CurrentVersion.ToString();
                        ConfigManager.SaveConfig();

                        MessageBox.Show("It seems that you have downgraded SteelQuiz, so SteelQuiz will not automatically update to the latest version " +
                                        "available now.\r\n\r\nAs soon as a newer update is released than the latest one available now, the automatic updates will resume.\r\n\r\n" +
                                        "This can be changed at any time in Preferences > Updates.", "Skipping available update - SteelQuiz",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }

            if (ConfigManager.Config.UpdateConfig.VersionSkip != uargs.CurrentVersion.ToString())
            {
                if (ConfigManager.Config.UpdateConfig.VersionSkip != null)
                {
                    ConfigManager.Config.UpdateConfig.VersionSkip = null;
                }
                ConfigManager.Config.UpdateConfig.LatestVersionRun = uargs.InstalledVersion.ToString();
                ConfigManager.SaveConfig();
            }

            if (CurrentUpdateMode == UpdateMode.Normal)
            {
                if (ConfigManager.Config.UpdateConfig.AutoUpdateMode == ConfigData.AutomaticUpdateMode.Disabled ||
                    ConfigManager.Config.UpdateConfig.VersionSkip == uargs.CurrentVersion.ToString())
                {
                    return;
                }

                if (uargs != null && uargs.IsUpdateAvailable)
                {
                    if (uargs.Mandatory && uargs.UpdateMode == Mode.Forced)
                    {
                        var msg = MessageBox.Show("A mandatory software update is available. You can not continue using SteelQuiz without updating. Press OK to " +
                                                  "update, or Cancel to exit", "SteelQuiz", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                        if (msg == DialogResult.OK)
                        {
                            UpdateExitInProgress = true;
                            if (Program.CloseQuizEditors() && AutoUpdater.DownloadUpdate())
                            {
                                Application.Exit();
                            }
                            UpdateExitInProgress = false;
                        }
                        else
                        {
                            UpdateExitInProgress = true;
                            if (Program.CloseQuizEditors())
                            {
                                Application.Exit();
                            }
                            UpdateExitInProgress = false;
                        }
                    }
                    else if (uargs.Mandatory && uargs.UpdateMode == Mode.ForcedDownload)
                    {
                        UpdateExitInProgress = true;
                        if (Program.CloseQuizEditors() && AutoUpdater.DownloadUpdate())
                        {
                            Application.Exit();
                        }
                        UpdateExitInProgress = false;
                    }
                    else
                    {
                        if (ConfigManager.Config.UpdateConfig.AutoUpdateMode == ConfigData.AutomaticUpdateMode.CheckOnly ||
                            uargs.CurrentVersion.Major != uargs.InstalledVersion.Major)    // Don't update to new major versions automatically
                        {
                            var frmUpdate = new UpdateAvailable(uargs.InstalledVersion, uargs.CurrentVersion);
                            var result    = frmUpdate.ShowDialog();
                            if (result != DialogResult.OK)
                            {
                                return;
                            }
                        }

                        UpdateExitInProgress = true;
                        if (Program.CloseQuizEditors() && AutoUpdater.DownloadUpdate())
                        {
                            Application.Exit();
                        }
                        UpdateExitInProgress = false;
                    }
                }
            }
            else if (CurrentUpdateMode == UpdateMode.Notification)
            {
                if (ConfigManager.Config.UpdateConfig.AutoUpdateMode == ConfigData.AutomaticUpdateMode.Disabled ||
                    ConfigManager.Config.UpdateConfig.VersionSkip == uargs.CurrentVersion.ToString())
                {
                    return;
                }

                if (uargs != null && uargs.IsUpdateAvailable)
                {
                    Program.frmDashboard.tmr_chkUpdate.Interval = 2 * 60 * 60 * 1000; // dont check for updates again for 2h

                    var notifyIcon = new NotifyIcon
                    {
                        Visible         = true,
                        Icon            = Properties.Resources.Logo,
                        BalloonTipTitle = "SteelQuiz"
                    };

                    if (uargs.Mandatory)
                    {
                        if (uargs.UpdateMode == Mode.Forced)
                        {
                            notifyIcon.BalloonTipText = "Mandatory software update is available. Click here to update now";
                        }
                        else // automatic download and installation (at startup of app)
                        {
                            notifyIcon.BalloonTipText = "A software update is available. Click here to update now";
                        }
                    }
                    else
                    {
                        if (ConfigManager.Config.UpdateConfig.AutoUpdateMode == ConfigData.AutomaticUpdateMode.CheckDownloadInstall &&
                            uargs.CurrentVersion.Major == uargs.InstalledVersion.Major)    // Always show info before major update
                        {
                            notifyIcon.BalloonTipText = "A software update is available. Click here to update now";
                        }
                        else
                        {
                            notifyIcon.BalloonTipText = "A software update is available. Click here for more info";
                        }
                    }
                    notifyIcon.BalloonTipClosed  += (sender, args) => Dispose(notifyIcon);
                    notifyIcon.BalloonTipClicked += (sender, args) => UpdateNotificationClick(notifyIcon);
                    notifyIcon.ShowBalloonTip(10000);
                }
            }
            else if (CurrentUpdateMode == UpdateMode.Verbose)
            {
                if (uargs != null && uargs.IsUpdateAvailable)
                {
                    if (uargs.Mandatory || new UpdateAvailable(uargs.InstalledVersion, uargs.CurrentVersion).ShowDialog() == DialogResult.OK)
                    {
                        if (Program.CloseQuizEditors() && AutoUpdater.DownloadUpdate())
                        {
                            Application.Exit();
                        }
                    }
                }
                else
                {
                    MessageBox.Show($"No updates are available.\r\n\r\nYou are running SteelQuiz v{Application.ProductVersion}",
                                    "Update Check - SteelQuiz", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else if (CurrentUpdateMode == UpdateMode.Force)
            {
                if (Program.CloseQuizEditors() && AutoUpdater.DownloadUpdate())
                {
                    Application.Exit();
                }
            }
        }
        private void AutoUpdaterOnCheckForUpdateEvent(UpdateInfoEventArgs args)
        {
            switch (args.Error)
            {
            case null when args.IsUpdateAvailable:
            {
                MessageBoxResult messageBoxResult;

                if (args.Mandatory.Value)
                {
                    messageBoxResult =
                        MessageBox.Show(
                            $@"There is new version {args.CurrentVersion} available. You are using version {args.InstalledVersion}. This is required update. Press Ok to begin updating the application.", @"Update Available",
                            MessageBoxButton.OK,
                            MessageBoxImage.Information);
                }
                else
                {
                    messageBoxResult =
                        MessageBox.Show(
                            $@"There is new version {args.CurrentVersion} available. You are using version {
                                        args.InstalledVersion
                                    }. Do you want to update the application now?", @"Update available",
                            MessageBoxButton.YesNo,
                            MessageBoxImage.Information);
                }

                if (messageBoxResult.Equals(MessageBoxResult.Yes) || messageBoxResult.Equals(MessageBoxResult.OK))
                {
                    try
                    {
                        if (AutoUpdater.DownloadUpdate(args))
                        {
                            Current.Shutdown();
                        }
                    }
                    catch (Exception exception)
                    {
                        MessageBox.Show(exception.Message, exception.GetType().ToString(), MessageBoxButton.OK,
                                        MessageBoxImage.Error);
                    }
                }

                break;
            }

            case null:
                break;

            case WebException _:
                MessageBox.Show(
                    @"There is a problem reaching update server. Please check your internet connection and try again later.",
                    @"Update check failed", MessageBoxButton.OK, MessageBoxImage.Error);
                break;

            default:
                MessageBox.Show(args.Error.Message,
                                args.Error.GetType().ToString(), MessageBoxButton.OK,
                                MessageBoxImage.Error);
                break;
            }
        }
Esempio n. 16
0
        private static void AutoUpdaterOnCheckForUpdateEvent(UpdateInfoEventArgs args)
        {
            if (args.Error == null)
            {
                if (args.IsUpdateAvailable)
                {
                    var messageBox = new AdonisUI.Controls.MessageBoxModel
                    {
                        Text = $"There is new version {args.CurrentVersion} available.{Environment.NewLine}" +
                               $"You are using version {args.InstalledVersion}.{Environment.NewLine}" +
                               $"{ChangelogText}{Environment.NewLine}" +
                               $"Do you want to update the application now?",
                        Caption = @"Update Available",
                        Buttons = AdonisUI.Controls.MessageBoxButtons.YesNo()
                    };

                    AdonisUI.Controls.MessageBox.Show(messageBox);

                    if (!manual)
                    {
                        SplashWindow.splash.Hide();
                    }

                    if (messageBox.Result.Equals(AdonisUI.Controls.MessageBoxResult.Yes))
                    {
                        try
                        {
                            if (AutoUpdater.DownloadUpdate(args))
                            {
                                if (!manual)
                                {
                                    SplashWindow.Stop();
                                }
                                Application.Current.Shutdown();
                                Environment.Exit(0);
                            }
                        }
                        catch (Exception exception)
                        {
                            AdonisUI.Controls.MessageBox.Show(
                                exception.Message,
                                exception.GetType().ToString(),
                                AdonisUI.Controls.MessageBoxButton.OK,
                                AdonisUI.Controls.MessageBoxImage.Error);
                        }
                    }
                    if (!manual)
                    {
                        SplashWindow.splash.Show();
                    }
                }
            }
            else
            {
                if (args.Error is WebException)
                {
                    AdonisUI.Controls.MessageBox.Show(
                        @"There is a problem reaching update server. Please check your internet connection and try again later.",
                        @"Update Check Failed",
                        AdonisUI.Controls.MessageBoxButton.OK,
                        AdonisUI.Controls.MessageBoxImage.Error);
                }
                else
                {
                    AdonisUI.Controls.MessageBox.Show(
                        args.Error.Message,
                        args.Error.GetType().ToString(),
                        AdonisUI.Controls.MessageBoxButton.OK,
                        AdonisUI.Controls.MessageBoxImage.Error);
                }
            }
        }
Esempio n. 17
0
        private void AutoUpdaterOnCheckForUpdateEvent(UpdateInfoEventArgs args)
        {
            if (args.Error == null)
            {
                if (args.IsUpdateAvailable)
                {
                    MessageBoxResult result = MessageBox.Show(
                        $"There is new version {args.CurrentVersion} available.{Environment.NewLine}" +
                        $"You are using version {args.InstalledVersion}.{Environment.NewLine}" +
                        $"{ChangelogText}{Environment.NewLine}" +
                        "Do you want to update the application now?",
                        @"Update Available",
                        MessageBoxButton.YesNo
                        );

                    if (!manual)
                    {
                        SplashWindow.splash.Hide();
                    }

                    if (result.Equals(MessageBoxResult.Yes))
                    {
                        try
                        {
                            if (AutoUpdater.DownloadUpdate(args))
                            {
                                if (!manual)
                                {
                                    SplashWindow.Stop();
                                }
                                Application.Current.Shutdown();
                                Environment.Exit(0);
                            }
                        }
                        catch (Exception exception)
                        {
                            MessageBox.Show(
                                exception.Message,
                                exception.GetType().ToString(),
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
                        }
                    }

                    if (!manual)
                    {
                        SplashWindow.splash.Show();
                    }
                }
                else if (manual)
                {
                    OnUpdateCheckCompleteEvent(new EventArgs());
                }
            }
            else
            {
                if (args.Error is WebException)
                {
                    MessageBox.Show(
                        @"There is a problem reaching update server. Please check your internet connection and try again later.",
                        @"Update Check Failed",
                        MessageBoxButton.OK,
                        MessageBoxImage.Error);
                }
                else
                {
                    MessageBox.Show(
                        args.Error.Message,
                        args.Error.GetType().ToString(),
                        MessageBoxButton.OK,
                        MessageBoxImage.Error);
                }
            }
            AutoUpdater.ParseUpdateInfoEvent -= AutoUpdaterOnParseUpdateInfoEvent;
            AutoUpdater.CheckForUpdateEvent  -= AutoUpdaterOnCheckForUpdateEvent;
        }
Esempio n. 18
0
        private void AutoUpdaterOnCheckForUpdateEvent(UpdateInfoEventArgs args)
        {
            if (args != null)
            {
                if (args.IsUpdateAvailable)
                {
                    DialogResult dialogResult;
                    if (args.Mandatory)
                    {
                        dialogResult =
                            MessageBox.Show(
                                $@"There is new version {args.CurrentVersion} available. You are using version {args.InstalledVersion}. This is required update. Press Ok to begin updating the application.", @"Update Available",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                    }
                    else
                    {
                        dialogResult =
                            MessageBox.Show(
                                $@"There is new version {args.CurrentVersion} available. You are using version {
                                        args.InstalledVersion
                                    }. Do you want to update the application now?", @"Update Available",
                                MessageBoxButtons.YesNo,
                                MessageBoxIcon.Information);
                    }

                    // Uncomment the following line if you want to show standard update dialog instead.
                    AutoUpdater.ShowUpdateForm();

                    ProcessStartInfo sInfo = new ProcessStartInfo("https://stackoverflow.com/questions/58024/open-a-url-from-windows-forms");
                    Process.Start(sInfo);

                    if (dialogResult.Equals(DialogResult.Yes) || dialogResult.Equals(DialogResult.OK))
                    {
                        try
                        {
                            if (AutoUpdater.DownloadUpdate())
                            {
                                Application.Exit();
                            }
                        }
                        catch (Exception exception)
                        {
                            MessageBox.Show(exception.Message, exception.GetType().ToString(), MessageBoxButtons.OK,
                                            MessageBoxIcon.Error);
                        }
                    }
                }
                else
                {
                    MessageBox.Show(@"There is no update available please try again later.", @"No update available",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show(
                    @"There is a problem reaching update server please check your internet connection and try again later.",
                    @"Update check failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 19
0
        private void AutoUpdaterOnCheckForUpdateEvent(UpdateInfoEventArgs args)
        {
            if (args != null)
            {
                if (args.IsUpdateAvailable)
                {
                    DialogResult dialogResult;
                    if (args.Mandatory.Value)
                    {
                        dialogResult =
                            MessageBox.Show(
                                $@"Yeni bir versiyon {args.CurrentVersion} bulunmakta. Suanda  {
                                        args.InstalledVersion
                                    } versiyonunu kullanmaktasiniz. Simdi guncellemek istermisiniz?",
                                @"Update Available",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                    }
                    else
                    {
                        dialogResult =
                            MessageBox.Show(
                                $@"Yeni bir versiyon {args.CurrentVersion} bulunmakta. Suanda  {
                                        args.InstalledVersion
                                    } versiyonunu kullanmaktasiniz. Simdi guncellemek istermisiniz?", @"Update Available",
                                MessageBoxButtons.YesNo,
                                MessageBoxIcon.Information);
                    }


                    if (dialogResult.Equals(DialogResult.Yes) || dialogResult.Equals(DialogResult.OK))
                    {
                        try
                        {
                            //You can use Download Update dialog used by AutoUpdater.NET to download the update.

                            if (AutoUpdater.DownloadUpdate(args))
                            {
                                Application.Exit();
                            }
                        }
                        catch (Exception exception)
                        {
                            MessageBox.Show(exception.Message, exception.GetType().ToString(), MessageBoxButtons.OK,
                                            MessageBoxIcon.Error);
                        }
                    }
                }
                else
                {
                    MessageBox.Show(@"Şuanda bir güncelleme bulunmamaktadır. Lütfen daha sonra tekrar deneyiniz.", @"Update Bulunamadı",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show(
                    @"Güncelleme aranırken sorun oluştu. Lütfen internet bağlantınızı kontrol edip tekrar deneyiniz.",
                    @"Update Kontrol Hatası", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 20
0
        private void CompareVersions(string currentVersion, VersionController versionController)
        {
            string latestVer = "";

            try
            {
                var latestVersion = versionController.GetVersion();
                foreach (var v in latestVersion)
                {
                    latestVer = v.VersionNumber;
                    if (v.VersionNumber.Contains(currentVersion))
                    {
                        upToDate = true; //TRUE
                    }
                }
            }
            catch (Exception e)
            {
                if (IsConnectedToInternet() == false)
                {
                    QModernMessageBox.Show("Du bist nicht mit dem Internet verbunden! Bitte versuche es später noch einmal. Fehler: " + e.Message, "Fehler", QModernMessageBox.QModernMessageBoxButtons.Ok, ModernMessageboxIcons.Warning);
                    Environment.Exit(0);
                }
                else
                {
                    var    st        = new StackTrace(e, true);
                    var    frame     = st.GetFrame(0);
                    var    line      = frame.GetFileLineNumber();
                    string ErrorInfo = "Unbekannter Fehler, sende ihn bitte an Armin um ihn zu beheben. Fehler:  " + e.Message + "  Line: " + line + " in " + frame + "              Der Fehler wurde in Deine Zwischenablage gespeichert.";
                    Clipboard.SetText(ErrorInfo);
                    ModernWpf.MessageBox.Show("Ein unbekannter Fehler ist aufgetreten, möglicherweise haben wir Teschnische Schwierigkeiten, Du wirst nun zu dem Download weitergeleitet (wenn die Versionsnummern gleich sind dann warte bis zum nächsten Update), da die neuste Version dieses Problem höchstwahrscheinlich beheben wird. Damit dies nicht wieder vorkommt sende den Fehler (er wurde in Deine Zwischenablage gespeichert) an folgende Email-Adresse: [email protected]. Secret Chat® wird nun automatisch beendet. Fehler:  " + e.Message + ". Der Fehler wurde in Deine Zwischenablage gespeichert.");
                    Process.Start("https://github.com/SagMeinenNamen/SecretChat/raw/main/SecretChat.exe");
                    Process.Start("https://github.com/SagMeinenNamen/SecretChat/blob/main/SecretChat.exe");
                    Environment.Exit(0);
                }
            }
            if (upToDate == false)
            {
                if (!File.Exists(SecretChatPath + latestVer + "\\SecretChat.exe"))
                {
                    UpdateInfoEventArgs args = new UpdateInfoEventArgs
                    {
                        DownloadURL    = "https://github.com/SagMeinenNamen/SecretChat/raw/main/SecretChat.exe",
                        CurrentVersion = latestVer
                    };
                    Version version = new Version(currentVersion);
                    args.InstalledVersion = version;
                    try
                    {
                        AutoUpdater.ShowSkipButton        = false;
                        AutoUpdater.RunUpdateAsAdmin      = false;
                        AutoUpdater.ShowRemindLaterButton = false;
                        AutoUpdater.DownloadPath          = SecretChatPath + latestVer;
                        AutoUpdater.AppTitle   = "Secret Chat";
                        AutoUpdater.Mandatory  = true;
                        AutoUpdater.UpdateMode = Mode.ForcedDownload;
                        AutoUpdater.DownloadUpdate(args);
                        //if (System.IO.File.Exists(SecretChatPath + "SecretChat.exe"))
                        //{
                        //    try
                        //    {
                        //        System.IO.File.Delete(SecretChatPath + "SecretChat.exe");
                        //    }
                        //    catch
                        //    {

                        //    }
                        //}
                        //System.IO.File.Move(path3, SecretChatPath + "SecretChat" + latestVer + ".exe");
                        //var startInfo = SecretChatPath + "SecretChat" + latestVer + ".exe";
                        //Process.Start(startInfo, "restart");
                        Process.GetCurrentProcess().Kill();
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show("Ein Fehler ist während der Installation aufgetreten: " + e.Message + Environment.NewLine + "Du wirst nun zum manuellen download weitergeleitet.");
                        //ModernWpf.MessageBox.Show("Du brauchst die neuste Version von Secret Chat. Du wirst nun automatisch zum download weitergeleitet. Installiere sie und führe sie aus um Secret Chat wie gewohnt weiter zu verwenden. In Updates sind meistens Fehlerkorrekturen, neue Funktionen oder neue Designs verfügbar!");
                        Process.Start("https://github.com/SagMeinenNamen/SecretChat/raw/main/SecretChat.exe");
                        Process.Start("https://github.com/SagMeinenNamen/SecretChat/blob/main/SecretChat.exe");
                        Thread.Sleep(1000);
                        Environment.Exit(0);
                    }
                }
                else
                {
                    var startInfo = SecretChatPath + latestVer + "\\SecretChat.exe";
                    Process.Start(startInfo, "restart");
                    Environment.Exit(0);
                }
            }
        }
Esempio n. 21
0
        private void AutoUpdaterOnCheckForUpdateEvent(UpdateInfoEventArgs args)
        {
            if (args.Error == null)
            {
                if (args.IsUpdateAvailable)
                {
                    _args = args;
                    MessageBoxResult dialogResult = MessageBoxResult.No;
                    if (args.Mandatory.Value)
                    {
                        dialogResult =
                            MessageBox.Show(
                                $@"There is new version {args.CurrentVersion} available. You are using version {args.InstalledVersion}. This is required update. Press Ok to begin updating the application.", @"Update Available",
                                MessageBoxButton.OK,
                                MessageBoxImage.Information);
                    }
                    //else
                    //{
                    //    dialogResult =
                    //        MessageBox.Show(
                    //            $@"There is new version {args.CurrentVersion} available. You are using version {
                    //                    args.InstalledVersion
                    //                }. Do you want to update the application now?", @"Update Available",
                    //            MessageBoxButton.YesNo,
                    //            MessageBoxImage.Information);
                    //}

                    // Uncomment the following line if you want to show standard update dialog instead.
                    // AutoUpdater.ShowUpdateForm(args);

                    if (dialogResult.Equals(MessageBoxResult.Yes) || dialogResult.Equals(MessageBoxResult.OK))
                    {
                        try
                        {
                            if (AutoUpdater.DownloadUpdate(args))
                            {
                                Environment.Exit(-1);
                            }
                        }
                        catch (Exception exception)
                        {
                            MessageBox.Show(exception.Message, exception.GetType().ToString(), MessageBoxButton.OK,
                                            MessageBoxImage.Error);
                        }
                    }
                    else if (dialogResult.Equals(MessageBoxResult.No) || dialogResult.Equals(MessageBoxResult.None))
                    {
                        try
                        {
                            Task.Factory.StartNew(() => AutoUpdater.DownloadSilently(args));
                        }
                        catch (Exception exception)
                        {
                            MessageBox.Show(exception.Message, exception.GetType().ToString(), MessageBoxButton.OK,
                                            MessageBoxImage.Error);
                        }
                    }
                }
                else
                {
                    MessageBox.Show(@"There is no update available please try again later.", @"No update available",
                                    MessageBoxButton.OK, MessageBoxImage.Information);
                }
                //oSignalEvent.Set();
            }
            else
            {
                if (args.Error is System.Net.WebException)
                {
                    MessageBox.Show(
                        @"There is a problem reaching update server. Please check your internet connection and try again later.",
                        @"Update Check Failed", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else
                {
                    MessageBox.Show(args.Error.Message,
                                    args.Error.GetType().ToString(), MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                }
                //oSignalEvent.Set();
            }
        }
Esempio n. 22
0
        private static void AutoUpdaterOnCheckForUpdateEvent(UpdateInfoEventArgs args)
        {
            if (args.Error == null)
            {
                if (args.IsUpdateAvailable)
                {
                    firstTry = false;
                    DialogResult dialogResult;
                    if (args.Mandatory.Value)
                    {
                        dialogResult =
                            MessageBox.Show(
                                $@"There is new version {args.CurrentVersion} available. You are using version {args.InstalledVersion}. This is required update. Press Ok to begin updating the application.", @"Update Available",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                    }
                    else
                    {
                        dialogResult =
                            MessageBox.Show(
                                $@"There is new version {args.CurrentVersion} available. You are using version {
                                        args.InstalledVersion
                                    }. Do you want to update the application now?", @"Update Available",
                                MessageBoxButtons.YesNo,
                                MessageBoxIcon.Information);
                    }

                    // Uncomment the following line if you want to show standard update dialog instead.
                    // AutoUpdater.ShowUpdateForm(args);

                    if (dialogResult.Equals(DialogResult.Yes) || dialogResult.Equals(DialogResult.OK))
                    {
                        try
                        {
                            if (AutoUpdater.DownloadUpdate(args))
                            {
                                Application.Exit();
                            }
                        }
                        catch (Exception exception)
                        {
                            MessageBox.Show(exception.Message, exception.GetType().ToString(), MessageBoxButtons.OK,
                                            MessageBoxIcon.Error);
                        }
                    }
                }
                else
                {
                    if (!firstTry)
                    {
                        MessageBox.Show(@"There is no update available please try again later.", @"No update available", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    firstTry = false;
                }
            }
            else
            {
                if (args.Error is WebException)
                {
                    MessageBox.Show(
                        @"There is a problem reaching update server. Please check your internet connection and try again later.",
                        @"Update Check Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    MessageBox.Show(args.Error.Message,
                                    args.Error.GetType().ToString(), MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 23
0
        private void AutoUpdaterOnCheckForUpdateEvent(UpdateInfoEventArgs args)
        {
            if (args != null)
            {
                if (args.IsUpdateAvailable)
                {
                    DialogResult dialogResult;
                    if (args.Mandatory)
                    {
                        dialogResult =
                            MessageBox.Show(
                                $@"There is new version {args.CurrentVersion} available. You are using version {
                                        args.InstalledVersion
                                    }. This is required update. Press Ok to begin updating the application.",
                                @"Update Available",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                    }
                    else
                    {
                        dialogResult =
                            MessageBox.Show(
                                $@"There is new version {args.CurrentVersion} available. You are using version {
                                        args.InstalledVersion
                                    }. Do you want to update the application now?", @"Update Available",
                                MessageBoxButtons.YesNo,
                                MessageBoxIcon.Information);
                    }


                    if (dialogResult.Equals(DialogResult.Yes) || dialogResult.Equals(DialogResult.OK))
                    {
                        try
                        {
                            //You can use Download Update dialog used by AutoUpdater.NET to download the update.

                            if (AutoUpdater.DownloadUpdate())
                            {
                                Application.Exit();
                            }
                        }
                        catch (Exception exception)
                        {
                            MessageBox.Show(exception.Message, exception.GetType().ToString(), MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                        }
                    }
                }
                else
                {
                    MessageBox.Show(@"There is no update available. Please try again later.", @"Update Unavailable",
                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show(
                    @"There is a problem reaching update server. Please check your internet connection and try again later.",
                    @"Update Check Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 24
0
 private void OnUpdateClicked(object sender, RoutedEventArgs e)
 {
     AutoUpdater.DownloadUpdate();
 }