Пример #1
0
        /// <summary>
        /// Update the Notification label
        /// </summary>
        /// <param name="args"></param>
        /// <param name="forInit"></param>
        /// <returns></returns>
        private async Task UpdateNotifications(NotificationsChecker.UpdateArgs args, bool forInit)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("Notifications");

            if (args.TotalUnread > 0)
            {
                sb.Append(" (" + args.TotalUnread + ")");
                NotificationsWeight = FontWeights.Bold;


                lock (feed_lock)
                {
                    if (currentFeedType == FeedType.Notifications)
                    {
                        LoadNotifications();
                    }
                }
            }
            else
            {
                NotificationsWeight = FontWeights.Normal;
            }

            NotificationsLabel = sb.ToString();

            if (forInit)
            {
                return;
            }

            string msg;

            if (args.Error != null)
            {
                msg = args.Error.Message;

                if (args.Error is InvalidCredentialsException)
                {
                    await Login();

                    nchecker.Check();
                }
            }
            else
            {
                msg = string.Format("Found {0} new notifications", args.TotalUnread);
            }

            UpdateStatus(msg);
        }
Пример #2
0
 /// <summary>
 /// Update the Notification label
 /// </summary>
 /// <param name="args"></param>
 private async void UpdateNotifications(NotificationsChecker.UpdateArgs args)
 {
     await UpdateNotifications(args, false);
 }