public static Task<List<ControlSystemTypeTestingProperty>> GetControlSystemTypeTestingProperties(int componentTypeId) { var task = new TaskCompletionSource<List<ControlSystemTypeTestingProperty>>(); var cee = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cee.GetControlSystemTypeTestingPropertiesCompleted += (s, e) => task.SetResult(e.Result); cee.GetControlSystemTypeTestingPropertiesAsync(componentTypeId); return task.Task; }
private void LoadSystemTypeTests(NodeView expandedNode) { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); EventHandler<GetControlSystemTypeTestingPropertiesCompletedEventArgs> fetchCompleted = null; fetchCompleted = (s, eventArgs) => { var typeTestingProperties = eventArgs.Result; typeTestingProperties = typeTestingProperties.OrderBy(x => x.Ordinal).ThenBy(x => x.GroupOrdinal).ToList(); foreach (var property in typeTestingProperties) { if (property.ComponentTypeGroupId.HasValue) { var childGroup = expandedNode.Children.FirstOrDefault(x => x.GroupId == property.ComponentTypeGroupId.Value); if (childGroup == null) { childGroup = new NodeView(expandedNode) { Id = property.Id, GroupId = property.ComponentTypeGroupId.Value, Name = property.ComponentTypeGroup.Name, Description = property.ComponentTypeGroup.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.ComponentTypeGroup, HasChildren = true, SortField = property.Ordinal.ToString() }; expandedNode.Children.Add(childGroup); } else { Utils.HideSpinner(childGroup); } if (property.TestPropertyId.HasValue) { var child = new NodeView(childGroup) { Id = property.Id, Name = property.ControlSystemTestingProperty.Name, Description = property.ControlSystemTestingProperty.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.SystemTypeTest, HasChildren = false, SortField = property.GroupOrdinal.ToString() }; childGroup.Children.Add(child); } } else { var child = new NodeView(expandedNode) { Id = property.Id, Name = property.ControlSystemTestingProperty.Name, Description = property.ControlSystemTestingProperty.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.SystemTypeTest, HasChildren = false, SortField = property.Ordinal.ToString() }; expandedNode.Children.Add(child); } } Utils.HideSpinner(expandedNode); cmsWebServiceClient.GetControlSystemTypeTestingPropertiesCompleted -= fetchCompleted; }; cmsWebServiceClient.GetControlSystemTypeTestingPropertiesCompleted += fetchCompleted; cmsWebServiceClient.GetControlSystemTypeTestingPropertiesAsync(expandedNode.Parent.Id); }