Exemplo n.º 1
0
        public void AddMainMenuCategory(MainMenuCategory mainMenuCategory, bool createButton = true)
        {
            if (settingsDrawer == null || mainMenuCategory == null)
            {
                return;
            }

            var optionsCount = mainMenuCategory.Options.Count;

            string key;
            string value;

            for (var i = 0; i < optionsCount; i++)
            {
                var option = mainMenuCategory.Options[i];
                key   = mainMenuCategory.Name + ".item" + (i + 1) + "id";
                value = option.Name;

                settingsDrawer.ini.elements.Add(key, value);
            }

            if (mainMenuCategory.WithBackOption)
            {
                key   = mainMenuCategory.Name + ".item" + (optionsCount + 1) + "id";
                value = "MM_Back";
                settingsDrawer.ini.elements.Add(key, value);
            }

            for (var i = 0; i < optionsCount; i++)
            {
                var option = mainMenuCategory.Options[i];
                key   = mainMenuCategory.Name + ".item" + (i + 1) + "option";
                value = option.URL;

                settingsDrawer.ini.elements.Add(key, value);
            }

            if (mainMenuCategory.WithBackOption)
            {
                key   = mainMenuCategory.Name + ".item" + (optionsCount + 1) + "url";
                value = "ExitFromSettings";
                settingsDrawer.ini.elements.Add(key, value);
            }

            mainMenuCategories.Add(mainMenuCategory);
            if (createButton)
            {
                CreateButton(mainMenuCategory.Name);
            }
        }