Example #1
0
        public void Init()
        {
            _Logger.LogDebug("////////////////////////////////////////////////////////");
            _Logger.LogDebug("////////////////////////////////////////////////////////");
            _Logger.LogDebug("////////////////////NEW SESSION/////////////////////////");
            _Logger.LogDebug("////////////////////////////////////////////////////////");
            _Logger.LogDebug("////////////////////////////////////////////////////////");

            try
            {
                //_Logger.LogDebug("Game client connecting...");
                _TcpClient = new TcpClient(Host, Port);
                //_Logger.LogDebug("Game client connected");

                //_Timer = new Timer(DEFAULT_TIMER_MS);
                //_Timer.Elapsed += new ElapsedEventHandler(_Timer_Elapsed);
                //_Timer.Start();
                //_Logger.LogDebug("Connection status is : " + ConnectionStatus.ToString());
                ConnectionStatus = GameConstants.ConnectionStatusEnum.Connected;
                //_Logger.LogDebug("Game client status is now " + ConnectionStatus.ToString());
            }
            catch (Exception ex)
            {
                _Logger.LogError("Error in GameClient.Init(): " + ex.ToString());
                throw new Exception("GameClient->Init failed to reach host "
                                    + Host + " on port " + Port + ". " + ex.Message, ex);
            }
        }
Example #2
0
 void _gameClient_ConnectionStatusChanged(GameConstants.ConnectionStatusEnum status)
 {
     ShowInfo("Connection status changed: " + status);
     if (_gameClient != null || _gameClient.ConnectionStatus != GameConstants.ConnectionStatusEnum.Connected)
     {
         btnConnect.IsEnabled = true;
     }
 }
Example #3
0
 public void Disconnect()
 {
     //if (_Timer != null)
     //{
     //    _Timer.Stop();
     //    _Timer = null;
     //}
     //_Logger.LogDebug("Game client disconnecting...");
     if (_TcpClient != null)
     {
         _TcpClient.Close();
         _TcpClient = null;
     }
     ConnectionStatus = GameConstants.ConnectionStatusEnum.Disconnected;
     //_Logger.LogDebug("Game client disconnected.");
 }
Example #4
0
 static void game_ConnectionStatusChanged(GameConstants.ConnectionStatusEnum status)
 {
     ReportConsoleAndLog("");
     ReportConsoleAndLog("Status changed. Status=" + status);
     ReportConsoleAndLog("");
 }