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