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
 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;
 }
        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);
        }