private void EditCommand_Executed(object sender, ExecutedRoutedEventArgs e) { var item = Store.Current.SelectedDocument; var windowController = new WindowController { Title = "Document Editor" }; var control = new DocumentViewerControl(item, windowController); var window = new DialogWindow(control, windowController) { Owner = Application.Current.MainWindow, Height = 600 }; /*var window = new Windows.DocumentViewer(item) * { * Owner = this * };*/ if (window.ShowDialog() == true) { UpdateGridColumns(item.LiteDocument); UpdateDocumentPreview(); } }
public void LoadDocuments(IList <BsonValue> values) { foreach (var value in values) { DocumentViewerControl dv = new DocumentViewerControl(value as BsonDocument); dv.DeleteDocument += DocumentViewer_DeleteDocument; dv.Margin = new Thickness(5, 10, 5, 0); stpDocumentsContainer.Children.Add(dv); } }
public bool OpenEditDocument(DocumentReference document) { var windowController = new WindowController { Title = "Document Editor" }; var control = new DocumentViewerControl(document, windowController); var window = new DialogWindow(control, windowController) { Owner = Owner, Height = 600 }; return(window.ShowDialog() == true); }
public DocumentViewer(IWpfCommandService wpfCommandService, IDocumentViewerServiceImpl documentViewerServiceImpl, IMenuService menuService, DocumentViewerControl documentViewerControl) { if (wpfCommandService == null) throw new ArgumentNullException(nameof(wpfCommandService)); if (documentViewerServiceImpl == null) throw new ArgumentNullException(nameof(documentViewerServiceImpl)); if (menuService == null) throw new ArgumentNullException(nameof(menuService)); if (documentViewerControl == null) throw new ArgumentNullException(nameof(documentViewerControl)); this.wpfCommandService = wpfCommandService; this.documentViewerServiceImpl = documentViewerServiceImpl; this.documentViewerControl = documentViewerControl; menuService.InitializeContextMenu(documentViewerControl.TextView.VisualElement, MenuConstants.GUIDOBJ_DOCUMENTVIEWERCONTROL_GUID, new GuidObjectsProvider(this), new ContextMenuInitializer(documentViewerControl.TextView)); // Prevent the tab control's context menu from popping up when right-clicking in the textview host margin menuService.InitializeContextMenu(documentViewerControl, Guid.NewGuid()); wpfCommandService.Add(ControlConstants.GUID_DOCUMENTVIEWER_UICONTEXT, documentViewerControl); documentViewerControl.TextView.Properties.AddProperty(typeof(DocumentViewer), this); documentViewerControl.TextView.TextBuffer.Properties.AddProperty(DocumentViewerExtensions.DocumentViewerTextBufferKey, this); }