private void CheckandSetupBehaviours() { if (!(this.DataContext as TweetListViewModel).ShowContentVisibility) return; if ((this.DataContext as TweetListViewModel).TitleBarVisible) { if (this.unreadmarker == null) { this.unreadmarker = new UnreadMarkerListBoxBehavior(); this.unreadmarker.ViewModel = this.DataContext as TweetListViewModel; } if (!Interaction.GetBehaviors((DependencyObject) this.tweets).Contains((Behavior) this.unreadmarker)) Interaction.GetBehaviors((DependencyObject) this.tweets).Add((Behavior) this.unreadmarker); } if (this.scrollposition == null) this.scrollposition = new KeepTopScrollerBehavior(); if (!Interaction.GetBehaviors((DependencyObject) this).Contains((Behavior) this.scrollposition)) Interaction.GetBehaviors((DependencyObject) this).Add((Behavior) this.scrollposition); if (this.animatedtweetlistbox == null) this.animatedtweetlistbox = new AnimatedTweetListBox(); if (!Interaction.GetBehaviors((DependencyObject) this).Contains((Behavior) this.animatedtweetlistbox)) Interaction.GetBehaviors((DependencyObject) this).Add((Behavior) this.animatedtweetlistbox); }
private void UserControl_Unloaded(object sender, RoutedEventArgs e) { TweetListViewModel tweetListViewModel = this.DataContext as TweetListViewModel; tweetListViewModel.PropertyChanged -= new PropertyChangedEventHandler(this.TweetListView_PropertyChanged); if (!tweetListViewModel.IsTransitioningToPinned) { tweetListViewModel.Cleanup(); tweetListViewModel.IsTransitioningToPinned = false; } if (!(SettingsData.Instance.PopupTarget is Button)) SettingsData.Instance.PopupTarget = (UIElement) null; SettingsData.Instance.SelectedColumn = (UIElement) null; SettingsData.Instance.DialogActiveControl = (FrameworkElement) null; if (this.unreadmarker != null) Interaction.GetBehaviors((DependencyObject) this.tweets).Remove((Behavior) this.unreadmarker); if (this.scrollposition != null) Interaction.GetBehaviors((DependencyObject) this).Remove((Behavior) this.scrollposition); if (this.animatedtweetlistbox != null) Interaction.GetBehaviors((DependencyObject) this).Remove((Behavior) this.animatedtweetlistbox); this.unreadmarker = (UnreadMarkerListBoxBehavior) null; this.scrollposition = (KeepTopScrollerBehavior) null; this.animatedtweetlistbox = (AnimatedTweetListBox) null; }
private void RemoveBehaviours() { if (this.unreadmarker != null) Interaction.GetBehaviors((DependencyObject) this.tweets).Remove((Behavior) this.unreadmarker); if (this.scrollposition != null) Interaction.GetBehaviors((DependencyObject) this).Remove((Behavior) this.scrollposition); if (this.animatedtweetlistbox != null) Interaction.GetBehaviors((DependencyObject) this).Remove((Behavior) this.animatedtweetlistbox); this.unreadmarker = (UnreadMarkerListBoxBehavior) null; this.scrollposition = (KeepTopScrollerBehavior) null; this.animatedtweetlistbox = (AnimatedTweetListBox) null; }
private void TweetListView_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "ShowContentVisibility" && (this.DataContext as TweetListViewModel).ShowContentVisibility) { if ((this.DataContext as TweetListViewModel).TitleBarVisible) { this.unreadmarker = new UnreadMarkerListBoxBehavior(); if (this.unreadmarker != null) Interaction.GetBehaviors((DependencyObject) this.tweets).Add((Behavior) this.unreadmarker); } this.scrollposition = new KeepTopScrollerBehavior(); if (this.scrollposition != null) Interaction.GetBehaviors((DependencyObject) this).Add((Behavior) this.scrollposition); this.animatedtweetlistbox = new AnimatedTweetListBox(); if (this.animatedtweetlistbox != null) Interaction.GetBehaviors((DependencyObject) this).Add((Behavior) this.animatedtweetlistbox); } if (!(e.PropertyName == "CurrentTweetID") || (this.unreadmarker == null || !(this.DataContext as TweetListViewModel).TitleBarVisible)) return; this.unreadmarker.SetMarker(); }