コード例 #1
0
        private void LoadComponentTypes(NodeView expandedNode)
        {
            CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);

            EventHandler<GetInstrumentComponentTypesCompletedEventArgs> fetchCompleted = null;
            fetchCompleted = (s, eventArgs) =>
                                 {
                                     List<InstrumentComponentType> componentTypes = eventArgs.Result;
                                     if (componentTypes != null)
                                     {
                                         foreach (InstrumentComponentType 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.InstrumentComponentType,
                                                                      HasChildren = true,
                                                                      SortField = componentType.Ordinal.ToString()
                                                                  };
                                             expandedNode.Children.Add(child);
                                         }
                                         Utils.HideSpinner(expandedNode);
                                         expandedNode.Sort();
                                     }
                                 };
            cmsWebServiceClient.GetInstrumentComponentTypesCompleted += fetchCompleted;
            cmsWebServiceClient.GetInstrumentComponentTypesAsync();
        }
コード例 #2
0
ファイル: DatabaseLoader.cs プロジェクト: barrett2474/CMS2
 public static Task<List<InstrumentComponentType>> GetInstrumentComponentTypes()
 {
     var task = new TaskCompletionSource<List<InstrumentComponentType>>();
     var cee = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
     cee.GetInstrumentComponentTypesCompleted += (s, e) => task.SetResult(e.Result);
     cee.GetInstrumentComponentTypesAsync();
     return task.Task;
 }
コード例 #3
0
        private void Initialize()
        {
            CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);

            cmsWebServiceClient.GetInstrumentComponentTypesCompleted +=
                (s, e) =>
                {
                    mInstrumentComponentTypes = e.Result;
                    if (mInstrumentComponent.InstrumentComponentType != null)
                    {
                        SelectedType = (from x in Types where x.Id == mInstrumentComponent.InstrumentComponentTypeId select x).FirstOrDefault();
                    }
                    Loaded();
                };

            cmsWebServiceClient.GetInstrumentComponentTypesAsync();

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