示例#1
0
 private async Task<int> GetSelfossUnreadCount(SelfwinApp app)
 {
     var settings = app.Settings();
     var api = new SelfossApi(settings.SelfossOptions);
     var stats = (await api.Sources.Stats()).ToList();
     if (stats != null && stats.Any())
     {
         return stats.Sum(stat => stat.Unread);
     }
     return 0;
 }
示例#2
0
        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            var defer = taskInstance.GetDeferral();
            try
            {
                var app = new SelfwinApp();

                var status = await this.GetSelfossUnreadCount(app);

                if (status != 0)
                {
                    this.UpdateTileBadge(app, status);
                }
            }
            catch (Exception ex)
            {
                //TODO: report error to user.
            }
            finally
            {
                defer.Complete();
            }
        }
示例#3
0
 private void UpdateTileBadge(SelfwinApp app, int status)
 {
     app.UpdateTile(status);
 }