Exemplo n.º 1
0
        public static UIManageable GetForm(Views view)
        {
            UIManageable form = null;

            if (pool.ContainsKey(view))
            {
                form = pool[view];

                if (form.IsDisposed)
                {
                    pool.Remove(view);
                }
                else
                {
                    form = InitForm(form, view);
                    return(form);
                }
            }

            switch (view)
            {
            case Views.MainMenuForm:
            case Views.LoginForm:
            case Views.RegistrationForm:
            case Views.OptionsForm:
            case Views.ChatForm:
            case Views.UserInfoForm:
            case Views.ChooseGameForm:
            case Views.CreateGameForm:
            case Views.WaitingForPlayersForm:
            case Views.PauseForm:
            case Views.GameMenuForm:
                form = new MainMenuForm();
                form.Hide();
                InitMainMenu(form);
                break;

            case Views.GameForm:
                form = new GameForm();
                pool.Add(view, form);
                break;

            default:
                break;
            }
            return(form);
        }
 protected void HideForm()
 {
     _mainMenu.Hide();
 }