/// <summary> /// Reporter une progression, qui ne sera pas dans les logs /// </summary> public void Report(ReporterProgress iProgress) { lock (_notifierStateListLocker) { var notifierProgress = new NotifierProgress(); NotifierState theState = GetNotifierState(); if (theState.ProgressCounter > iProgress.ProgressCounter) { notifierProgress.IncoherentCounter = true; } theState.ProgressCounter = iProgress.ProgressCounter; notifierProgress.Message = iProgress.Message; notifierProgress.LevelProgressCounter = iProgress.ProgressCounter; notifierProgress.Timer = iProgress.Timer; notifierProgress.LevelProgressCount = theState.ProgressCount; notifierProgress.ThreadCount = theState.ThreadCount; notifierProgress.Level = theState.Level; notifierProgress.TotalPercentage = ComputePercentage(_notifier); _notifier.Report(notifierProgress); MyDebug.PrintInformation(notifierProgress); } }
public SubLevel(ProgressCancelNotifier iNotifier, int iProgressCount, int iThreadCount) { lock (_notifierStateListLocker) { _notifier = iNotifier; var theLastState = NotifierStateList.Where(x => x.Notifier.Guid == iNotifier.Guid); int level = 1; if (theLastState.IsNotNullAndNotEmpty()) { level = theLastState.OrderByDescending(x => x.Level).First().Level + 1; } var newState = new NotifierState(); newState.Level = level; newState.Notifier = iNotifier; newState.ProgressCounter = 0; newState.ProgressCount = iProgressCount; newState.ThreadCount = iThreadCount; NotifierStateList.Add(newState); } }
/// <summary> /// Update notifier state /// </summary> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="notifierState"></param> /// <returns>Task of ApiResponse (NotifierState)</returns> public async System.Threading.Tasks.Task <ApiResponse <NotifierState> > UpdateNotifierStateAsyncWithHttpInfo(NotifierState notifierState) { // verify the required parameter 'notifierState' is set if (notifierState == null) { throw new ApiException(400, "Missing required parameter 'notifierState' when calling HealthApi->UpdateNotifierState"); } var localVarPath = "/health/notifier"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new List <KeyValuePair <String, String> >(); var localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader); var localVarFormParams = new Dictionary <String, String>(); var localVarFileParams = new Dictionary <String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { "application/json" }; String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json", "text/html", }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (notifierState != null && notifierState.GetType() != typeof(byte[])) { localVarPostBody = this.Configuration.ApiClient.Serialize(notifierState); // http body (model) parameter } else { localVarPostBody = notifierState; // byte array } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("UpdateNotifierState", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <NotifierState>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), (NotifierState)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(NotifierState)))); }
/// <summary> /// Update notifier state /// </summary> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="notifierState"></param> /// <returns>Task of NotifierState</returns> public async System.Threading.Tasks.Task <NotifierState> UpdateNotifierStateAsync(NotifierState notifierState) { ApiResponse <NotifierState> localVarResponse = await UpdateNotifierStateAsyncWithHttpInfo(notifierState); return(localVarResponse.Data); }
/// <summary> /// Update notifier state /// </summary> /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="notifierState"></param> /// <returns>NotifierState</returns> public NotifierState UpdateNotifierState(NotifierState notifierState) { ApiResponse <NotifierState> localVarResponse = UpdateNotifierStateWithHttpInfo(notifierState); return(localVarResponse.Data); }