public void Initialize() { kbtter = Kbtter.Instance; listener = new PropertyChangedEventListener(kbtter); CompositeDisposable.Add(listener); RegisterHandlers(); kbtter.Initialize(); setting = Kbtter3Extension.LoadJson <Kbtter3Setting>(App.ConfigurationFileName); TimelineStatuses.CollectionChanged += (s, e) => { DispatcherHelper.UIDispatcher.BeginInvoke((Action)(() => { if (TimelineStatuses.Count > setting.MainWindow.StatusesShowMax) { TimelineStatuses.RemoveAt(setting.MainWindow.StatusesShowMax); } })); }; TimelineNotifications.CollectionChanged += (s, e) => { DispatcherHelper.UIDispatcher.BeginInvoke((Action)(() => { if (TimelineNotifications.Count > setting.MainWindow.NotificationsShowMax) { TimelineNotifications.RemoveAt(setting.MainWindow.NotificationsShowMax); } })); }; }
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); } }