/// <summary> /// This method should be called when an error occurs in the session. /// This is a no-op if the session has completed. 'ex' can be null if /// the session ended normally. /// </summary> public void HandleSessionTrouble(Exception ex) { if (Status == VncSessionStatus.Completed) { return; } // Determine whether we were starting the session. bool startFlag = (Status != VncSessionStatus.Started); // Convert the exception to an EAnp exception as needed. If we // failed to start, we always need an exception. EAnpException castedEx = null; if (ex != null) { castedEx = EAnpException.FromException(ex); } if (castedEx == null && startFlag) { castedEx = new EAnpExInterrupted(); } // Terminate this session. Terminate(); // Notify listeners. There are three cases: // - The session failed to start. // - The session ended normally. // - The session eneded abnormally. PostLocalVncSessionEvent(startFlag, castedEx); Kws.OnStateChange(WmStateChange.Transient); }
/// <summary> /// Called when the KCD connection status has changed. The default /// behavior is to fail on disconnection. /// </summary> public virtual void HandleKcdConn(KcdConnStatus status, Exception ex) { if (status == KcdConnStatus.Disconnecting || status == KcdConnStatus.Disconnected) { if (ex == null) { ex = new EAnpExInterrupted(); } HandleFailure(ex); } }
/// <summary> /// Called when the workspace login status has changed. The default /// behavior is to fail on log out. /// </summary> public virtual void HandleKwsLogin(KwsLoginStatus status, Exception ex) { if (status == KwsLoginStatus.LoggingOut || status == KwsLoginStatus.LoggedOut) { if (ex == null) { ex = new EAnpExInterrupted(); } HandleFailure(ex); } }
/// <summary> /// Called when the current workspace task is switching. The default /// behavior is to fail if an exception occurred or if the new task /// is not Spawn or WorkOnline. /// </summary> public virtual void HandleTaskSwitch(KwsTask task, Exception ex) { if (ex != null || (task != KwsTask.Spawn && task != KwsTask.WorkOnline)) { if (ex == null) { ex = new EAnpExInterrupted(); } HandleFailure(ex); } }