Exemple #1
0
 public static Task RefreshAsync(Action callback)
 {
     return(Task.Run(() =>
     {
         RemoteVersionInfoGetter getter = new RemoteVersionInfoGetter();
         try
         {
             Result = getter.GetSync();
             callback?.Invoke();
         }
         catch (Exception e)
         {
             SLogger.Warn(nameof(Updater), "cannot refresh update informations", e);
         }
     }));
 }
Exemple #2
0
        public static void DoAsk(RemoteVersionInfoGetter.Result result)
        {
            GrowlInfo gInfo = new GrowlInfo
            {
                WaitTime          = int.MaxValue,
                ConfirmStr        = App.Current.Resources["Update.UpdateNow"].ToString(),
                CancelStr         = App.Current.Resources["Update.Cancel"].ToString(),
                Message           = $"{App.Current.Resources["Update.HaveAUpdate"]}  v{result.Version}\n{result.Message}",
                Token             = MainWindowBus.TOKEN_PANEL_MAIN,
                ActionBeforeClose = (isConfirmed) =>
                {
                    if (isConfirmed)
                    {
                        try { Process.Start(result.UpdateUrl); } catch { }
                    }
                    return(true);
                }
            };

            Growl.Ask(gInfo);
        }