public void AddMenu(ToggleButtonMenuViewModel panel)
        {
            //AppModel.EventAggregator.Publish(new SoundPlayMessage(SoundPlayType.MenuSlideOut));

            if (!Menus.Contains(panel))
            {
                if (panel.MenuParent == MainMenu)
                {
                    Menus.Apply(x => x.ControlIsVisible = false);
                    Menus.Clear();
                    Menus.Add(panel);
                }
                else
                {
                    BindableCollection<ToggleButtonMenuViewModel> newMenus = new BindableCollection<ToggleButtonMenuViewModel>(Menus);
                    bool foundParent = false;
                    foreach (ToggleButtonMenuViewModel menu in newMenus)
                    {
                        if ((foundParent |= menu == panel.MenuParent) && menu != panel.MenuParent)
                        {
                            menu.ControlIsVisible = false;
                            Menus.Remove(menu);
                        }
                    }

                    Menus.Add(panel);
                }

                panel.ControlIsVisible = true;

                foreach (OptionButtonViewModel button in panel.Buttons)
                {
                    button.IsOptionChecked = false;
                }

                Popup = null;
            }
        }
        public MainMenuViewModel()
        {
            AppModel.ResetAppModel();

            Menus = new BindableCollection<ToggleButtonMenuViewModel>();
            MainMenu = new ToggleButtonMenuViewModel() {
                Buttons  = new BindableCollection<OptionButtonViewModel> {
                    new OptionButtonViewModel { ClickAction = () => AddMenu(NewGameMenu), Title = "New Game" },
                    new OptionButtonViewModel { ClickAction = () => AddMenu(HelpMenu), Title = "Help" },
                    new OptionButtonViewModel { ClickAction = () => AddMenu(SettingsMenu), Title = "Option" },
                    new OptionButtonViewModel { ClickAction = () => AddMenu(CreditsMenu), Title = "Credits" },
                    new OptionButtonViewModel { ClickAction = () => AppModel.AppViewModel.TryClose(), Title = "Exit" },
                },
                Background = AppModel.Resources["Primary1"] as SolidColorBrush,
                Title = "Main Menu",
            };

            MainMenu.ControlIsVisible = true;
          
        }