private void cmsWebServiceClient_GetIssueRelatedActionsCompleted(object sender, GetIssueRelatedActionsCompletedEventArgs e) { mIssue.IssueRelatedActions = e.Result; CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetIssueActionStatusesCompleted += (s2, e2) => { cmsWebServiceClient.GetIssueActionTypesCompleted += (s3, e3) => { mIssueActionStatuses = e2.Result; mIssueActionTypes = e3.Result; foreach (var action in e.Result) { mIssueRelatedActions.Add(new IssueRelatedActionWapperViewModel(action, View.IssuesPanel.IssueDistributionControl.ViewModel, mIssueActionStatuses, mIssueActionTypes)); } mIssue.ModifiedObjects.ActionsModified = true; mDictionary = Utils.BuildDictionaryForCollection(mIssue.IssueRelatedActions.Select(x => x.Id).ToList()); RaisePropertyChanged("IssueRelatedActions"); if (DataLoaded != null) { DataLoaded(); } }; cmsWebServiceClient.GetIssueActionTypesAsync(); }; cmsWebServiceClient.GetIssueActionStatusesAsync(); }
public static Task<List<IssueActionStatus>> GetIssueActionStatuses() { var task = new TaskCompletionSource<List<IssueActionStatus>>(); var cee = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cee.GetIssueActionStatusesCompleted += (s, e) => task.SetResult(e.Result); cee.GetIssueActionStatusesAsync(); return task.Task; }
private void LoadIssueActionStatuses(NodeView expandedNode) { CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); EventHandler<GetIssueActionStatusesCompletedEventArgs> fetchCompleted = null; fetchCompleted = (s, eventArgs) => { List<IssueActionStatus> actionStatuses = eventArgs.Result; foreach (IssueActionStatus actionStatus in actionStatuses) { NodeView child = new NodeView(expandedNode) { Id = actionStatus.Id, Name = actionStatus.Name, Description = actionStatus.Description, IsActive = actionStatus.IsActive, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.IssueActionStatusNode, HasChildren = false, SortField = actionStatus.Ordinal.ToString(), }; expandedNode.Children.Add(child); cmsWebServiceClient.GetIssueActionStatusesCompleted -= fetchCompleted; } expandedNode.Sort(); Utils.HideSpinner(expandedNode); }; cmsWebServiceClient.GetIssueActionStatusesCompleted += fetchCompleted; cmsWebServiceClient.GetIssueActionStatusesAsync(); }