public static void GenerateGroupMenu(ItemCollection itemsRoot, PlayniteSettings settings)
        {
            var dontGroupItem = MainMenu.AddMenuChild(itemsRoot, GroupableField.None.GetDescription(), null);

            dontGroupItem.IsCheckable = true;
            MenuHelpers.SetEnumBinding(dontGroupItem, nameof(settings.ViewSettings.GroupingOrder), settings.ViewSettings, GroupableField.None);
            itemsRoot.Add(new Separator());
            MenuHelpers.PopulateEnumOptions <GroupableField>(itemsRoot, nameof(settings.ViewSettings.GroupingOrder), settings.ViewSettings, true,
                                                             new List <GroupableField> {
                GroupableField.None
            });
        }
Exemple #2
0
        public void InitializeItems()
        {
            if (settings == null)
            {
                return;
            }

            Items.Clear();

            // Sort By
            var sortItem = new MenuItem
            {
                Header = ResourceProvider.GetString("LOCMenuSortByTitle")
            };

            MenuHelpers.PopulateEnumOptions <SortOrderDirection>(sortItem.Items, nameof(settings.ViewSettings.SortingOrderDirection), settings.ViewSettings);
            sortItem.Items.Add(new Separator());
            MenuHelpers.PopulateEnumOptions <SortOrder>(sortItem.Items, nameof(settings.ViewSettings.SortingOrder), settings.ViewSettings, true);

            // Group By
            var groupItem = new MenuItem
            {
                Header = ResourceProvider.GetString("LOCMenuGroupByTitle")
            };

            var dontGroupItem = MainMenu.AddMenuChild(groupItem.Items, GroupableField.None.GetDescription(), null);

            dontGroupItem.IsCheckable = true;
            MenuHelpers.SetEnumBinding(dontGroupItem, nameof(settings.ViewSettings.GroupingOrder), settings.ViewSettings, GroupableField.None);
            groupItem.Items.Add(new Separator());
            MenuHelpers.PopulateEnumOptions <GroupableField>(groupItem.Items, nameof(settings.ViewSettings.GroupingOrder), settings.ViewSettings, true,
                                                             new List <GroupableField> {
                GroupableField.None
            });

            Items.Add(sortItem);
            Items.Add(groupItem);
            Items.Add(new Separator());

            // View Type
            MenuHelpers.PopulateEnumOptions <ViewType>(Items, nameof(settings.ViewSettings.GamesViewType), settings.ViewSettings);
            Items.Add(new Separator());

            // View
            var filterItem = MainMenu.AddMenuChild(Items, "LOCMenuViewFilterPanel", null);

            filterItem.IsCheckable = true;
            BindingOperations.SetBinding(filterItem, MenuItem.IsCheckedProperty,
                                         new Binding
            {
                Source = settings,
                Path   = new PropertyPath(nameof(PlayniteSettings.FilterPanelVisible))
            });

            var explorerItem = MainMenu.AddMenuChild(Items, "LOCMenuViewExplorerPanel", null);

            explorerItem.IsCheckable = true;
            BindingOperations.SetBinding(explorerItem, MenuItem.IsCheckedProperty,
                                         new Binding
            {
                Source = settings,
                Path   = new PropertyPath(nameof(PlayniteSettings.ExplorerPanelVisible))
            });
        }
Exemple #3
0
        public void InitializeItems()
        {
            // Add Game
            var addGameItem = AddMenuChild(Items, "LOCMenuAddGame", null, null, "AddGameIcon");

            AddMenuChild(addGameItem.Items, "LOCMenuAddGameManual", mainModel.AddCustomGameCommand);
            AddMenuChild(addGameItem.Items, "LOCMenuAddGameInstalled", mainModel.AddInstalledGamesCommand);
            AddMenuChild(addGameItem.Items, "LOCMenuAddGameEmulated", mainModel.AddEmulatedGamesCommand);
            if (Computer.WindowsVersion == WindowsVersion.Win10)
            {
                AddMenuChild(addGameItem.Items, "LOCMenuAddWindowsStore", mainModel.AddWindowsStoreGamesCommand);
            }

            Items.Add(new Separator());

            // Library
            var libraryItem = AddMenuChild(Items, "LOCLibrary", null);

            AddMenuChild(libraryItem.Items, "LOCMenuConfigureIntegrations", mainModel.OpenLibraryIntegrationsConfigCommand);
            AddMenuChild(libraryItem.Items, "LOCMenuLibraryManagerTitle", mainModel.OpenDbFieldsManagerCommand);
            AddMenuChild(libraryItem.Items, "LOCMenuConfigureEmulatorsMenuTitle", mainModel.OpenEmulatorsCommand);
            AddMenuChild(libraryItem.Items, "LOCMenuDownloadMetadata", mainModel.DownloadMetadataCommand);
            AddMenuChild(libraryItem.Items, "LOCMenuSoftwareTools", mainModel.OpenSoftwareToolsCommand);

            // Update Library
            var updateItem = AddMenuChild(Items, "LOCMenuReloadLibrary", null, null, "UpdateDbIcon");

            AddMenuChild(updateItem.Items, "LOCUpdateAll", mainModel.UpdateGamesCommand);
            updateItem.Items.Add(new Separator());
            foreach (var plugin in mainModel.Extensions.LibraryPlugins)
            {
                var item = new MenuItem
                {
                    Header           = plugin.Name,
                    Command          = mainModel.UpdateLibraryCommand,
                    CommandParameter = plugin
                };

                updateItem.Items.Add(item);
            }

            // Random game select
            AddMenuChild(Items, "LOCMenuSelectRandomGame", mainModel.SelectRandomGameCommand, null, "DiceIcon");

            // Settings
            AddMenuChild(Items, "LOCMenuPlayniteSettingsTitle", mainModel.OpenSettingsCommand, null, "SettingsIcon");

            // View
            var viewItem          = AddMenuChild(Items, LOC.MenuView, null, null, null);
            var sideBarItem       = AddMenuChild(viewItem.Items, LOC.Sidebar, null, null, null);
            var sideBarEnableItem = AddMenuChild(sideBarItem.Items, LOC.EnabledTitle, null);

            sideBarEnableItem.IsCheckable = true;
            BindingOperations.SetBinding(sideBarEnableItem, MenuItem.IsCheckedProperty,
                                         new Binding
            {
                Source = mainModel.AppSettings,
                Path   = new PropertyPath(nameof(PlayniteSettings.SidebarVisible))
            });

            sideBarItem.Items.Add(new Separator());
            MenuHelpers.PopulateEnumOptions <Dock>(sideBarItem.Items, nameof(PlayniteSettings.SidebarPosition), mainModel.AppSettings);
            viewItem.Items.Add(new Separator());

            var librarySideItem = MainMenu.AddMenuChild(viewItem.Items, LOC.Library, null);

            librarySideItem.IsCheckable = true;
            MenuHelpers.SetEnumBinding(librarySideItem, nameof(mainModel.AppSettings.CurrentApplicationView), mainModel.AppSettings, ApplicationView.Library);

            var statsSideItem = MainMenu.AddMenuChild(viewItem.Items, LOC.Statistics, null);

            statsSideItem.IsCheckable = true;
            MenuHelpers.SetEnumBinding(statsSideItem, nameof(mainModel.AppSettings.CurrentApplicationView), mainModel.AppSettings, ApplicationView.Statistics);

            Items.Add(new Separator());

            // Open Client
            var openClientItem = AddMenuChild(Items, "LOCMenuClients", null);

            foreach (var tool in mainModel.ThirdPartyTools)
            {
                var item = new MenuItem
                {
                    Header           = tool.Name,
                    Command          = mainModel.ThirdPartyToolOpenCommand,
                    CommandParameter = tool,
                    Icon             = tool.Icon
                };

                openClientItem.Items.Add(item);
            }

            // Tools
            toolsItem = AddMenuChild(Items, "LOCMenuTools", null);

            // Extensions
            extensionsItem = AddMenuChild(Items, "LOCExtensions", null);

            // FullScreen
            extensionsEndItem = new Separator();
            Items.Add(extensionsEndItem);
            AddMenuChild(Items, "LOCMenuOpenFullscreen", mainModel.OpenFullScreenCommand, null, "FullscreenModeIcon");
            Items.Add(new Separator());

            // Links
            var linksItem = AddMenuChild(Items, "LOCMenuLinksTitle", null);

            AddMenuChild(linksItem.Items, "LOCCommonLinksForum", GlobalCommands.NavigateUrlCommand, UrlConstants.Forum, "Images/applogo.png");
            AddMenuChild(linksItem.Items, "Discord", GlobalCommands.NavigateUrlCommand, UrlConstants.Discord, "Images/discord.png");
            AddMenuChild(linksItem.Items, "Twitter", GlobalCommands.NavigateUrlCommand, UrlConstants.Twitter, "Images/twitter.png");
            AddMenuChild(linksItem.Items, "Reddit", GlobalCommands.NavigateUrlCommand, UrlConstants.Reddit, "Images/reddit.png");

            // Help
            var helpItem = AddMenuChild(Items, "LOCMenuHelpTitle", null);

            AddMenuChild(helpItem.Items, "Wiki / FAQ", GlobalCommands.NavigateUrlCommand, UrlConstants.Wiki);
            AddMenuChild(helpItem.Items, "LOCMenuIssues", mainModel.ReportIssueCommand);
            AddMenuChild(helpItem.Items, "LOCSDKDocumentation", GlobalCommands.NavigateUrlCommand, UrlConstants.SdkDocs);
            helpItem.Items.Add(new Separator());
            AddMenuChild(helpItem.Items, "LOCCrashRestartSafe", mainModel.RestartInSafeMode);
            AddMenuChild(helpItem.Items, "LOCCheckForUpdates", mainModel.CheckForUpdateCommand);

            // Patreon
            AddMenuChild(Items, "LOCMenuPatreonSupport", GlobalCommands.NavigateUrlCommand, UrlConstants.Patreon, "Images/patreon.png");

            // About
            AddMenuChild(Items, "LOCMenuAbout", mainModel.OpenAboutCommand, null, "AboutPlayniteIcon");
            Items.Add(new Separator());

            // Exit
            AddMenuChild(Items, "LOCExitAppLabel", mainModel.ShutdownCommand, null, "ExitIcon");
        }