Esempio n. 1
0
 public void TryAddNotification(Kbtter4Notification nt)
 {
     Query.ClearVariables();
     Query.SetVariable("Notification", nt);
     if (Query.Execute().AsBoolean()) Notifications.Insert(0, nt);
     if (Notifications.Count > Setting.Timelines.HomeNotificationTimelineMax) Notifications.RemoveAt(Notifications.Count - 1);
 }
Esempio n. 2
0
 public NotificationViewModel(Kbtter4Notification nt, MainWindowViewModel mw)
 {
     var ins = Kbtter.Instance;
     switch (nt.Kind)
     {
         case Kbtter4NotificationKind.Favorited:
             SourceUser = new UserViewModel(nt.SourceEvent.Source, mw);
             Message = string.Format("ツイートが{0}さんのお気に入りに登録されました", SourceUser.Name);
             IconKind = Kbtter4NotificationIconKind.Favorited;
             Description = nt.SourceEvent.TargetStatus.Text;
             break;
         case Kbtter4NotificationKind.Unfavorited:
             SourceUser = new UserViewModel(nt.SourceEvent.Source, mw);
             Message = string.Format("ツイートが{0}さんのお気に入りから削除されました", SourceUser.Name);
             IconKind = Kbtter4NotificationIconKind.Unfavorited;
             Description = nt.SourceEvent.TargetStatus.Text;
             break;
         case Kbtter4NotificationKind.Followed:
             SourceUser = new UserViewModel(nt.SourceEvent.Source, mw);
             Message = string.Format("{0}さんにフォローされました", SourceUser.Name);
             IconKind = Kbtter4NotificationIconKind.Followed;
             Description = nt.SourceEvent.Source.Description;
             break;
         case Kbtter4NotificationKind.Unfollowed:
             SourceUser = new UserViewModel(nt.SourceEvent.Source, mw);
             Message = string.Format("{0}さんにリムーブされました", SourceUser.Name);
             IconKind = Kbtter4NotificationIconKind.Unfollowed;
             Description = nt.SourceEvent.Source.Description;
             break;
         case Kbtter4NotificationKind.Retweeted:
             SourceUser = new UserViewModel(nt.SourceStatus.Status.User, mw);
             if (nt.SourceStatus.Status.Text.Contains(ins.AuthenticatedUser.ScreenName) &&
                 nt.SourceStatus.Status.RetweetedStatus.User.Id != ins.AuthenticatedUser.Id)
             {
                 Message = string.Format("リツイートが{0}さんにリツイートされました", SourceUser.Name);
             }
             else
             {
                 Message = string.Format("ツイートが{0}さんにリツイートされました", SourceUser.Name);
             }
             IconKind = Kbtter4NotificationIconKind.Retweeted;
             Description = nt.SourceStatus.Status.RetweetedStatus.Text;
             break;
         case Kbtter4NotificationKind.ListAdded:
             SourceUser = new UserViewModel(nt.SourceEvent.Source, mw);
             Message = string.Format("{0}さんのリスト {1} に登録されました", SourceUser.Name, nt.SourceEvent.TargetList.Name);
             IconKind = Kbtter4NotificationIconKind.ListAdded;
             Description = nt.SourceEvent.TargetList.Description;
             break;
         case Kbtter4NotificationKind.ListRemoved:
             SourceUser = new UserViewModel(nt.SourceEvent.Source, mw);
             Message = string.Format("{0}さんのリスト {1} から外されました", SourceUser.Name, nt.SourceEvent.TargetList.Name);
             IconKind = Kbtter4NotificationIconKind.ListRemoved;
             Description = nt.SourceEvent.TargetList.Description;
             break;
         case Kbtter4NotificationKind.Blocked:
             SourceUser = new UserViewModel(nt.SourceEvent.Source, mw);
             Message = string.Format("{0}さんにブロックされました", SourceUser.Name);
             IconKind = Kbtter4NotificationIconKind.Blocked;
             Description = nt.SourceEvent.Source.Description;
             break;
     }
 }