コード例 #1
0
        public DocumentLocationsViewModel(Document document)
        {
            CompositionInitializer.SatisfyImports(this);
            mDocument = document;

            CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);

            cmsWebServiceClient.GetDocumentLocationsAsync(document.Id);

            AddCommand = new DelegateCommand<object>(AddButtonHandler, CanAdd);
            DeleteCommand = new DelegateCommand<object>(DeleteButtonHandler, CanDelete);
        }
コード例 #2
0
        public LocationPickerViewModel()
        {
            if (DesignerProperties.IsInDesignTool) { return; }

            CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
            {
                cmsWebServiceClient.GetDocumentLocationsCompleted += (s, e)
                                                             =>
                    {
                        mLocations = new CmsObservableCollection<DocumentLocation>(e.Result.Where(x => x.IsActive));
                        RaisePropertyChanged("Locations");
                    };
                cmsWebServiceClient.GetDocumentLocationsAsync();

            }

            OkButtonCommand = new DelegateCommand<object>(OkButtonHandler, CanExecuteOkButtonHandler);
            CancelButtonCommand = new DelegateCommand<object>(CanelButtonHandler, CanExecuteOkButtonHandler);
        }
コード例 #3
0
ファイル: DatabaseLoader.cs プロジェクト: barrett2474/CMS2
 public static Task<List<DocumentLocation>> GetDocumentLocations()
 {
     var task = new TaskCompletionSource<List<DocumentLocation>>();
     var cee = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
     cee.GetDocumentLocationsCompleted += (s, e) => task.SetResult(e.Result);
     cee.GetDocumentLocationsAsync();
     return task.Task;
 }
コード例 #4
0
        private void LoadDocumentLocations(NodeView expandedNode)
        {
            CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);

            EventHandler<GetDocumentLocationsCompletedEventArgs> fetchCompleted = null;
            fetchCompleted = (s, eventArgs) =>
            {
                List<DocumentLocation> docList = eventArgs.Result;

                foreach (DocumentLocation documentLocation in docList)
                {
                    NodeView child = new NodeView(expandedNode)
                    {
                        Id = documentLocation.Id,
                        Name = documentLocation.Name,
                        Description = documentLocation.Description,
                        Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png",
                        Type = NodeType.DocumentLocationNode,
                        IsActive = documentLocation.IsActive,
                        SortField = documentLocation.Name,
                        HasChildren = false
                    };
                    expandedNode.Children.Add(child);
                }
                expandedNode.Sort(true);
                Utils.HideSpinner(expandedNode);
                cmsWebServiceClient.GetDocumentLocationsCompleted -= fetchCompleted;
            };

            cmsWebServiceClient.GetDocumentLocationsCompleted += fetchCompleted;
            cmsWebServiceClient.GetDocumentLocationsAsync(false);
        }