Ejemplo n.º 1
0
        private bool ensureValidConfiguration()
        {
            if (!m_ValidConfiguration)
            {
                while (true)
                {
                    FormLogin win = new FormLogin();
                    win.ShowDialog();

                    if (win.ClosedByStart)
                    {
                        try
                        {
                            m_BoardRows    = win.BoardHeight;
                            m_BoardColumns = win.BoardWidth;
                            m_Game.SetBoardSize(win.BoardHeight, win.BoardWidth);
                            m_Game.AddPlayer(win.FirstPlayerName);
                            m_Game.AddPlayer(win.SecondPlayerName);
                            m_ValidConfiguration = true;
                            break;
                        }
                        catch (ArgumentException ae)
                        {
                            MessageBox.Show(Messages.k_ArgumentExceptionNameLabelInLoginForm);
                        }
                    }
                    else
                    {
                        m_LoginFormClosedByX = true;
                        m_BoardRows          = win.BoardHeight;
                        m_BoardColumns       = win.BoardWidth;
                        m_Game.SetBoardSize(win.BoardHeight, win.BoardWidth);
                        m_Game.AddPlayer(" ");
                        m_Game.AddPlayer(" ");
                        break;
                    }
                }
            }

            return(m_ValidConfiguration);
        }