Ejemplo n.º 1
0
        internal async void InitAllList()
        {
#pragma warning disable CS4014 // 由于此调用不会等待,因此在调用完成前将继续执行当前方法
            GetUnreadCount();
            Timeline.Refresh();
            if (Settings.IsMergeMentionAndComment)
            {
                MergeMessage.Refresh();
            }
            else
            {
                Mention.Refresh();
                Comment.Refresh();
                CommentMention.Refresh();
            }
            Favor.Refresh();
            Message.Refresh();
#pragma warning restore CS4014 // 由于此调用不会等待,因此在调用完成前将继续执行当前方法
            try
            {
                (await Core.Api.Friendships.Groups.GetGroups()).Lists.ForEach(item => Groups.Add(item));
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Groups)));
            }
            catch (Exception ex) when(ex is WebException || ex is HttpRequestException || ex is TaskCanceledException || ex is NullReferenceException)
            {
            }
        }
Ejemplo n.º 2
0
        public async void RefreshWithoutGetUnreadCount()
        {
            if (Settings.IsMergeMentionAndComment)
            {
                switch (Header.FindIndex(item => item.IsActive))
                {
                case 0:
                    await Timeline.Refresh();

                    break;

                case 1:
                    await MergeMessage.Refresh();

                    Header[1].UnreadCount = 0;
                    break;

                case 2:
                    await Favor.Refresh();

                    Header[2].UnreadCount = 0;
                    break;

                case 3:
                    await Message.Refresh();

                    Header[3].UnreadCount = 0;
                    break;

                default:
                    break;
                }
            }
            else
            {
                switch (Header.FindIndex(item => item.IsActive))
                {
                case 0:
                    await Timeline.Refresh();

                    break;

                case 1:
                    await Mention.Refresh();

                    Header[1].UnreadCount = 0;
                    break;

                case 2:
                    await Comment.Refresh();

                    Header[2].UnreadCount = 0;
                    break;

                case 3:
                    await CommentMention.Refresh();

                    Header[3].UnreadCount = 0;
                    break;

                case 4:
                    await Favor.Refresh();

                    break;

                case 5:
                    await Message.Refresh();

                    Header[5].UnreadCount = 0;
                    break;

                default:
                    break;
                }
            }
            UpdateUnreadHelper.Count = Header.Sum(item => item.UnreadCount);
        }