Exemplo n.º 1
0
        public bool Close(Control control)
        {
            KVDocument document = control.Tag as KVDocument;

            if (document != null)
            {
                return(documentService.Close(document));
            }

            return(true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Requests permission to close the client's Control.
        /// Allows user to save 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>
        bool IControlHostClient.Close(Control control)
        {
            bool closed = true;

            WinGuiCommonDataDocument document = control.Tag as WinGuiCommonDataDocument;

            if (document != null)
            {
                closed = m_documentService.Close(document);
                if (closed)
                {
                    m_contextRegistry.RemoveContext(document);
                }
            }

            return(closed);
        }
Exemplo n.º 3
0
Arquivo: Editor.cs Projeto: zparr/ATF
        /// <summary>
        /// Requests permission to close the client's Control. Allows user to save 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>
        bool IControlHostClient.Close(Control control)
        {
            bool closed = true;

            EventSequenceDocument document = control.Tag as EventSequenceDocument;

            if (document != null)
            {
                closed = m_documentService.Close(document);
                if (closed)
                {
                    m_contextRegistry.RemoveContext(document);
                }
            }

            return(closed);
        }
Exemplo n.º 4
0
        /// <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);
        }
Exemplo n.º 5
0
Arquivo: Editor.cs Projeto: zparr/ATF
        /// <summary>
        /// Requests permission to close the client's Control</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>
        bool IControlHostClient.Close(object control, bool mainWindowClosing)
        {
            bool closed = true;

            if (control is Control)
            {
                WinGuiWpfDataDocument document = ((Control)control).Tag as WinGuiWpfDataDocument;
                if (document != null)
                {
                    closed = m_documentService.Close(document);
                    if (closed)
                    {
                        m_contextRegistry.RemoveContext(document);
                    }
                }
            }
            return(closed);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Requests permission to close the client's Control.
        /// Allows user to save document before closing.</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)
        {
            bool closed = true;

            // Get current document, if any
            Document document = TreeView.As <Document>();

            // Check if document can be closed
            if (document != null)
            {
                closed = m_documentService.Close(document);
                if (closed)
                {
                    m_contextRegistry.RemoveContext(document);
                }
            }

            return(closed);  // app must be closing
        }
Exemplo n.º 7
0
        /// <summary>
        /// Requests permission to close the client's Control.
        /// Allows user to save document before closing it.</summary>
        /// <param name="control">Client Control to be closed</param>
        /// <returns>True if the Control either can close or is already closed. 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)
        {
            var adaptableControl = (AdaptableControl)control;

            bool            closed          = true;
            CircuitDocument circuitDocument = adaptableControl.ContextAs <CircuitDocument>();

            if (circuitDocument != null)
            {
                closed = m_documentService.Close(circuitDocument);
                if (closed)
                {
                    Close(circuitDocument);
                }
            }
            else
            {
                // We don't care if the control was already unregistered. 'closed' should be true.
                m_circuitControlRegistry.UnregisterControl(control);
            }
            return(closed);
        }
Exemplo n.º 8
0
        public bool Close(Control control)
        {
            var adaptableControl = (AdaptableControl)control;

            bool closed = true;
            var  doc    = adaptableControl.ContextAs <DiagramDocument>();

            if (doc != null)
            {
                closed = m_documentService.Close(doc);
                if (closed)
                {
                    Close(doc);
                }
            }
            else
            {
                // We don't care if the control was already unregistered. 'closed' should be true.
                _controlRegistry.UnregisterControl(control);
            }
            return(closed);
        }