Example #1
0
        public object Put(UpdateBadge request)
        {
            var entity = request.ConvertTo <Badge>();

            return(InTransaction(db => {
                Logic.Update(entity);
                return new CommonResponse(Logic.GetById(entity.Id));
            }));
        }
Example #2
0
 public void InitializeUpdater()
 {
     try
     {
         Task task = Task.Run(async() =>
         {
             GlobalVars.Loggi.Information("Start Task and check for new update every 5 minutes");
             while (true)
             {
                 using (var manager = new UpdateManager(new GithubPackageResolver(GlobalVars.GitHubUsername, GlobalVars.GitHubProjectName, GlobalVars.GitHubAssetName), new ZipPackageExtractor()))
                 {
                     var result = await manager.CheckForUpdatesAsync();
                     if (result.CanUpdate)
                     {
                         UpdateBadge.Invoke(new Action(() =>
                         {
                             if (this.UpdateBadge.Badge == null)
                             {
                                 this.UpdateBadge.Badge = new PackIconMaterial()
                                 {
                                     Kind = PackIconMaterialKind.Update
                                 };
                             }
                         }));
                     }
                     else
                     {
                         UpdateBadge.Invoke(new Action(() =>
                         {
                             this.UpdateBadge.Badge = null;
                         }));
                     }
                 }
                 await Task.Delay(300000, UpdateCheckCts.Token);
             }
         }, UpdateCheckCts.Token);
     }
     catch (Exception ex)
     {
         GlobalVars.Loggi.Error(ex, ex.Message);
     }
 }