Beispiel #1
0
        public bool OnEnter()
        {
            if (!this.focused)
            {
                return(false);
            }

            if (MainMenu.Visibility == Visibility.Visible)
            {
                if (mmItems.SelectedIndex == 0) // Entire Collection
                {
                    this.byEntireCollection = true;
                    fmItems.SelectedIndex   = 0;
                    ShowFilterMenu();
                }

                if (mmItems.SelectedIndex == 1) // Selected Platform/Playlist
                {
                    this.byEntireCollection = false;

                    if (_platform == null & _playlist == null)
                    {
                        var da = new DoubleAnimationUsingKeyFrames();
                        da.KeyFrames.Add(new EasingDoubleKeyFrame(0, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(0))));
                        da.KeyFrames.Add(new EasingDoubleKeyFrame(1, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(200))));
                        da.KeyFrames.Add(new EasingDoubleKeyFrame(1, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(800))));
                        da.KeyFrames.Add(new EasingDoubleKeyFrame(0, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(1000))));

                        var sb = new Storyboard();
                        sb.Duration = TimeSpan.FromMilliseconds(1000);
                        Storyboard.SetTarget(da, mmError);
                        Storyboard.SetTargetProperty(da, new PropertyPath(OpacityProperty));
                        sb.Children.Add(da);
                        sb.Begin();
                    }
                    else
                    {
                        fmItems.SelectedIndex = 0;
                        ShowFilterMenu();
                    }
                }
                return(true);
            }

            if (FilterMenu.Visibility == Visibility.Visible)
            {
                if (fmItems.SelectedIndex == 0) // Choose from all
                {
                    this.byPlayMode = false;
                    this.byGenre    = false;

                    if (!this.byEntireCollection)
                    {
                        if (_platform != null)
                        {
                            PlatformNoPlaymodeRGS();
                        }

                        if (_playlist != null)
                        {
                            PlaylistNoPlaymodeRGS();
                        }
                    }
                    else
                    {
                        AllGamesNoPlaymodeRGS();
                    }
                }

                if (fmItems.SelectedIndex == 1) // Choose by genre
                {
                    this.byPlayMode = false;
                    this.byGenre    = true;

                    if (this.byEntireCollection)
                    {
                        ShowPlayModeMenu();
                        pmmItems.Items.Clear();
                        pmmTitle.Text = "Entire Collection by Genre";

                        IGame[] _allGames     = PluginHelper.DataManager.GetAllGames();
                        IGame[] _filteredList = Array.FindAll(_allGames, BrokenOrHidden);
                        foreach (IGame g in _filteredList) //this splits the genres and puts 1 entry for each in the listbox
                        {
                            char[] delimiterChars = { ';' };
                            foreach (string p in g.Genres)
                            {
                                p.Split(delimiterChars);
                                if (!pmmItems.Items.Contains(p))
                                {
                                    pmmItems.Items.Add(p);
                                }
                            }
                        }

                        pmmItems.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription("", System.ComponentModel.ListSortDirection.Ascending));
                        pmmItems.SelectedIndex = 0;
                    }
                    else
                    {
                        if (_platform != null)
                        {
                            ShowPlayModeMenu();
                            pmmItems.Items.Clear();
                            pmmTitle.Text = _platform.Name + " by Genre";

                            IGame[] _allGames = _platform.GetAllGames(false, false);
                            foreach (IGame g in _allGames) //this splits the genres and puts 1 entry for each in the listbox
                            {
                                char[] delimiterChars = { ';' };
                                foreach (string p in g.Genres)
                                {
                                    p.Split(delimiterChars);
                                    if (!pmmItems.Items.Contains(p))
                                    {
                                        pmmItems.Items.Add(p);
                                    }
                                }
                            }

                            pmmItems.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription("", System.ComponentModel.ListSortDirection.Ascending));
                            pmmItems.SelectedIndex = 0;
                        }

                        if (_playlist != null)
                        {
                            ShowPlayModeMenu();
                            pmmItems.Items.Clear();
                            pmmTitle.Text = _playlist.Name + " by Genre";

                            IGame[] _allGames     = _playlist.GetAllGames(false);
                            IGame[] _filteredList = Array.FindAll(_allGames, BrokenOrHidden);
                            foreach (IGame g in _filteredList) //this splits the genres and puts 1 entry for each in the listbox
                            {
                                char[] delimiterChars = { ';' };
                                foreach (string p in g.Genres)
                                {
                                    p.Split(delimiterChars);
                                    if (!pmmItems.Items.Contains(p))
                                    {
                                        pmmItems.Items.Add(p);
                                    }
                                }
                            }

                            pmmItems.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription("", System.ComponentModel.ListSortDirection.Ascending));
                            pmmItems.SelectedIndex = 0;
                        }
                    }
                }

                if (fmItems.SelectedIndex == 2) // Choose by play mode
                {
                    this.byPlayMode = true;
                    this.byGenre    = false;

                    if (this.byEntireCollection)
                    {
                        ShowPlayModeMenu();
                        pmmItems.Items.Clear();
                        pmmTitle.Text = "Entire Collection by Play Mode";

                        IGame[] _allGames     = PluginHelper.DataManager.GetAllGames();
                        IGame[] _filteredList = Array.FindAll(_allGames, BrokenOrHidden);
                        foreach (IGame g in _filteredList) //this splits the playmodes and puts 1 entry for each in the listbox
                        {
                            char[] delimiterChars = { ';' };
                            foreach (string p in g.PlayModes)
                            {
                                p.Split(delimiterChars);
                                if (!pmmItems.Items.Contains(p))
                                {
                                    pmmItems.Items.Add(p);
                                }
                            }
                        }

                        pmmItems.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription("", System.ComponentModel.ListSortDirection.Ascending));
                        pmmItems.SelectedIndex = 0;
                    }
                    else
                    {
                        if (_platform != null)
                        {
                            ShowPlayModeMenu();
                            pmmItems.Items.Clear();
                            pmmTitle.Text = _platform.Name + " by Play Mode";

                            IGame[] _allGames = _platform.GetAllGames(false, false);
                            foreach (IGame g in _allGames) //this splits the playmodes and puts 1 entry for each in the listbox
                            {
                                char[] delimiterChars = { ';' };
                                foreach (string p in g.PlayModes)
                                {
                                    p.Split(delimiterChars);
                                    if (!pmmItems.Items.Contains(p))
                                    {
                                        pmmItems.Items.Add(p);
                                    }
                                }
                            }

                            pmmItems.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription("", System.ComponentModel.ListSortDirection.Ascending));
                            pmmItems.SelectedIndex = 0;
                        }

                        if (_playlist != null)
                        {
                            ShowPlayModeMenu();
                            pmmItems.Items.Clear();
                            pmmTitle.Text = _playlist.Name + " by Play Mode";

                            IGame[] _allGames     = _playlist.GetAllGames(false);
                            IGame[] _filteredList = Array.FindAll(_allGames, BrokenOrHidden);
                            foreach (IGame g in _filteredList) //this splits the playmodes and puts 1 entry for each in the listbox
                            {
                                char[] delimiterChars = { ';' };
                                foreach (string p in g.PlayModes)
                                {
                                    p.Split(delimiterChars);
                                    if (!pmmItems.Items.Contains(p))
                                    {
                                        pmmItems.Items.Add(p);
                                    }
                                }
                            }

                            pmmItems.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription("", System.ComponentModel.ListSortDirection.Ascending));
                            pmmItems.SelectedIndex = 0;
                        }
                    }
                }
                return(true);
            }

            if (PlayModeMenu.Visibility == Visibility.Visible)
            {
                if (pmmItems.HasItems)
                {
                    if (!this.byEntireCollection)
                    {
                        if (this.byPlayMode)
                        {
                            _playmode = pmmItems.SelectedItem.ToString();

                            if (_platform != null)
                            {
                                PlatformPlaymodeRGS();
                            }
                            if (_playlist != null)
                            {
                                PlaylistPlaymodeRGS();
                            }
                        }
                        else if (this.byGenre)
                        {
                            _genre = pmmItems.SelectedItem.ToString();

                            if (_platform != null)
                            {
                                PlatformGenreRGS();
                            }
                            if (_playlist != null)
                            {
                                PlaylistGenreRGS();
                            }
                        }
                        else
                        {
                            if (_platform != null)
                            {
                                PlatformNoPlaymodeRGS();
                            }
                            if (_playlist != null)
                            {
                                PlaylistNoPlaymodeRGS();
                            }
                        }
                    }
                    else
                    {
                        if (this.byPlayMode)
                        {
                            _playmode = pmmItems.SelectedItem.ToString();

                            AllGamesPlaymodeRGS();
                        }
                        else if (this.byGenre)
                        {
                            _genre = pmmItems.SelectedItem.ToString();

                            AllGamesGenreRGS();
                        }
                        else
                        {
                            AllGamesNoPlaymodeRGS();
                        }
                    }
                }
                return(true);
            }

            if (GameDetailMenu.Visibility == Visibility.Visible)
            {
                if (gdmItems.SelectedIndex == 0) // Play this game
                {
                    if (_skipGameDetailsScreen == "true")
                    {
                        this.Visibility = Visibility.Hidden;
                        this.focused    = false;
                        _game.Play();
                    }
                    else
                    {
                        PluginHelper.BigBoxMainViewModel.ShowGame(_game, FilterType.PlatformOrCategoryOrPlaylist);
                        this.Visibility = Visibility.Hidden;
                        this.focused    = false;
                    }
                }
                else // Choose another game
                {
                    if (!this.byEntireCollection)
                    {
                        if (this.byPlayMode)
                        {
                            if (_platform != null)
                            {
                                PlatformPlaymodeRGS();
                            }
                            if (_playlist != null)
                            {
                                PlaylistPlaymodeRGS();
                            }
                        }
                        else if (this.byGenre)
                        {
                            if (_platform != null)
                            {
                                PlatformGenreRGS();
                            }
                            if (_playlist != null)
                            {
                                PlaylistGenreRGS();
                            }
                        }
                        else
                        {
                            if (_platform != null)
                            {
                                PlatformNoPlaymodeRGS();
                            }
                            if (_playlist != null)
                            {
                                PlaylistNoPlaymodeRGS();
                            }
                        }
                    }
                    else
                    {
                        if (this.byPlayMode)
                        {
                            AllGamesPlaymodeRGS();
                        }
                        else if (this.byGenre)
                        {
                            AllGamesGenreRGS();
                        }
                        else
                        {
                            AllGamesNoPlaymodeRGS();
                        }
                    }
                }
                return(true);
            }
            return(true);
        }