private void wndFullScreen_Loaded(object sender, RoutedEventArgs e) { if (Settings.Default.enableGamepad) { this.AquireGamepad(); } string defaultSort = Settings.Default.defaultSort; if (defaultSort != null) { if (!(defaultSort == "Alphabetical")) { if (defaultSort == "Serial") { this.lbGames.Items.SortDescriptions.Add(new SortDescription("Serial", ListSortDirection.Ascending)); } else if (defaultSort == "Default") { } } else { this.lbGames.Items.SortDescriptions.Add(new SortDescription("Title", ListSortDirection.Ascending)); } } this._sv = (ScrollViewer)Tools.GetDescendantByType(this.lbGames, typeof(ScrollViewer)); this._timer.Interval = TimeSpan.FromMilliseconds(0.5); this._timer.Tick += new EventHandler(this._timer_Tick); this._timer.Start(); base.PreviewKeyDown += new KeyEventHandler(this.wndFullScreen_PreviewKeyDown); base.Closing += new CancelEventHandler(this.wndFullScreen_Closing); base.IsVisibleChanged += new DependencyPropertyChangedEventHandler(this.wndFullScreen_IsVisibleChanged); base.PreviewMouseDown += new MouseButtonEventHandler(this.wndFullScreen_PreviewMouseDown); this.itemHost.PreviewMouseMove += new MouseEventHandler(this.itemHost_PreviewMouseMove); }
private void wndFullScreen_PreviewMouseDown(object sender, MouseButtonEventArgs e) { if (e.RightButton == MouseButtonState.Pressed) { ScrollViewer descendantByType = (ScrollViewer)Tools.GetDescendantByType(this.lbGames, typeof(ScrollViewer)); if (descendantByType != null) { if (descendantByType.VerticalScrollBarVisibility == ScrollBarVisibility.Hidden) { descendantByType.VerticalScrollBarVisibility = ScrollBarVisibility.Visible; } else if (descendantByType.VerticalScrollBarVisibility == ScrollBarVisibility.Visible) { descendantByType.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden; } } } }
private void Filter(object sender, EventArgs e) { string query; this._t.Stop(); if (this.lvGames.IsVisible) { query = this.tbSearch.Text; ICollectionView defaultView = CollectionViewSource.GetDefaultView(Game.AllGames); if (query.IsEmpty() || (query == "Search")) { if (defaultView.Filter != null) { defaultView.Filter = null; } } else { defaultView.Filter = (Predicate <object>)Delegate.Combine(defaultView.Filter, o => ((Game)o).Title.Contains(query, StringComparison.InvariantCultureIgnoreCase)); ((ScrollViewer)Tools.GetDescendantByType(this.lvGames, typeof(ScrollViewer))).ScrollToVerticalOffset(0.0); } } }