OSDN Git Service

525a99fa3a6c14bebb489f3fa3c5238aa3039073
[opentween/open-tween.git] / OpenTween / Models / MentionsTabModel.cs
1 // OpenTween - Client of Twitter
2 // Copyright (c) 2007-2011 kiri_feather (@kiri_feather) <kiri.feather@gmail.com>
3 //           (c) 2008-2011 Moz (@syo68k)
4 //           (c) 2008-2011 takeshik (@takeshik) <http://www.takeshik.org/>
5 //           (c) 2010-2011 anis774 (@anis774) <http://d.hatena.ne.jp/anis774/>
6 //           (c) 2010-2011 fantasticswallow (@f_swallow) <http://twitter.com/f_swallow>
7 //           (c) 2011      Egtra (@egtra) <http://dev.activebasic.com/egtra/>
8 //           (c) 2012      kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
9 // All rights reserved.
10 //
11 // This file is part of OpenTween.
12 //
13 // This program is free software; you can redistribute it and/or modify it
14 // under the terms of the GNU General Public License as published by the Free
15 // Software Foundation; either version 3 of the License, or (at your option)
16 // any later version.
17 //
18 // This program is distributed in the hope that it will be useful, but
19 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 // for more details.
22 //
23 // You should have received a copy of the GNU General Public License along
24 // with this program. If not, see <http://www.gnu.org/licenses/>, or write to
25 // the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
26 // Boston, MA 02110-1301, USA.
27
28 using System;
29 using System.Collections.Generic;
30 using System.Linq;
31 using System.Text;
32 using System.Threading.Tasks;
33
34 namespace OpenTween.Models
35 {
36     public class MentionsTabModel : FilterTabModel
37     {
38         public override MyCommon.TabUsageType TabType
39             => MyCommon.TabUsageType.Mentions;
40
41         public MentionsTabModel() : this(MyCommon.DEFAULTTAB.REPLY)
42         {
43         }
44
45         public MentionsTabModel(string tabName) : base(tabName)
46         {
47         }
48
49         public override async Task RefreshAsync(Twitter tw, bool backward, bool startup, IProgress<string> progress)
50         {
51             bool read;
52             if (!SettingCommon.Instance.UnreadManage)
53                 read = true;
54             else
55                 read = startup && SettingCommon.Instance.Read;
56
57             progress.Report(string.Format(Properties.Resources.GetTimelineWorker_RunWorkerCompletedText4, backward ? -1 : 1));
58
59             await tw.GetTimelineApi(read, MyCommon.WORKERTYPE.Reply, backward, startup)
60                 .ConfigureAwait(false);
61
62             TabInformations.GetInstance().DistributePosts();
63
64             progress.Report(Properties.Resources.GetTimelineWorker_RunWorkerCompletedText9);
65         }
66     }
67 }