Пример #1
0
        public async void RefreshFavorites()
        {
            ShowingFavorites.Clear();
            try
            {
                var s = await kbtter.Token.Favorites.ListAsync(screen_name => user.ScreenName, count => showst);

                favoc = s.Last().Id;
                favnc = s.First().Id;
                ShowOlderFavoritesCommand.RaiseCanExecuteChanged();
                ShowNewerFavoritesCommand.RaiseCanExecuteChanged();
                foreach (var i in s)
                {
                    ShowingFavorites.Add(StatusViewModelExtension.CreateStatusViewModel(mainw, i));
                }
            }
            catch (TwitterException e)
            {
                favoc = 0;
                favnc = 0;
                mainw.NotifyInformation(string.Format("ツイートの取得に失敗しました : {0}", e.Message));
            }
            catch
            {
                favoc = 0;
                favnc = 0;
            }
        }
Пример #2
0
 /// <summary>
 /// 自分へのリプ以外を渡すな
 /// </summary>
 /// <param name="msg">はい</param>
 /// <param name="mvm">MainWindowViewModel</param>
 public NotificationViewModel(Status msg, MainWindowViewModel mvm)
 {
     NotificationTime     = msg.CreatedAt.LocalDateTime.ToShortTimeString();
     UserImageUri         = msg.User.ProfileImageUrlHttps;
     IconUri              = new Uri("/Resources/reply.png", UriKind.Relative);
     Description          = String.Format("{0}さんからのリプライ・メンションがあります", msg.User.Name);
     IsReply              = true;
     ReplyStatusViewModel = StatusViewModelExtension.CreateStatusViewModel(mvm, msg);
     ContentText          = msg.Text;
 }
Пример #3
0
        private void OnStatus(object sender, PropertyChangedEventArgs e)
        {
            var st = kbtter.LatestStatus;

            Query.ClearVariables();
            Query.SetVariable("Status", st.Status);
            var ret = Query.Execute();

            if (ret)
            {
                main.NotifyInformation("合致");
                Statuses.Insert(0, StatusViewModelExtension.CreateStatusViewModel(main, st.Status));
            }
        }
Пример #4
0
        public async void ShowNewerStatuses()
        {
            ShowingStatuses.Clear();
            try
            {
                var s = await kbtter.Token.Statuses.UserTimelineAsync(screen_name => user.ScreenName, count => showst, since_id => stnc);

                stoc = s.Last().Id;
                stnc = s.First().Id;
                ShowOlderStatusesCommand.RaiseCanExecuteChanged();
                ShowNewerStatusesCommand.RaiseCanExecuteChanged();
                foreach (var i in s)
                {
                    ShowingStatuses.Add(StatusViewModelExtension.CreateStatusViewModel(mainw, i));
                }
            }
            catch (TwitterException e)
            {
                mainw.NotifyInformation(string.Format("ツイートの取得に失敗しました : {0}", e.Message));
            }
        }
Пример #5
0
        public void OnStatusUpdate(object sender, PropertyChangedEventArgs e)
        {
            var st = kbtter.LatestStatus.Status;

            TimelineStatuses.Insert(0, StatusViewModelExtension.CreateStatusViewModel(this, st));
            RaisePropertyChanged("StatusUpdate");
            if (st.RetweetedStatus != null)
            {
                if (st.RetweetedStatus.User.Id != kbtter.AuthenticatedUser.Id)
                {
                    return;
                }
                var vm = new NotificationViewModel(st);
                TimelineNotifications.Insert(0, vm);
                //if (EventUpdate != null) EventUpdate(this, vm);
                return;
            }
            if (st.Entities != null && st.Entities.UserMentions.Count(p => p.ScreenName == kbtter.AuthenticatedUser.ScreenName) != 0)
            {
                var vm = new NotificationViewModel(st, this);
                TimelineNotifications.Insert(0, vm);
                //if (EventUpdate != null) EventUpdate(this, vm);
            }
        }