private void Button_Click(object sender, RoutedEventArgs e)
        {
            GameBoardWindow gameBoardWindow = new GameBoardWindow();

            gameBoardWindow.Client = Client;
            gameBoardWindow.Mode   = GameMode.Mode.Alone;
            GameParams gameParams = null;

            if (BegginerCheckBox.IsChecked == true)
            {
                gameParams = new GameParams(8, 8, 10);
            }
            else if (IntermediateCheckBox.IsChecked == true)
            {
                gameParams = new GameParams(16, 16, 40);
            }
            else if (ExpertCheckBox.IsChecked == true)
            {
                gameParams = new GameParams(16, 30, 99);
            }

            else if (CustomCheckBox.IsChecked == true)
            {
                int height = 0, width = 0, bombs = 0;
                try
                {
                    int.TryParse(CustomHeight.Text, out height);
                    int.TryParse(CustomWidth.Text, out width);
                    int.TryParse(CustomBombs.Text, out bombs);

                    if (height < 1 || height > 100 || width < 1 || width > 100 ||
                        (height * width) / 3 < bombs)
                    {
                        MessageBox.Show("Input is not valid",
                                        "Error occurred!", MessageBoxButton.OK, MessageBoxImage.Error);
                        return;
                    }

                    gameParams = new GameParams(height, width, bombs);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Oops!", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }

            else
            {
                return;
            }
            gameBoardWindow.GameParams = gameParams;
            gameBoardWindow.CallBack   = CallBack;
            gameBoardWindow.ShowDialog();
            this.Close();
        }
        private void RequestAccepted(LiveMatch match)
        {
            GameBoardWindow gameBoardWindow = new GameBoardWindow();

            gameBoardWindow.Mode       = GameMode.Mode.Online;
            gameBoardWindow.Match      = match;
            gameBoardWindow.GameParams = match.GameParams;
            gameBoardWindow.Client     = Client;
            gameBoardWindow.UserName   = UserName;
            gameBoardWindow.Type       = PlayerType.Home;
            gameBoardWindow.CallBack   = CallBack;
            this.Close();
            gameBoardWindow.Show();
        }
        private void AcceptButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Client.AcceptInvitation(SenderName, Username, GameParams);
            }
            catch (FaultException <UserFaultException> ex)
            {
                MessageBox.Show(ex.Detail.Message, "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            LiveMatch       match           = Client.GetSameGridAsOpponent(SenderName, Username);
            GameBoardWindow gameBoardWindow = new GameBoardWindow();

            gameBoardWindow.Mode       = GameMode.Mode.Online;
            gameBoardWindow.Match      = match;
            gameBoardWindow.GameParams = match.GameParams;
            gameBoardWindow.Client     = Client;
            gameBoardWindow.UserName   = Username;
            gameBoardWindow.CallBack   = CallBack;
            gameBoardWindow.Type       = PlayerType.Away;
            this.Close();
            gameBoardWindow.Show();
        }