示例#1
0
        public void ShowObject(object obj, BaseScriptManager BaseScriptManager = null)
        {
            if (obj == null)
            {
                propertyGrid.SelectedObject = null;
                return;
            }

            var type = obj.GetType();

            if (typeof(Script).IsAssignableFrom(type))
            {
                ShowScript((Script)obj);
            }

            else if (typeof(Command).IsAssignableFrom(type))
            {
                ShowCommand((Command)obj, BaseScriptManager);
            }

            if (m_CurrentObject != null)
            {
                m_CurrentObject.BaseScriptManager = BaseScriptManager;
                ApplyDynamicTypeDescriptorToPropertyView();
            }
        }
示例#2
0
        private void ShowCommand <T>(T command, BaseScriptManager BaseScriptManager) where T : Command
        {
            var designerType = GetDesignerTypeForCommand(command.GetType());

            var commandProperties = (CommandProperties)Container.Resolve(designerType);

            m_OldCommand = command;

            commandProperties.Command         = command;
            m_CurrentObject                   = commandProperties;
            m_CurrentObject.BaseScriptManager = BaseScriptManager;
        }
示例#3
0
        public static void OnNewUserCommandsAppeared(ICommandFactory CommandFactory, ContextMenuStrip contextMenuStrip, int createMenuItemIndex,
                                                     TreeListView treeListView, BaseScriptManager baseScriptManager)
        {
            contextMenuStrip.BeginInvokeIfCreated(new MethodInvoker(() =>
            {
                var createMenuItem = (ToolStripMenuItem)contextMenuStrip.Items[createMenuItemIndex];

                createMenuItem.DropDownItems.Clear();
                foreach (var name in CommandFactory.CommandNames)
                {
                    var item    = new ToolStripMenuItem(name);
                    item.Click += (sender, eventArgs) =>
                    {
                        var newCommand = CommandFactory.Create(name);
                        if (treeListView.SelectedObject is HierarchyNode selectedNode)
                        {
                            if (selectedNode.Script != null)
                            {
                                selectedNode.Script.AddCommand(newCommand);
                            }
                            else if (selectedNode.Command != null)
                            {
                                var parentCommand = selectedNode.Command;
                                var script        = baseScriptManager.GetScriptFromCommand(parentCommand);
                                if (parentCommand.CanBeNested)
                                {
                                    script.AddCommand(newCommand, parentCommand);
                                }
                                else
                                {
                                    script.InsertCommandAfter(newCommand, parentCommand);
                                }
                            }
                            else
                            {
                                baseScriptManager.LoadedScripts.Last().AddCommand(newCommand);
                            }
                        }
                        else
                        {
                            baseScriptManager.LoadedScripts.Last().AddCommand(newCommand);
                        }
                    };
                    createMenuItem.DropDownItems.Add(item);
                }
            }));
        }
示例#4
0
 private bool IsSpecialScript(Script Script, BaseScriptManager BaseScriptManager)
 {
     return(LightTestFixture.IsSpecialScript(Script) ||
            BaseScriptManager is ScriptManager);
 }
示例#5
0
 private void ShowSelectedObjectInInspector(BaseScriptManager BaseScriptManager, object obj)
 {
     m_InspectorWindow.ShowObject(obj, BaseScriptManager);
 }