Example #1
0
        private void UpdateEvent()
        {
            Event nextEvent = null;

            if (m_eventSequenceContext != null)
            {
                nextEvent = m_eventSequenceContext.Selection.GetLastSelected <Event>();
            }

            if (m_event != nextEvent)
            {
                // remove last event's editing context in case it was activated
                if (m_event != null)
                {
                    m_contextRegistry.RemoveContext(m_event.Cast <EventContext>());
                }

                m_event = nextEvent;

                // get next event's editing context and bind to resources list view
                EventContext eventContext = null;
                if (nextEvent != null)
                {
                    eventContext = nextEvent.Cast <EventContext>();
                }

                m_resourcesListViewAdapter.ListView = eventContext;
            }
        }
Example #2
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
        }
Example #3
0
        /// <summary>
        /// Closes the document and removes any views of it from the UI</summary>
        /// <param name="document">Document to close</param>
        public void Close(IDocument document)
        {
            WinGuiCommonDataContext context = Adapters.As <WinGuiCommonDataContext>(document);

            m_controlHostService.UnregisterControl(context.ListView);
            context.ControlInfo = null;

            // close all active EditingContexts in the document
            foreach (DomNode node in context.DomNode.Subtree)
            {
                foreach (EditingContext editingContext in node.AsAll <EditingContext>())
                {
                    m_contextRegistry.RemoveContext(editingContext);
                }
            }

            // close the document
            m_documentRegistry.Remove(document);
        }
Example #4
0
        /// <summary>
        /// Closes the document and removes any views of it from the UI</summary>
        /// <param name="document">Document to close</param>
        public void Close(IDocument document)
        {
            EditingContext context = document.As <EditingContext>();

            // close all active EditingContexts in the document
            foreach (DomNode node in context.DomNode.Subtree)
            {
                foreach (EditingContext editingContext in node.AsAll <EditingContext>())
                {
                    m_contextRegistry.RemoveContext(editingContext);
                }
            }

            // close the document
            m_documentRegistry.Remove(document);

            // finally unregister the control
            ViewingContext viewingContext = document.Cast <ViewingContext>();

            m_controlHostService.UnregisterControl(viewingContext.Control);
            viewingContext.Control.Dispose();
            viewingContext.Control = null;
        }