public ManagerDocumentTypeVm(ICommonService service) : base(service) { _service = service; _context = _service.Context; InitializeVm(); }
public ListDocumentsVm(ICommonService service) : base(service) { _service = service; _context = service.Context; InitializeVM(); _filter = new FilterDescriptor<DocumentDTO> {FilteringExpression = e => true}; Documents.FilterDescriptors.Add(_filter); }
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); }
public CommonService() { context = new CommonServiceData(AgentHelper.CommonServiceUri); }
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; }; }
public SearchDocumentVm(ICommonService service) : base(service) { _context = service.Context; }