internal SessionEndCompletedEventArgs(string sessionKey, EndSesionResult result) { SessionKey = sessionKey; Result = result; }
private async Task EndEx(string sessionKey) { var result = new EndSesionResult(); lock (_syncRoot) { if (_ongoingSessionEnding) { _sessionEnded.WaitOne(); return; } _ongoingSessionEnding = true; } if (string.IsNullOrEmpty(sessionKey)) throw new InvalidOperationException("There is no active session."); try { OnSessionEndStartedEvent(new SessionEndStartedEventArgs(sessionKey)); await Client.WebApiClient.ExecuteCommandAsync("Client/Session", "End", sessionKey); } catch (Exception exception) { result.SetException(exception); throw; } finally { _sessionKey = null; _sessionUrl = null; _ongoingSessionEnding = false; _sessionEnded.Set(); result.SetCompleted(); OnSessionEndCompletedEvent(new SessionEndCompletedEventArgs(sessionKey, result)); } }