private void Initialize()
        {
            CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);

            cmsWebServiceClient.GetElectricalEquipmentComponentTypesCompleted +=
                (s, e) =>
                    {
                        mElectricalEquipmentComponentTypes = e.Result;
                        if (mElectricalEquipmentComponent.ElectricalEquipmentComponentType != null)
                        {
                            SelectedType = (from x in Types where x.Id == mElectricalEquipmentComponent.ElectricalEquipmentComponentTypeId select x).FirstOrDefault();
                        }
                        Loaded();
                    };

            cmsWebServiceClient.GetElectricalEquipmentComponentTypesAsync();

            OkButtonCommand = new DelegateCommand<object>(OkButtonHander, CanModify);
            CancelButtonCommand = new DelegateCommand<object>(CancelButtonHander, x => true);
        }
Beispiel #2
0
 public static Task<List<ElectricalEquipmentComponentType>> GetElectricalEquipmentComponentTypes()
 {
     var task = new TaskCompletionSource<List<ElectricalEquipmentComponentType>>();
     var cee = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
     cee.GetElectricalEquipmentComponentTypesCompleted += (s, e) => task.SetResult(e.Result);
     cee.GetElectricalEquipmentComponentTypesAsync();
     return task.Task;
 }
        private void LoadComponentTypes(NodeView expandedNode)
        {
            CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);

            EventHandler<GetElectricalEquipmentComponentTypesCompletedEventArgs> fetchCompleted = null;
            fetchCompleted = (s, eventArgs) =>
            {
                List<ElectricalEquipmentComponentType> componentTypes = eventArgs.Result;
                if (componentTypes != null)
                {
                    foreach (ElectricalEquipmentComponentType componentType in componentTypes)
                    {
                        NodeView child = new NodeView(expandedNode)
                        {
                            Id = componentType.Id,
                            Name = componentType.Name,
                            Description = componentType.Description,
                            Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png",
                            Type = NodeType.ElectricalComponentType,
                            HasChildren = true,
                            SortField = componentType.Ordinal.ToString()
                        };
                        expandedNode.Children.Add(child);
                    }
                    Utils.HideSpinner(expandedNode);
                    expandedNode.Sort();
                }
                cmsWebServiceClient.GetElectricalEquipmentComponentTypesCompleted -= fetchCompleted;
            };

            cmsWebServiceClient.GetElectricalEquipmentComponentTypesCompleted += fetchCompleted;
            cmsWebServiceClient.GetElectricalEquipmentComponentTypesAsync();
        }