/// <summary>Hit when the client is finished getting custom workflow property fields.</summary> /// <param name="sender">ImportExportClient</param> /// <param name="e">Incident_RetrieveWorkflowCustomPropertiesCompletedEventArgs</param> private void wkfClient_Incident_RetrieveWorkflowCustomPropertiesCompleted(object sender, Incident_RetrieveWorkflowCustomPropertiesCompletedEventArgs e) { try { const string METHOD = CLASS + "wkfClient_Incident_RetrieveWorkflowCustomPropertiesCompleted()"; Logger.LogTrace(METHOD + " ENTER."); this._clientNumRunning--; this.barLoadingIncident.Value++; if (sender is ImportExportClient) { if (!e.Cancelled) { if (e.Error == null) { this._WorkflowCustom_Updated = this.workflow_LoadFieldStatus(e.Result); //Update custom workflow fields. this.cntCustomProps.SetWorkflowFields(WorkflowField.ConvertToDoubleInt(this._WorkflowCustom_Updated)); //Hide the status if needed. if (this._clientNumRunning == 0) { this.display_SetOverlayWindow(this.panelStatus, Visibility.Hidden); this._isWorkflowChanging = false; } } else { Logger.LogMessage(e.Error); } } } Logger.LogTrace_ExitMethod(METHOD + " Clients - Running: " + this._clientNumRunning.ToString() + ", Total: " + this._clientNum.ToString()); } catch (Exception ex) { Logger.LogMessage(ex, "wkfClient_Incident_RetrieveWorkflowCustomPropertiesCompleted()"); MessageBox.Show(StaticFuncs.getCultureResource.GetString("app_General_UnexpectedError"), StaticFuncs.getCultureResource.GetString("app_General_ApplicationShortName"), MessageBoxButton.OK, MessageBoxImage.Error); } }
/// <summary>Creates a useable dictionary of Field ID and Status from the given list of Workflow Custom Fields.</summary> /// <param name="workflowFields">A list of Workflow Fields</param> /// <returns>A dictionary of FieldId and current Status.</returns> private Dictionary <int, WorkflowField.WorkflowStatusEnum> workflow_LoadFieldStatus(List <RemoteWorkflowIncidentCustomProperties> workflowFields) { string METHOD = CLASS + "workflow_SetEnabledFields(cust)"; Logger.LogTrace_EnterMethod(METHOD); Dictionary <int, WorkflowField.WorkflowStatusEnum> retList = new Dictionary <int, WorkflowField.WorkflowStatusEnum>(); try { //Go through each workflow entry.. foreach (RemoteWorkflowIncidentCustomProperties prop in workflowFields) { WorkflowField.WorkflowStatusEnum status = WorkflowField.WorkflowStatusEnum.Normal; try { status = (WorkflowField.WorkflowStatusEnum)prop.FieldStateId; } catch (Exception ex) { } //Add it to the list, if there isn't a higher one already in there. if (retList.ContainsKey(prop.CustomPropertyId)) { status = WorkflowField.GetHigherImportance(status, retList[prop.CustomPropertyId]); retList[prop.CustomPropertyId] = status; } else { retList.Add(prop.CustomPropertyId, status); } } } catch (Exception ex) { Logger.LogMessage(ex, "workflow_LoadFieldStatus()"); MessageBox.Show(StaticFuncs.getCultureResource.GetString("app_General_UnexpectedError"), StaticFuncs.getCultureResource.GetString("app_General_ApplicationShortName"), MessageBoxButton.OK, MessageBoxImage.Error); retList = new Dictionary <int, WorkflowField.WorkflowStatusEnum>(); } Logger.LogTrace_ExitMethod(METHOD); return(retList); }