public ManagerDocumentTypeVm(ICommonService service)
     : base(service)
 {
     _service = service;
     _context = _service.Context;
     InitializeVm();
 }
Exemple #2
0
        public ListDocumentsVm(ICommonService service)
            : base(service)
        {
            _service = service;
            _context = service.Context;

            InitializeVM();

            _filter = new FilterDescriptor<DocumentDTO> {FilteringExpression = e => true};
            Documents.FilterDescriptors.Add(_filter);
        }
Exemple #3
0
        public DocViewerVM(ICommonService service)
            : base(service)
        {
            _service = service;
            _context = service.Context;

            SaveCommand = new DelegateCommand<object>(OnSave, CanSave);
            SaveDocumentToLocalCommand = new DelegateCommand<object>(OnSaveDocumentToLocal, CanSaveDocumentToLocal);
            InitializeVM();

            _filter = new FilterDescriptor<DocumentTypeDTO> {FilteringExpression = e => true};
            DocumentTypes.FilterDescriptors.Add(_filter);
        }
Exemple #4
0
 public CommonService()
 {
     context = new CommonServiceData(AgentHelper.CommonServiceUri);
 }
Exemple #5
0
        private void InitVm()
        {
            _navigatePageNumber = 1;
            SaveCommand = new DelegateCommand<object>(Save, CanSave);
            OpenDocumentCommand = new DelegateCommand<object>(OpenDocument);
            PdfDocumentChangedCommand = new DelegateCommand<object>(PdfDocumentChanged);
            var commonServiceData = new CommonServiceData(AgentHelper.CommonServiceUri);
            _documents = new QueryableDataServiceCollectionView<DocumentDTO>(commonServiceData,
                commonServiceData.Documents);

            _filter = new FilterDescriptor("DocumentId", FilterOperator.IsEqualTo, Guid.Empty);
            _documents.FilterDescriptors.Add(_filter);
            _documents.LoadedData += (o, e) =>
            {
                try
                {
                    var result = (o as QueryableDataServiceCollectionView<DocumentDTO>).FirstOrDefault();
                    if (result != null)
                    {
                        if (result.Name.EndsWith(".pdf", StringComparison.OrdinalIgnoreCase))
                        {
                            currentDocumentView.WordPane.IsHidden = true;
                            Stream currentContent = new MemoryStream(result.FileStorage);
                            currentDocumentView.PdfReader.DocumentSource = new PdfDocumentSource(currentContent,
                                FormatProviderSettings.ReadOnDemand);
                        }
                        else if (result.Name.EndsWith(".docx", StringComparison.OrdinalIgnoreCase))
                        {
                            currentDocumentView.PdfPane.IsHidden = true;
                            currentDocumentView.WordReader.Document = new DocxFormatProvider().Import(result.FileStorage);
                        }
                    }
                    //else
                    //{
                    //    MessageAlert("找不到该文档!");
                    //}
                }
                catch (Exception ex)
                {
                    MessageAlert(ex.Message);
                }
                IsBusy = false;
            };
        }
Exemple #6
0
 public SearchDocumentVm(ICommonService service)
     : base(service)
 {
     _context = service.Context;
 }