/// <summary> /// Stop a recording. </summary> /// <param name="stopRecordingParams"> </param> /// <exception cref="ODataException"> </exception> /// <exception cref="GeneralSecurityException"> </exception> /// <exception cref="IOException"> </exception> /// <exception cref="URISyntaxException"> </exception> /// <exception cref="NeotysAPIException"> </exception> public void StopRecording(StopRecordingParams stopRecordingParams) { if (!Enabled) { return; } IDictionary <string, object> properties = DesignApiUtils.getStopRecordingProperties(stopRecordingParams); properties[DesignApiUtils.API_KEY] = apiKey; try { CreateEntity(DesignApiUtils.STOP_RECORDING, properties); Task t = Task.Factory.StartNew(() => WaitUntilServerIsReady()); //Wait untill timeout, if timeout expires Wait() returns false. if (!t.Wait(stopRecordingParams.Timeout * 1000)) { throw new NeotysAPIException(NeotysAPIException.ErrorType.NL_DESIGN_ILLEGAL_STATE_FOR_OPERATION, "The timeout of " + stopRecordingParams.Timeout + " second(s) has been reached."); } } //Task has been interrupted by another reason than timeout, throw error with real cause. catch (System.AggregateException aggregateException) { throw new NeotysAPIException(aggregateException.InnerException); } catch (ODataException oDataException) { throw new NeotysAPIException(oDataException); } }
public static IDictionary <string, object> getStopRecordingProperties(StopRecordingParams stopRecordingParams) { IDictionary <string, object> properties = new Dictionary <string, object>(); properties[FRAMEWORK_PARAMETER_SEARCH] = stopRecordingParams.FrameworkParameterSearch; properties[GENERIC_PARAMETER_SEARCH] = stopRecordingParams.GenericParameterSearch; if (stopRecordingParams.UpdateParams != null) { IDictionary <string, object> updateProperties = getUserPathUpdateProperties(stopRecordingParams.UpdateParams); foreach (KeyValuePair <string, object> pair in updateProperties) { properties[pair.Key] = pair.Value; } } return(properties); }