コード例 #1
0
ファイル: Editor.cs プロジェクト: zoombapup/ATF
        /// <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;
            }
        }