/// <summary> /// 子窗口关闭后执行的操作 /// </summary> /// <param name="doc">添加的附件</param> /// <param name="sender">添加附件命令的参数</param> protected override void WindowClosed(DocumentDTO doc, object sender) { base.WindowClosed(doc, sender); if (sender is Guid) { Scn.ScnDocumentId = doc.DocumentId; Scn.ScnDocName = doc.Name; if (Scn.ScnDocName!=Scn.ScnNumber+doc.Extension) { MessageAlert("SCN编号与文件名不一致!"); } } }
/// <summary> /// 子窗口关闭后执行的操作 /// </summary> /// <param name="doc">添加的附件</param> /// <param name="sender">添加附件命令的参数</param> protected override void WindowClosed(DocumentDTO doc, object sender) { base.WindowClosed(doc, sender); if (sender is Guid) { SelRequest.CaacDocumentId = doc.DocumentId; SelRequest.CaacDocumentName = doc.Name; } else { var relatedDoc = new RelatedDocDTO { Id = RandomHelper.Next(), DocumentId = doc.DocumentId, DocumentName = doc.Name, SourceId = SelRequest.Id }; SelRequest.RelatedDocs.Add(relatedDoc); } }
/// <summary> /// 子窗口关闭后执行的操作 /// </summary> /// <param name="doc">添加的附件</param> /// <param name="sender">添加附件命令的参数</param> protected override void WindowClosed(DocumentDTO doc, object sender) { base.WindowClosed(doc, sender); if (sender is Guid) { EngineMaintainInvoice.DocumentId = doc.DocumentId; EngineMaintainInvoice.DocumentName = doc.Name; } }
/// <summary> /// 子窗口关闭后执行的操作 /// </summary> /// <param name="doc">添加的附件</param> /// <param name="sender">添加附件命令的参数</param> protected override void WindowClosed(DocumentDTO doc, object sender) { base.WindowClosed(doc, sender); if (sender is Guid) { SelCaacProgramming.DocumentId = doc.DocumentId; SelCaacProgramming.DocName = doc.Name; } else { var programmingFile = new ProgrammingFileDTO { DocName = doc.Name, DocumentId = doc.DocumentId, CreateDate = DateTime.Now, IssuedDate = DateTime.Now, Type = 1, //1-表示民航规划文档,2--表示川航规划文档 }; if (SelCaacProgramming != null) programmingFile.ProgrammingId = SelCaacProgramming.ProgrammingId; ProgrammingFiles.AddNew(programmingFile); } }
/// <summary> /// 子窗口关闭后执行的操作 /// </summary> /// <param name="doc">添加的附件</param> /// <param name="sender">添加附件命令的参数</param> protected override void WindowClosed(DocumentDTO doc, object sender) { base.WindowClosed(doc, sender); if (sender is Guid) { UndercartMaintainContract.DocumentId = doc.DocumentId; UndercartMaintainContract.DocumentName = doc.Name; DocumentName = doc.Name; } }
internal void AddDocument(DocumentDTO document, bool fromServer, Action<DocumentDTO> callback) { DocumentTypeVisibility = Visibility.Collapsed; _fromServer = fromServer; windowClosed = callback; if (_loadedDocument != null && document.DocumentId == _loadedDocument.DocumentId) { ViewDocument(_loadedDocument); } else { GetSingleDocument(document.DocumentId); } }
/// <summary> /// 子窗口关闭后执行的操作 /// </summary> /// <param name="doc">添加的附件</param> /// <param name="sender">添加附件命令的参数</param> protected override void WindowClosed(DocumentDTO doc, object sender) { base.WindowClosed(doc, sender); if (sender is Guid) { SelEnginePlan.DocumentId = doc.DocumentId; SelEnginePlan.DocName = doc.Name; } }
/// <summary> /// 子窗口关闭后执行的操作 /// </summary> /// <param name="doc">添加的附件</param> /// <param name="sender">添加附件命令的参数</param> protected override void WindowClosed(DocumentDTO doc, object sender) { base.WindowClosed(doc, sender); if (sender is Guid) { AirStructureDamage.DocumentId = doc.DocumentId; AirStructureDamage.DocumentName = doc.Name; DocumentName = doc.Name; } }
public void InitData(bool onlyView, Guid docId, EventHandler<WindowClosedEventArgs> closed) { _currentDoc = new DocumentDTO(); currentDocumentView.Tag = null; currentDocumentView.WordReader.Document = new RadDocument(); currentDocumentView.PdfReader.Document = null; currentDocumentView.WordPane.IsHidden = false; currentDocumentView.PdfPane.IsHidden = false; IsBusy = true; _currentDoc.DocumentId = docId; _onlyView = onlyView; if (_onlyView) { currentDocumentView.Header = "查看文档"; currentDocumentView.Closed -= closed; } else { currentDocumentView.Header = "编辑文档"; currentDocumentView.Closed -= closed; currentDocumentView.Closed += closed; } currentDocumentView.WindowStartupLocation = WindowStartupLocation.CenterScreen; if (!docId.Equals(Guid.Empty)) { LoadDocumentByDocId(docId); } IsBusy = false; }
/// <summary> /// 子窗口关闭后执行的操作 /// </summary> /// <param name="doc">添加的附件</param> /// <param name="sender">添加附件命令的参数</param> protected override void WindowClosed(DocumentDTO doc, object sender) { base.WindowClosed(doc, sender); if (sender is Guid) //添加民航局批文 { SelApprovalDoc.CaacDocumentId = doc.DocumentId; SelApprovalDoc.CaacDocumentName = doc.Name; } else //添加发改委批文 { SelApprovalDoc.NdrcDocumentId = doc.DocumentId; SelApprovalDoc.NdrcDocumentName = doc.Name; } }
/// <summary> /// 子窗口关闭后执行的操作 /// </summary> /// <param name="doc">添加的附件</param> /// <param name="sender">添加附件命令的参数</param> protected virtual void WindowClosed(DocumentDTO doc, object sender) { docViewer.Close(); }
/// <summary> /// 展示从服务端获取的文档 /// </summary> /// <param name="doc">获取的文档</param> private void ViewDocument(DocumentDTO doc) { var extension = doc.Extension; _content = doc.FileStorage; switch (extension) { case ".xlsx": PDFVisibility = Visibility.Collapsed; WordVisibility = Visibility.Collapsed; ExcelVisibility = Visibility.Visible; IWorkbookFormatProvider provider = new XlsxFormatProvider(); ExcelContent = provider.Import(new MemoryStream(_content)); break; case ".docx": PDFVisibility = Visibility.Collapsed; ExcelVisibility = Visibility.Collapsed; WordVisibility = Visibility.Visible; WordContent = _content; break; case ".pdf": WordVisibility = Visibility.Collapsed; ExcelVisibility = Visibility.Collapsed; PDFVisibility = Visibility.Visible; PDFContent = new MemoryStream(_content); break; default: MessageAlert("不是合法的文档!"); break; } Title = doc.Name; }
/// <summary> /// 展示从本地添加的文档 /// <remarks> /// 需要将文档相关内容赋给本地的_currentDocument。 /// </remarks> /// </summary> /// <param name="fi">文件</param> private void ViewDocument(FileInfo fi) { var extension = fi.Extension.ToLower(); var length = (int) fi.Length; var fs = fi.OpenRead(); _content = new byte[length]; using (fs) { fs.Read(_content, 0, length); } switch (extension.ToLower()) { case ".xlsx": PDFVisibility = Visibility.Collapsed; WordVisibility = Visibility.Collapsed; ExcelVisibility = Visibility.Visible; IWorkbookFormatProvider provider = new XlsxFormatProvider(); ExcelContent = provider.Import(new MemoryStream(_content)); break; case ".docx": PDFVisibility = Visibility.Collapsed; ExcelVisibility = Visibility.Collapsed; WordVisibility = Visibility.Visible; WordContent = _content; break; case ".pdf": WordVisibility = Visibility.Collapsed; ExcelVisibility = Visibility.Collapsed; PDFVisibility = Visibility.Visible; PDFContent = new MemoryStream(_content); break; default: MessageAlert("不是合法文档!"); break; } Title = fi.Name; _addedDocument = new DocumentDTO { DocumentId = Guid.NewGuid(), Name = fi.Name, Extension = extension, FileStorage = _content }; }
private void GetSingleDocument(Guid documentId) { var uri = GetDocumentUri(documentId); IsBusy = true; _context.BeginExecute<DocumentDTO>(uri, result => Deployment.Current.Dispatcher.BeginInvoke(() => { var context = result.AsyncState as CommonServiceData; try { if (context != null) { _loadedDocument = context.EndExecute<DocumentDTO>(result).FirstOrDefault(); if (_loadedDocument != null) ViewDocument(_loadedDocument); } } catch (DataServiceQueryException ex) { var response = ex.Response; MessageAlert(response.Error.Message); } IsBusy = false; }), _context); }
/// <summary> /// 子窗口关闭后执行的操作 /// </summary> /// <param name="doc">添加的附件</param> /// <param name="sender">添加附件命令的参数</param> protected override void WindowClosed(DocumentDTO doc, object sender) { base.WindowClosed(doc, sender); if (sender is Guid) { SelAircraftLeaseOrderDTO.ContractDocGuid = doc.DocumentId; SelAircraftLeaseOrderDTO.ContractName = doc.Name; } else { var relatedDoc = new RelatedDocDTO { Id = RandomHelper.Next(), DocumentId = doc.DocumentId, DocumentName = doc.Name, SourceId = SelAircraftLeaseOrderDTO.SourceGuid }; SelAircraftLeaseOrderDTO.RelatedDocs.Add(relatedDoc); } }
/// <summary> /// 子窗口关闭后执行的操作 /// </summary> /// <param name="doc">添加的交付文件</param> /// <param name="sender">添加附件命令的参数</param> protected override void WindowClosed(DocumentDTO doc, object sender) { base.WindowClosed(doc, sender); var relatedDoc = new RelatedDocDTO { Id = RandomHelper.Next(), DocumentId = doc.DocumentId, DocumentName = doc.Name, SourceId = SelEngineLeaseReception.SourceId }; SelEngineLeaseReception.RelatedDocs.Add(relatedDoc); }
/// <summary> /// 子窗口关闭后执行的操作 /// </summary> /// <param name="doc">添加的附件</param> /// <param name="sender">添加附件命令的参数</param> protected override void WindowClosed(DocumentDTO doc, object sender) { base.WindowClosed(doc, sender); SelPlan.DocumentId = doc.DocumentId; SelPlan.DocName = doc.Name; }
/// <summary> /// 子窗口关闭后执行的操作 /// </summary> /// <param name="doc">添加的附件</param> /// <param name="sender">添加附件命令的参数</param> protected override void WindowClosed(DocumentDTO doc, object sender) { base.WindowClosed(doc, sender); SelApprovalDoc.NdrcDocumentId = doc.DocumentId; SelApprovalDoc.NdrcDocumentName = doc.Name; }