internal void GrabFocusForView(DocumentView view) { if (linkedController != null) { linkedController?.GrabFocusForView(view); } else { OnGrabFocus(view); } }
/// <summary> /// Gets the view that will show the content of the document. /// </summary> /// <returns>The view</returns> public async Task <DocumentView> GetDocumentView() { CheckInitialized(); if (finalViewItem == null) { try { finalViewItem = await itemExtension.OnInitializeView(); } catch (Exception ex) { LoggingService.LogError("View container initialization failed", ex); finalViewItem = new DocumentViewContent(() => (Control)null); } NotifyContentChanged(); } return(finalViewItem); }
async Task <DocumentView> InternalInitializeView() { if (viewItem == null) { try { viewItem = await OnInitializeView(); } catch (Exception ex) { LoggingService.LogError("View container initialization failed", ex); viewItem = new DocumentViewContent(() => (Control)null); } // If the view already has a controller bound to it, link it to the new one, so that all // events from the view are propagated to the old controller besides the new one. if (viewItem.SourceController != null) { linkedController = viewItem.SourceController; linkedController.linkedControllerParent = this; } viewItem.SourceController = this; } return(viewItem); }
public DocumentView() { AttachedViews.AttachListener(this); activeAttachedView = this; }
/// <summary> /// Called when the view of this controller needs to grab the focus (usually because it has /// become the active document). /// </summary> /// <param name="view">View.</param> protected virtual void OnGrabFocus(DocumentView view) { // Use the default GrabFocus implementation in DocumentView. view.DefaultGrabFocus(); }