コード例 #1
0
        private void btnBrowse_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new FolderBrowserDialog {
                Description = "Select the directory containing PCSX2",
            };

            if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            var flag = false;
            var str  = string.Empty;

            foreach (var str2 in Directory.GetFiles(dialog.SelectedPath, "*.exe").Where(str2 => (Extensions.Contains(str2, "pcsx2-r", StringComparison.InvariantCultureIgnoreCase) && !Extensions.Contains(str2, "Uninst", StringComparison.InvariantCultureIgnoreCase)) || Path.GetFileName(str2).Equals("pcsx2.exe", StringComparison.InvariantCultureIgnoreCase)))
            {
                flag = true;
                str  = str2;
                break;
            }
            if (!flag)
            {
                Legacy.Tools.ShowMessage("PCSX2 executable could not be found!", Legacy.MessageType.Error);
            }
            else
            {
                Settings.Default.pcsx2Exe = str;
                tbPcsx2Dir.Text           = dialog.SelectedPath;
                tbPcsx2DataDir.Text       = dialog.SelectedPath;
            }
        }
コード例 #2
0
        private void Filter(object sender, EventArgs e)
        {
            _t.Stop();
            if (lvGames.IsVisible == false)
            {
                return;
            }
            var query       = tbSearch.Text;
            var defaultView = CollectionViewSource.GetDefaultView(Legacy.Game.AllGames);

            if (Extensions.IsEmpty(query) || query == "Search")
            {
                defaultView.Filter = null;
            }
            else
            {
                defaultView.Filter = (Predicate <object>)Delegate.Combine(defaultView.Filter, (Predicate <object>)(o => Extensions.Contains(((Legacy.Game)o).Title, query, StringComparison.InvariantCultureIgnoreCase)));
                ((ScrollViewer)Legacy.Tools.GetDescendantByType(lvGames, typeof(ScrollViewer))).ScrollToVerticalOffset(0.0);
            }
        }