Esempio n. 1
0
 private async Task CheckForUpdatesComplete(Task <string> task)
 {
     IsCheckInProgress = false;
     if (await task == null)
     {
         if (applicationUpdateService.IsNewVersionAvailable())
         {
             UpdateText = string.Format(CultureInfo.CurrentCulture, Resources.NewVersionAvailable,
                                        applicationUpdateService.GetNewAvailableVersion());
             IsLatestVersionAvailable = true;
         }
         else
         {
             UpdateText = string.Format(CultureInfo.CurrentCulture, Resources.ApplicationUpToDate);
         }
     }
     else
     {
         UpdateText = await task;
     }
 }
 private void CheckForUpdatesComplete(Task <string> task)
 {
     IsCheckInProgress = false;
     if (task.Result == null)
     {
         if (_applicationUpdateService.IsNewVersionAvailable())
         {
             UpdateText =
                 $"New version available for download : {_applicationUpdateService.GetNewAvailableVersion()}";
             IsLatestVersionAvailable = true;
         }
         else
         {
             UpdateText = "Your application is up to date.";
         }
     }
     else
     {
         UpdateText = task.Result;
     }
 }
Esempio n. 3
0
 private async Task CheckForUpdatesComplete(Task <string> task)
 {
     try
     {
         string updateText = await task;
         if (updateText != null || !_applicationUpdateService.IsNewVersionAvailable())
         {
             return;
         }
         updateText = string.Format(CultureInfo.CurrentCulture, Resources.NewVersionAvailable, _applicationUpdateService.GetNewAvailableVersion());
         string           url = _applicationUpdateService.GetDownloadUri().AbsoluteUri;
         MessageBoxResult ret = MessageBoxResult.No;
         if (updateText != null && url != null)
         {
             ret = MessageBox.Show($"{updateText}\n{Resources.DownloadNewVersion}", Resources.DownloadNewVersionTitle, MessageBoxButton.YesNo);
         }
         if (ret == MessageBoxResult.Yes)
         {
             Process.Start(new ProcessStartInfo(url));
         }
     }
     catch (Exception e)
     {
         Logger.Error("ModuleController.CheckForUpdatesComplete: {0}", e.ToString());
     }
 }
Esempio n. 4
0
 private async Task <bool> CheckForUpdatesComplete(Task <string> task)
 {
     try
     {
         string updateText = await task;
         if (updateText != null || !_applicationUpdateService.IsNewVersionAvailable())
         {
             return(false);
         }
         updateText = string.Format(CultureInfo.CurrentCulture, Resources.NewVersionAvailable, _applicationUpdateService.GetNewAvailableVersion());
         string url = _applicationUpdateService.GetDownloadUri().AbsoluteUri;
         if (updateText != null && url != null &&
             MessageService.ShowYesNoQuestion($"{updateText}\n{Resources.DownloadAndInstallNewVersion}", Resources.DownloadNewVersionTitle))
         {
             return(DownloadAndUnzipUpdatePackage(url));
         }
     }
     catch (Exception e)
     {
         Logger.Error("ModuleController.CheckForUpdatesComplete: {0}", e);
     }
     return(false);
 }