예제 #1
0
 public ManagerDocumentTypeVm(ICommonService service)
     : base(service)
 {
     _service = service;
     _context = _service.Context;
     InitializeVm();
 }
예제 #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);
        }
예제 #3
0
파일: DocViewerVM.cs 프로젝트: unicloud/FRP
        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);
        }
예제 #4
0
 public CommonService()
 {
     context = new CommonServiceData(AgentHelper.CommonServiceUri);
 }
예제 #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;
            };
        }
예제 #6
0
 public SearchDocumentVm(ICommonService service)
     : base(service)
 {
     _context = service.Context;
 }