Пример #1
0
        /// <summary>
        /// Finishes initializing component by setting up scripting service</summary>
        void IInitializable.Initialize()
        {
            if (m_scriptingService != null)
            {
                // load this assembly into script domain.
                m_scriptingService.LoadAssembly(GetType().Assembly);
                m_scriptingService.ImportAllTypes("StatechartEditorSample");
                m_scriptingService.ExecuteStatement("from Sce.Atf.Controls.Adaptable.Graphs import *");
                m_scriptingService.SetVariable("editor", this);

                m_contextRegistry.ActiveContextChanged += delegate
                {
                    EditingContext  editingContext = m_contextRegistry.GetActiveContext <EditingContext>();
                    ViewingContext  viewContext    = m_contextRegistry.GetActiveContext <ViewingContext>();
                    IHistoryContext hist           = m_contextRegistry.GetActiveContext <IHistoryContext>();
                    m_scriptingService.SetVariable("editingContext", editingContext);
                    m_scriptingService.SetVariable("stateChart", editingContext != null ? editingContext.Statechart : null);
                    m_scriptingService.SetVariable("view", viewContext);
                    m_scriptingService.SetVariable("hist", hist);
                };
            }

            if (m_singleInstanceService != null)
            {
                m_singleInstanceService.CommandLineChanged += m_singleInstanceService_CommandLineChanged;
            }
        }
Пример #2
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;
        }
Пример #3
0
 public void SetDocument(EditingContext editingContext, ViewingContext viewingContext)
 {
     m_editingContext = editingContext;
     m_viewingContext = viewingContext;
     SetDefaultPrinterSettings();
 }
Пример #4
0
        /// <summary>
        /// Makes the document visible to the user</summary>
        /// <param name="document">Document to show</param>
        public void Show(IDocument document)
        {
            ViewingContext viewingContext = document.Cast <ViewingContext>();

            m_controlHostService.Show(viewingContext.Control);
        }
 public void SetDocument(EditingContext editingContext, ViewingContext viewingContext)
 {
     m_editingContext = editingContext;
     m_viewingContext = viewingContext;
     SetDefaultPrinterSettings();
 }