Exemple #1
0
 void OpenSession(IConnectionSettings connectionSettings)
 {
     if (currentSession != null)
     {
         CloseSession();
     }
     try
     {
         Utility.CopyConnectionSettings(connectionSettings, _connectionSettings);
         currentSession = new TelnetSession(connectionSettings.ConnectionAddress, connectionSettings.Port);
         currentSession.BlockReceived        += blockReceivedHandler;
         currentSession.SessionStatusChanged += sessionStatusHandler;
         this.UpdateUILayout();
     }
     catch (Exception exc)
     {
         if (_connectionSettings.TerminalType == TerminalType.CharacterBuffer)
         {
             AppendText(exc.Message + "\r\n");
             MoveCursorToEnd();
         }
         else
         {
             terminalBuffer.Write(exc.Message + "\r\n");
             ShowTerminalBuffer();
         }
         this.currentSession = null;
     }
 }