public static void CreateColumns(TreeListView treeListView, IHierarchyNodeStringConverter HierarchyNodeStringConverter)
        {
            treeListView.CanExpandGetter = x => (x as HierarchyNode).Children.Count > 0;
            treeListView.ChildrenGetter  = x => (x as HierarchyNode).Children;

            var nameColumn = new OLVColumn("Name", "Name");

            nameColumn.AspectGetter = x => HierarchyNodeStringConverter.ToString(x as HierarchyNode);

            nameColumn.ImageGetter += delegate(object x)
            {
                var imageListIndex = -1;
                var node           = (HierarchyNode)x;
                imageListIndex = node.Script != null ? 0 : imageListIndex;
                imageListIndex = node.Command != null ? 1 : imageListIndex;
                return(imageListIndex);
            };

            treeListView.UseCellFormatEvents = true;

            treeListView.IsSimpleDragSource = true;
            treeListView.IsSimpleDropSink   = true;

            nameColumn.Width = treeListView.Width;
            treeListView.Columns.Add(nameColumn);
        }
Exemple #2
0
        public TestFixtureWindow(ITestRunner TestRunner, ITestFixtureManager TestFixtureManager,
                                 IHierarchyNodeStringConverter HierarchyNodeStringConverter, ICommandFactory CommandFactory)
        {
            this.TestRunner                   = TestRunner;
            this.TestFixtureManager           = TestFixtureManager;
            this.HierarchyNodeStringConverter = HierarchyNodeStringConverter;
            this.CommandFactory               = CommandFactory;

            InitializeComponent();
            AutoScaleMode = AutoScaleMode.Dpi;

            treeListView.Font = Fonts.Default;

            TestRunner.TestRunEnd += OnScriptsFinishedRunning;
            TestRunner.TestData.CommandRunningCallback += OnCommandRunning;

            treeListView.FormatCell += UpdateFontsTreeListView;
            HierarchyUtils.CreateColumns(treeListView, HierarchyNodeStringConverter);

            // subscribing for both treeListView and contextMenuStrip creation, since it's not clear which will be created first
            treeListView.HandleCreated     += AddNewCommandsToCreateMenu;
            contextMenuStrip.HandleCreated += AddNewCommandsToCreateMenu;
            CommandFactory.NewUserCommands += AddNewCommandsToCreateMenu;

            UpdateHierarchy();
        }
        public HierarchyWindow(IScriptManager ScriptManager, ITestRunner TestRunner, IAssetManager AssetManager,
                               IHierarchyNodeStringConverter HierarchyNodeStringConverter, ICommandFactory CommandFactory)
        {
            this.ScriptManager = ScriptManager;
            this.TestRunner    = TestRunner;
            this.AssetManager  = AssetManager;
            this.HierarchyNodeStringConverter = HierarchyNodeStringConverter;
            this.CommandFactory = CommandFactory;

            InitializeComponent();
            AutoScaleMode = AutoScaleMode.Dpi;

            treeListView.Font = Fonts.Default;

            ScriptManager.CommandAddedToScript     += OnCommandAddedToScript;
            ScriptManager.CommandRemovedFromScript += OnCommandRemovedFromScript;
            ScriptManager.CommandModifiedOnScript  += OnCommandModifiedOnScript;
            ScriptManager.CommandInsertedInScript  += OnCommandInsertedInScript;

            ScriptManager.ScriptAdded              += OnScriptLoaded;
            ScriptManager.ScriptModified           += OnScriptModified;
            ScriptManager.ScriptRemoved            += OnScriptRemoved;
            ScriptManager.ScriptPositioningChanged += OnScriptPositioningChanged;

            TestRunner.TestRunEnd += OnScriptsFinishedRunning;
            TestRunner.TestData.CommandRunningCallback += OnCommandRunning;

            // subscribing for both treeListView and contextMenuStrip creation, since it's not clear which will be created first
            treeListView.HandleCreated     += AddNewCommandsToCreateMenu;
            contextMenuStrip.HandleCreated += AddNewCommandsToCreateMenu;
            CommandFactory.NewUserCommands += AddNewCommandsToCreateMenu;

            treeListView.FormatCell += UpdateFontsTreeListView;
            HierarchyUtils.CreateColumns(treeListView, HierarchyNodeStringConverter);

            treeListView.HandleCreated += UpdateHierarchy;
        }