Exemplo n.º 1
0
        public Main(params string[] args)
        {
            InitializeComponent();

            Commands = new CommandsList();

            explorer     = new ExplorerTool(this);
            commander    = new CommanderTool(this);
            output       = new OutputTool(this);
            propertyGrid = new PropertyGridTool(this);

            var hierarchyProvider = Config.GetProvider(args);

            Hierarchy = hierarchyProvider.CreateHierarchy(this);
            var startingNode = Hierarchy.Nodes().FirstOrDefault();

            Hierarchy.ActivationRequested += (ars, ara) =>
            {
                var window = DockPanel.GetOpenDocumentWindows().Where(x => x.Node.Equals(ara)).FirstOrDefault();
                if (window != null)
                {
                    window.Activate();
                }
                else
                {
                    var editor = ara.GetEditor(typeof(Control));
                    if (editor != null)
                    {
                        var newWindow = new DocumentWindowBase(this, ara);
                        newWindow.Show(this.DockPanel, DockState.Document);
                        newWindow.Controls.Add(editor as Control);
                        editor.ActivateIn(newWindow);
                    }
                }
            };


            commander.Show(DockPanel, DockState.DockLeft);
            explorer.Show(DockPanel, DockState.DockLeft);
            propertyGrid.Show(DockPanel, DockState.DockRight);
            output.Show(DockPanel, DockState.DockBottom);

            if (startingNode != null)
            {
                startingNode.Select();
                Hierarchy.Activate(startingNode);
            }


            //Commands.Add("Show Output", () => { output.Show(this.DockPanel, DockState.DockBottom); }, "Show the output panel");
            //  Commands.Add("Show Explorer", () => { explorer.Show(this.DockPanel, DockState.DockLeft); }, "Show the explorer panel");
            // Commands.Add("Show Properties", () => { propertyGrid.Show(this.DockPanel, DockState.DockRight); }, "Show the selected object properties panel");

            //       RegisterQuickieText();

            SetupKeyHook();
            GoFullscreen(false);
        }