示例#1
0
 /// <summary>
 /// Creates a new instance of type UpdateCheckEventArgs.
 /// </summary>
 public UpdateCheckEventArgs(bool success, AppUpdate update, UpdateNotifyMode notifyMode, Exception ex = null)
 {
     Successful = success;
     Update     = update;
     if (update != null && ex == null)
     {
         NewVersion = new Version(update.Version) > new Version(AppInfo.Version);
     }
     UpdateNotifyMode     = notifyMode;
     UpdateCheckException = ex;
 }
示例#2
0
 /// <inheritdoc />
 public void CheckForUpdates(UpdateNotifyMode notifyMode = UpdateNotifyMode.NewUpdate)
 {
     Task.Run(() => getUpdateData(UpdateCheckUrl))
     .ContinueWith(async t =>
     {
         if (t.IsFaulted)
         {
             await OnUpdateCheckCompleted(
                 new UpdateCheckEventArgs(false, null, notifyMode, t.Exception.InnerException)
                 );
         }
         else if (t.IsCompleted)
         {
             await OnUpdateCheckCompleted(new UpdateCheckEventArgs(true, t.Result, notifyMode));
         }
     },
                   TaskScheduler.FromCurrentSynchronizationContext());
 }