Example #1
0
        /// <summary>
        ///     Checks to see if the program has updated and shows a dialog if so.
        /// </summary>
        /// <param name="dialogService">The dialog service to use for progress and result dialogs</param>
        /// <returns></returns>
        public static async void CheckChangelog(MetroDialogService dialogService)
        {
            var settings       = SettingsProvider.Load <GeneralSettings>();
            var currentVersion = Assembly.GetExecutingAssembly().GetName().Version;

            if ((settings.LastRanVersion != null) && (currentVersion > settings.LastRanVersion))
            {
                Logger.Info("Updated from {0} to {1}, showing changelog.", settings.LastRanVersion, currentVersion);

                // Ask the user whether he/she wants to see what's new
                var showChanges = await dialogService.
                                  ShowQuestionMessageBox("New version installed",
                                                         $"Artemis has recently updated from version {settings.LastRanVersion} to {currentVersion}. \n" +
                                                         "Would you like to see what's new?");

                // If user wants to see changelog, show it to them
                if ((showChanges != null) && showChanges.Value)
                {
                    await ShowChanges(dialogService, currentVersion);
                }
            }

            settings.LastRanVersion = currentVersion;
            settings.Save();
        }
Example #2
0
        public static async Task <Action> CheckForUpdate(MetroDialogService dialogService)
        {
            Logger.Info("Checking for updates - Current version: 1.1.3");
            if (!General.Default.CheckForUpdates)
            {
                return(null);
            }

            var newRelease = IsUpdateAvailable();

            if (newRelease == null)
            {
                Logger.Info("No update found.");
                return(null);
            }

            Logger.Info("Found new version - {0}.", newRelease["tag_name"].Value <string>());
            var viewUpdate = await
                             dialogService.ShowQuestionMessageBox("ApplyProperties available",
                                                                  $"A new version of Artemis is available, version {newRelease["tag_name"].Value<string>()}.\n" +
                                                                  "Do you wish to view the update on GitHub now?\n\n" +
                                                                  "Note: You can disable update notifications in the settings menu");

            if (viewUpdate.Value)
            {
                Process.Start(new ProcessStartInfo(newRelease["html_url"].Value <string>()));
            }

            return(null);
        }