Settings for update-checking
Exemplo n.º 1
0
        internal async Task UpdateVersionIfAvailable(UpdateCheckSettings updateCheckSettings)
        {
            if (CheckWithUpdateFrequency(updateCheckSettings.UpdateCheckFrequency) && NetworkInterface.GetIsNetworkAvailable())
            {
                Exception thrownException = null;
                try
                {
                    var currentVersion = new Version(HockeyClient.Current.AsInternal().VersionInfo);
                    var appVersions    = await HockeyClient.Current.AsInternal().GetAppVersionsAsync();

                    var newestAvailableAppVersion = appVersions.FirstOrDefault();

                    if (appVersions.Any() &&
                        new Version(newestAvailableAppVersion.Version) > currentVersion &&
                        (updateCheckSettings.CustomDoShowUpdateFunc == null || updateCheckSettings.CustomDoShowUpdateFunc(newestAvailableAppVersion)))
                    {
                        if (updateCheckSettings.UpdateMode.Equals(UpdateMode.InApp) || (updateCheckSettings.EnforceUpdateIfMandatory && newestAvailableAppVersion.Mandatory))
                        {
                            NavigateToUpdatePage(currentVersion, appVersions, updateCheckSettings);
                        }
                        else
                        {
                            ShowUpdateNotification(currentVersion, appVersions, updateCheckSettings);
                        }
                    }
                    else
                    {
                        if (updateCheckSettings.UpdateMode.Equals(UpdateMode.InApp))
                        {
                            await(new MessageDialog(LocalizedStrings.LocalizedResources.NoUpdateAvailable).ShowAsync());
                        }
                    }
                }
                catch (Exception e)
                {
                    thrownException = e;
                    HockeyClient.Current.AsInternal().HandleInternalUnhandledException(e);
                }
                //Don't show errors durgin update-check on startup
                if (thrownException != null && updateCheckSettings.UpdateMode.Equals(UpdateMode.InApp))
                {
                    await CoreWindow.GetForCurrentThread().Dispatcher.RunAsync(CoreDispatcherPriority.Low, async() =>
                    {
                        await new MessageDialog(LocalizedStrings.LocalizedResources.UpdateUnknownError).ShowAsync();
                    });
                }
            }
        }
Exemplo n.º 2
0
        internal void UpdateVersionIfAvailable(UpdateCheckSettings updateCheckSettings)
        {
            //TODO manual mode and no network => show message
            if (CheckWithUpdateFrequency(updateCheckSettings.UpdateCheckFrequency) && NetworkInterface.GetIsNetworkAvailable())
            {
                var task = HockeyClient.Current.AsInternal().GetAppVersionsAsync();
                task.ContinueWith((finishedTask) =>
                {
                    if (finishedTask.Exception == null)
                    {
                        var appVersions = finishedTask.Result;
                        var newestAvailableAppVersion = appVersions.FirstOrDefault();

                        var currentVersion = new Version(ManifestHelper.GetAppVersion());
                        if (appVersions.Any() &&
                            new Version(newestAvailableAppVersion.Version) > currentVersion &&
                            (updateCheckSettings.CustomDoShowUpdateFunc == null || updateCheckSettings.CustomDoShowUpdateFunc(newestAvailableAppVersion)))
                        {
                            if (updateCheckSettings.UpdateMode.Equals(UpdateMode.InApp) || (updateCheckSettings.EnforceUpdateIfMandatory && newestAvailableAppVersion.Mandatory))
                            {
                                ShowVersionPopup(currentVersion, appVersions, updateCheckSettings);
                            }
                            else
                            {
                                ShowUpdateNotification(currentVersion, appVersions, updateCheckSettings);
                            }
                        }
                        else
                        {
                            if (updateCheckSettings.UpdateMode.Equals(UpdateMode.InApp))
                            {
                                Scheduler.Dispatcher.Schedule(() => MessageBox.Show(LocalizedStrings.LocalizedResources.NoUpdateAvailable));
                            }
                        }
                    }
                    else
                    {
                        HockeyClient.Current.AsInternal().HandleInternalUnhandledException(finishedTask.Exception);
                    }
                });
            }
        }
Exemplo n.º 3
0
 protected void ShowVersionPopup(Version currentVersion, IEnumerable<IAppVersion> appVersions, UpdateCheckSettings updateCheckSettings)
 {
     Scheduler.Dispatcher.Schedule(() =>
     {
         UpdatePopupTool.ShowPopup(currentVersion, appVersions, updateCheckSettings, DoUpdate);
     });
 }
Exemplo n.º 4
0
 protected void ShowUpdateNotification(Version currentVersion, IEnumerable<IAppVersion> appVersions, UpdateCheckSettings updateCheckSettings)
 {
     Scheduler.Dispatcher.Schedule(() =>
     {
         NotificationTool.Show(
             LocalizedStrings.LocalizedResources.UpdateNotification,
             LocalizedStrings.LocalizedResources.UpdateAvailable,
             new NotificationAction(LocalizedStrings.LocalizedResources.Show, (Action) (() =>
             {
                 ShowVersionPopup(currentVersion, appVersions, updateCheckSettings);
             })),
             new NotificationAction(LocalizedStrings.LocalizedResources.Dismiss, (Action) (() =>
             {
                 //DO nothing
             }))
         );
     });
 }
Exemplo n.º 5
0
        internal void UpdateVersionIfAvailable(UpdateCheckSettings updateCheckSettings)
        {
            //TODO manual mode and no network => show message
            if (CheckWithUpdateFrequency(updateCheckSettings.UpdateCheckFrequency) && NetworkInterface.GetIsNetworkAvailable())
            {
                var task = HockeyClient.Current.AsInternal().GetAppVersionsAsync();
                task.ContinueWith((finishedTask) =>
                {
                    if (finishedTask.Exception == null)
                    {
                        var appVersions = finishedTask.Result;
                        var newestAvailableAppVersion = appVersions.FirstOrDefault();

                        var currentVersion = new Version(ManifestHelper.GetAppVersion());
                        if (appVersions.Any()
                            && new Version(newestAvailableAppVersion.Version) > currentVersion
                            && (updateCheckSettings.CustomDoShowUpdateFunc == null || updateCheckSettings.CustomDoShowUpdateFunc(newestAvailableAppVersion)))
                        {
                            if (updateCheckSettings.UpdateMode.Equals(UpdateMode.InApp) || (updateCheckSettings.EnforceUpdateIfMandatory && newestAvailableAppVersion.Mandatory))
                            {
                                ShowVersionPopup(currentVersion, appVersions, updateCheckSettings);
                            }
                            else
                            {
                                ShowUpdateNotification(currentVersion, appVersions, updateCheckSettings);
                            }
                        }
                        else
                        {
                            if (updateCheckSettings.UpdateMode.Equals(UpdateMode.InApp))
                            {
                                Scheduler.Dispatcher.Schedule(() => MessageBox.Show(LocalizedStrings.LocalizedResources.NoUpdateAvailable));
                            }
                        }
                    }
                    else
                    {
                        HockeyClient.Current.AsInternal().HandleInternalUnhandledException(finishedTask.Exception);
                    }
                });
            }
        }
Exemplo n.º 6
0
 public static void RunUpdateCheck(string identifier, UpdateCheckSettings settings = null)
 {
     Instance.UpdateVersionIfAvailable(settings ?? UpdateCheckSettings.DefaultStartupSettings);
 }
Exemplo n.º 7
0
 protected void ShowVersionPopup(Version currentVersion, IEnumerable <IAppVersion> appVersions, UpdateCheckSettings updateCheckSettings)
 {
     Scheduler.Dispatcher.Schedule(() =>
     {
         UpdatePopupTool.ShowPopup(currentVersion, appVersions, updateCheckSettings, DoUpdate);
     });
 }
Exemplo n.º 8
0
 internal async Task UpdateVersionIfAvailable(UpdateCheckSettings updateCheckSettings)
 {
     if (CheckWithUpdateFrequency(updateCheckSettings.UpdateCheckFrequency) && NetworkInterface.GetIsNetworkAvailable())
     {
         Exception thrownException = null;
         try
         {
             var currentVersion = new Version(HockeyClient.Current.AsInternal().VersionInfo);
             var appVersions = await HockeyClient.Current.AsInternal().GetAppVersionsAsync();
             var newestAvailableAppVersion = appVersions.FirstOrDefault();
             
             if (appVersions.Any()
                 && new Version(newestAvailableAppVersion.Version) > currentVersion
                 && (updateCheckSettings.CustomDoShowUpdateFunc == null || updateCheckSettings.CustomDoShowUpdateFunc(newestAvailableAppVersion)))
             {
                 if (updateCheckSettings.UpdateMode.Equals(UpdateMode.InApp) || (updateCheckSettings.EnforceUpdateIfMandatory && newestAvailableAppVersion.Mandatory))
                 {
                     NavigateToUpdatePage(currentVersion, appVersions, updateCheckSettings);
                 }
                 else
                 {
                     ShowUpdateNotification(currentVersion, appVersions, updateCheckSettings);
                 }
             }
             else
             {
                 if (updateCheckSettings.UpdateMode.Equals(UpdateMode.InApp))
                 {
                     await (new MessageDialog(LocalizedStrings.LocalizedResources.NoUpdateAvailable).ShowAsync());
                 }
             }
         }
         catch (Exception e)
         {
             thrownException = e;
             HockeyClient.Current.AsInternal().HandleInternalUnhandledException(e);
         }
         //Don't show errors durgin update-check on startup
         if (thrownException != null && updateCheckSettings.UpdateMode.Equals(UpdateMode.InApp))
         {
             await CoreWindow.GetForCurrentThread().Dispatcher.RunAsync(CoreDispatcherPriority.Low, async () =>
             {
                 await new MessageDialog(LocalizedStrings.LocalizedResources.UpdateUnknownError).ShowAsync();
             });
         }
     }
 }
Exemplo n.º 9
0
 internal void NavigateToUpdatePage(Version currentVersion, IEnumerable<IAppVersion> appVersions, UpdateCheckSettings updateCheckSettings)
 {
     var rootFrame = Window.Current.Content as Frame;
     dynamic parms = new DynamicNavigationParameters();
     parms.currentVersion = currentVersion;
     parms.appVersions = appVersions;
     parms.updateCheckSettings = updateCheckSettings;
     
     rootFrame.Navigate(typeof(UpdatePage), parms);
 }
 /// <summary>
 /// Call this method during startup of your app to check for Updates.
 /// </summary>
 /// <param name="this"></param>
 /// <param name="updateSettings">Settings to define context for Update checking. </param>
 /// <returns></returns>
 public static async Task CheckForAppUpdateAsync(this IHockeyClient @this, UpdateCheckSettings updateSettings = null)
 {
     HockeyClient.Current.AsInternal().CheckForInitialization();
     await UpdateManager.Current.RunUpdateCheckAsync(updateSettings).ConfigureAwait(false);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Check for an update on the server
 /// HockecCient needs to be configured before calling this method (normally done by configuring a crahshandler in the App() constructor)
 /// </summary>
 /// <param name="settings">[optional] custom settings</param>
 internal async Task RunUpdateCheckAsync(UpdateCheckSettings settings = null)
 {
     await UpdateVersionIfAvailable(settings ?? UpdateCheckSettings.DefaultStartupSettings);
 }
 /// <summary>
 /// Check for available updates
 /// </summary>
 /// <param name="this"></param>
 /// <param name="settings"><see cref="UpdateCheckSettings"/></param>
 public static void CheckForUpdates(this IHockeyClient @this, UpdateCheckSettings settings = null)
 {
     @this.AsInternal().CheckForInitialization();
     UpdateManager.Instance.RunUpdateCheck(settings);
 }
Exemplo n.º 13
0
        protected async void ShowUpdateNotification(Version currentVersion, IEnumerable <IAppVersion> appVersions, UpdateCheckSettings updateCheckSettings)
        {
            var dialog = new MessageDialog(LocalizedStrings.LocalizedResources.UpdateAvailable, LocalizedStrings.LocalizedResources.UpdateNotification);

            dialog.Commands.Add(new UICommand(LocalizedStrings.LocalizedResources.Show, null, true));
            dialog.Commands.Add(new UICommand(LocalizedStrings.LocalizedResources.Dismiss, null, false));

            await CoreWindow.GetForCurrentThread().Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() => {
                var result = await dialog.ShowAsync();
                if ((bool)result.Id)
                {
                    NavigateToUpdatePage(currentVersion, appVersions, updateCheckSettings);
                }
            });
        }
Exemplo n.º 14
0
        internal void NavigateToUpdatePage(Version currentVersion, IEnumerable <IAppVersion> appVersions, UpdateCheckSettings updateCheckSettings)
        {
            var     rootFrame = Window.Current.Content as Frame;
            dynamic parms     = new DynamicNavigationParameters();

            parms.currentVersion      = currentVersion;
            parms.appVersions         = appVersions;
            parms.updateCheckSettings = updateCheckSettings;

            rootFrame.Navigate(typeof(UpdatePage), parms);
        }
Exemplo n.º 15
0
 /// <summary>
 /// Check for an update on the server
 /// HockecCient needs to be configured before calling this method (normally done by configuring a crahshandler in the App() constructor)
 /// </summary>
 /// <param name="settings">[optional] custom settings</param>
 public void RunUpdateCheck(UpdateCheckSettings settings = null)
 {
     UpdateVersionIfAvailable(settings ?? UpdateCheckSettings.DefaultStartupSettings);
 }
Exemplo n.º 16
0
        protected async void ShowUpdateNotification(Version currentVersion, IEnumerable<IAppVersion> appVersions, UpdateCheckSettings updateCheckSettings)
        {
            var dialog = new MessageDialog(LocalizedStrings.LocalizedResources.UpdateAvailable, LocalizedStrings.LocalizedResources.UpdateNotification);

            dialog.Commands.Add(new UICommand(LocalizedStrings.LocalizedResources.Show, null, true));
            dialog.Commands.Add(new UICommand(LocalizedStrings.LocalizedResources.Dismiss, null, false));

            await CoreWindow.GetForCurrentThread().Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () => {
                var result = await dialog.ShowAsync();
                if ((bool)result.Id)
                {
                    NavigateToUpdatePage(currentVersion, appVersions, updateCheckSettings);
                }
            });
        }
Exemplo n.º 17
0
 public static void RunUpdateCheck(string identifier, UpdateCheckSettings settings = null)
 {
     Instance.UpdateVersionIfAvailable(settings ?? UpdateCheckSettings.DefaultStartupSettings);
 }
Exemplo n.º 18
0
 /// <summary>
 /// Call this method during startup of your app to check for Updates.
 /// </summary>
 /// <param name="this"></param>
 /// <param name="updateSettings">Settings to define context for Update checking. </param>
 /// <returns></returns>
 public static async Task CheckForAppUpdateAsync(this IHockeyClient @this, UpdateCheckSettings updateSettings = null)
 {
     HockeyClient.Current.AsInternal().CheckForInitialization();
     await UpdateManager.Current.RunUpdateCheckAsync(updateSettings).ConfigureAwait(false);
 }
Exemplo n.º 19
0
 protected void ShowUpdateNotification(Version currentVersion, IEnumerable <IAppVersion> appVersions, UpdateCheckSettings updateCheckSettings)
 {
     Scheduler.Dispatcher.Schedule(() =>
     {
         NotificationTool.Show(
             LocalizedStrings.LocalizedResources.UpdateNotification,
             LocalizedStrings.LocalizedResources.UpdateAvailable,
             new NotificationAction(LocalizedStrings.LocalizedResources.Show, (Action)(() =>
         {
             ShowVersionPopup(currentVersion, appVersions, updateCheckSettings);
         })),
             new NotificationAction(LocalizedStrings.LocalizedResources.Dismiss, (Action)(() =>
         {
             //DO nothing
         }))
             );
     });
 }
Exemplo n.º 20
0
 /// <summary>
 /// Check for an update on the server
 /// HockecCient needs to be configured before calling this method (normally done by configuring a crahshandler in the App() constructor)
 /// </summary>
 /// <param name="settings">[optional] custom settings</param>
 public void RunUpdateCheck(UpdateCheckSettings settings = null)
 {
     UpdateVersionIfAvailable(settings ?? UpdateCheckSettings.DefaultStartupSettings);
 }
 /// <summary>
 /// Check for available updates
 /// </summary>
 /// <param name="this"></param>
 /// <param name="settings"><see cref="UpdateCheckSettings"/></param>
 public static void CheckForUpdates(this IHockeyClient @this, UpdateCheckSettings settings = null)
 {
     @this.AsInternal().CheckForInitialization();
     UpdateManager.Instance.RunUpdateCheck(settings);
 }
Exemplo n.º 22
0
 /// <summary>
 /// Check for an update on the server
 /// HockecCient needs to be configured before calling this method (normally done by configuring a crahshandler in the App() constructor)
 /// </summary>
 /// <param name="settings">[optional] custom settings</param>
 internal async Task RunUpdateCheckAsync(UpdateCheckSettings settings = null)
 {
     await UpdateVersionIfAvailable(settings ?? UpdateCheckSettings.DefaultStartupSettings);
 }