private void startPregamePhase(pregamePhaseState obj)
        {
            //close Connection
            m_clientSocket.Close();
            m_clientSocket = null;

            pregamePhase pregamePhaseWindow = new pregamePhase(obj.ip, obj.port);
            pregamePhaseWindow.Show();
            this.Close();
        }
        private bool parse(string szData)
        {
            Console.WriteLine(szData);
            string[] stringSeparators = new string[] { DELIMITER };
            String[] commands = szData.Split(stringSeparators, StringSplitOptions.RemoveEmptyEntries);

            foreach (String command in commands)
            {
                String[] args = command.Split(' ');

                switch (args[0])
                {
                    case "CONFIRM":

                        switch(waitForCommit) {
                            case "":
                                Console.WriteLine("Unexpected COMMIT");
                                break;
                            case "JOIN":
                                Console.WriteLine("Waiting for other Player");

                                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal,
                                                    new Action<string>(SetStatus),
                                                    "Waiting for other Player");
                                break;
                        }

                        waitForCommit = "";
                        break;

                    case "EXIT_GAME":
                        MessageBox.Show("Server ended the game","ERROR");
                        this.Close();
                        break;

                    case "STARTGAME":

                        //Start PregamePhase
                        int newport = Convert.ToInt32(args[1]);
                        pregamePhaseState phs = new pregamePhaseState(ipAddress, newport);

                        Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal,
                        new Action<pregamePhaseState>(startPregamePhase),
                        phs);

                        return false;
                        break;

                    default:
                        Console.WriteLine("Unknow command received: " + args[0]);
                        break;

                }
            }

            return true;
        }