private void LoadComponentTypes(NodeView expandedNode)
        {
            CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);

            EventHandler<GetMobilePlantComponentTypesCompletedEventArgs> fetchCompleted = null;
            fetchCompleted = (s, eventArgs) =>
            {
                List<MobilePlantComponentType> componentTypes = eventArgs.Result;
                if (componentTypes != null)
                {
                    foreach (MobilePlantComponentType 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.MobilePlantComponentType,
                            HasChildren = true,
                            SortField = componentType.Ordinal.ToString()
                        };
                        expandedNode.Children.Add(child);
                    }
                    Utils.HideSpinner(expandedNode);
                    expandedNode.Sort();
                }
                cmsWebServiceClient.GetMobilePlantComponentTypesCompleted -= fetchCompleted;
            };

            cmsWebServiceClient.GetMobilePlantComponentTypesCompleted += fetchCompleted;
            cmsWebServiceClient.GetMobilePlantComponentTypesAsync();
        }
Esempio n. 2
0
 public static Task<List<MobilePlantComponentType>> GetMobilePlantComponentTypes()
 {
     var task = new TaskCompletionSource<List<MobilePlantComponentType>>();
     var cee = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
     cee.GetMobilePlantComponentTypesCompleted += (s, e) => task.SetResult(e.Result);
     cee.GetMobilePlantComponentTypesAsync();
     return task.Task;
 }
        private void Initialize()
        {
            CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);

            cmsWebServiceClient.GetMobilePlantComponentTypesCompleted +=
                (s, e) =>
                {
                    mMobilePlantComponentTypes = e.Result;
                    if (mMobilePlantComponent.MobilePlantComponentType != null)
                    {
                        SelectedType = (from x in Types where x.Id == mMobilePlantComponent.MobilePlantComponentTypeId select x).FirstOrDefault();
                    }
                    Loaded();
                };

            cmsWebServiceClient.GetMobilePlantComponentTypesAsync();

            OkButtonCommand = new DelegateCommand<object>(OkButtonHander, CanModify);
            CancelButtonCommand = new DelegateCommand<object>(CancelButtonHander, x => true);
        }