Beispiel #1
0
    private void initializeSolutionBrowser()
    {
        //create the solution browser control
        p_SolutionExplorer = new SolutionBrowserControl() { Dock = DockStyle.Fill };

        //create the dockable window to hold the solution explorer
        DockableControl dock = new DockableControl() {
            Dock = DockStyle.Fill,
            Title = "Solution Explorer"
        };
        dock.WorkingArea.Controls.Add(p_SolutionExplorer);

        //add the control to the control skeleton
        p_MainBodyContainer.Panel2.Controls.Add(dock);

        #region Dock events
        /*When the dock control is docked, adjust the skeleton to make it visible*/
        dock.DockClicked += delegate(object sender, EventArgs e) {
            p_MainBodyContainer.Panel2Collapsed = false;
        };
        /*When the dock control is undocked, adjust the skeleton to make it invisible*/
        dock.UndockClicked += delegate(object sender, EventArgs e) {
            p_MainBodyContainer.Panel2Collapsed = true;
        };
        /*When the dock is closed, just make it invisible but DON'T dispose it*/
        dock.CloseClicked += delegate(object sender, EventArgs e) {
            p_MainBodyContainer.Panel2Collapsed = true;
        };
        #endregion

        #region Solution events
        p_SolutionExplorer.FileOpened += delegate(SolutionBrowserControl sender, ProjectFile file) {
            AddTab(file.PhysicalLocation);
        };
        p_SolutionExplorer.FileDelete += delegate(SolutionBrowserControl sender, ProjectFile file) {
            RemoveTab(file.PhysicalLocation);
        };
        p_SolutionExplorer.SolutionChanged += delegate(SolutionBrowserControl sender, Solution solution) {
            saveState();

            p_Title = solution.SolutionName + " - " + p_BaseTitle;
            Text = p_Title;
        };
        #endregion

        //load the solution that was loaded in a previous
        //instance of the IDE
        if (RuntimeState.ObjectExists("mainIDE.openedSolution")) {
            string solutionFilename = RuntimeState.GetObjectString("mainIDE.openedSolution");
            if (!File.Exists(solutionFilename)) { return; }
            p_SolutionExplorer.Solution = new Solution(solutionFilename);
        }

        //restore the state of the solution control
        p_SolutionExplorer.LoadTreeExpandState("mainIDE.solutionBrowserState");
    }