public void Open(int definitionId) { SessionDefinition definition; if (_definitions.Definitions.TryGet(d => d.Id == definitionId, out definition)) { var recording = _control.Record(definition); recording.OpenAsync(CancellationToken.None).Forget(); } throw new ArgumentOutOfRangeException(nameof(definitionId)); }
private async Task OpenSessionAsync(ISessionChoiceViewModel definitionChoice) { try { var definition = definitionChoice.GetDefinition(); if (definition != null) { SessionRecording recording = _control.Record(definitionChoice.GetDefinition()); // currentRecording is updated in UpdateRecording from event handler of _control.RecordingChanged. // here, we do only check if (currentRecording != null && currentRecording.Recording == recording) { bool open = await currentRecording.OpenAsync(); if (open) { _views.MainWindow?.Hide(); } } } } catch { // TODO LOG } }