/// <summary> /// Notifies the client that its Control has been activated. Activation occurs when /// the Control gets focus, or a parent "host" Control gets focus.</summary> /// <param name="control">Client Control that was activated</param> /// <remarks>This method is only called by IControlHostService if the Control was previously /// registered for this IControlHostClient.</remarks> public void Activate(Control control) { AdaptableControl adaptableControl = (AdaptableControl)control; Document document = adaptableControl.ContextAs <Document>(); m_contextRegistry.ActiveContext = document; m_documentRegistry.ActiveDocument = document; }
/// <summary> /// Notifies the client that its Control has been activated. Activation occurs when /// the Control gets focus, or a parent "host" Control gets focus.</summary> /// <param name="control">Client Control that was activated</param> /// <remarks>This method is only called by IControlHostService if the Control was previously /// registered for this IControlHostClient.</remarks> public void Activate(Control control) { AdaptableControl adaptableControl = (AdaptableControl)control; var context = adaptableControl.ContextAs <CircuitEditingContext>(); m_contextRegistry.ActiveContext = context; CircuitDocument circuitDocument = context.As <CircuitDocument>(); if (circuitDocument != null) { m_documentRegistry.ActiveDocument = circuitDocument; } }
/// <summary> /// Notifies the client that its Control has been activated. Activation occurs when /// the Control gets focus, or a parent "host" Control gets focus.</summary> /// <param name="control">Client Control that was activated</param> /// <remarks>This method is only called by IControlHostService if the Control was previously /// registered for this IControlHostClient.</remarks> public void Activate(Control control) { AdaptableControl adaptableControl = (AdaptableControl)control; EditingContext context = adaptableControl.ContextAs <EditingContext>(); m_contextRegistry.ActiveContext = context; Document document = context.As <Document>(); if (document != null) { m_documentRegistry.ActiveDocument = document; } }
public void Activate(Control control) { AdaptableControl adaptableControl = (AdaptableControl)control; var context = adaptableControl.ContextAs <Controls.AdaptableSet>(); if (context != null) { m_contextRegistry.ActiveContext = context; var circuitDocument = context.As <DiagramDocument>(); if (circuitDocument != null) { m_documentRegistry.ActiveDocument = circuitDocument; } } }
/// <summary> /// Requests permission to close the client's Control. /// Allows the user to save the document before it closes.</summary> /// <param name="control">Client Control to be closed</param> /// <returns>True if the Control can close, or false to cancel</returns> /// <remarks> /// 1. This method is only called by IControlHostService if the Control was previously /// registered for this IControlHostClient. /// 2. If true is returned, the IControlHostService calls its own /// UnregisterControl. The IControlHostClient has to call RegisterControl again /// if it wants to re-register this Control.</remarks> public bool Close(Control control) { AdaptableControl adaptableControl = (AdaptableControl)control; Document document = adaptableControl.ContextAs <Document>(); bool closed = true; if (document != null) { closed = m_documentService.Close(document); if (closed) { m_contextRegistry.RemoveContext(document); } } return(closed); }