Beispiel #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;
     }
 }
Beispiel #2
0
 void CloseSession()
 {
     if (currentSession != null)
     {
         currentSession.BlockReceived -= blockReceivedHandler;
         currentSession.Dispose();
         currentSession = null;
     }
 }
Beispiel #3
0
        void CloseSession()
        {
            if(currentSession!=null)
            {

                currentSession.BlockReceived-=blockReceivedHandler;
                currentSession.Dispose();
                currentSession = null;

            }
        }
Beispiel #4
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;
            }
        }