Beispiel #1
0
        public IViewContent LoadFile(string fileName)
        {
            // Create a new tab page.
            SharpSnippetCompilerControl snippetControl = new SharpSnippetCompilerControl();

            snippetControl.Dock = DockStyle.Fill;
            SnippetTabPage tabPage = new SnippetTabPage(snippetControl);

            tabPage.Text = Path.GetFileName(fileName);

            fileTabControl.TabPages.Add(tabPage);

            // Load file
            snippetControl.LoadFile(fileName);
            snippetControl.Focus();

            WorkbenchWindow window = new WorkbenchWindow(fileTabControl, tabPage);
            MainViewContent view   = new MainViewContent(fileName, snippetControl, window);

            WorkbenchSingleton.Workbench.ShowView(view);

            UpdateActiveView(view);

            return(view);
        }
Beispiel #2
0
        void FileCloseToolStripMenuItemClick(object sender, EventArgs e)
        {
            SnippetTabPage activeTabPage = ActiveSnippetTabPage;

            if (activeTabPage != null)
            {
                SharpSnippetCompilerControl snippetControl = activeTabPage.SnippetCompilerControl;
                snippetControl.Save();
                string          fileName = ActiveSnippetTabPage.SnippetCompilerControl.TextEditor.FileName;
                IProject        project  = ProjectService.CurrentProject;
                FileProjectItem item     = project.FindFile(fileName);
                if (item != null)
                {
                    ProjectService.RemoveProjectItem(project, item);
                    project.Save();

                    foreach (IViewContent view in WorkbenchSingleton.Workbench.ViewContentCollection)
                    {
                        if (view.Control == snippetControl)
                        {
                            WorkbenchSingleton.Workbench.CloseContent(view);
                            break;
                        }
                    }

                    fileTabControl.TabPages.Remove(activeTabPage);
                    activeTabPage.Dispose();
                }
            }
        }
 public WorkbenchWindow(TabControl tabControl, SnippetTabPage tabPage)
 {
     this.tabControl = tabControl;
     this.tabPage = tabPage;
 }
 public WorkbenchWindow(TabControl tabControl, SnippetTabPage tabPage)
 {
     this.tabControl = tabControl;
     this.tabPage    = tabPage;
 }
        public IViewContent LoadFile(string fileName)
        {
            // Create a new tab page.
            SharpSnippetCompilerControl snippetControl = new SharpSnippetCompilerControl();
            snippetControl.Dock = DockStyle.Fill;
            SnippetTabPage tabPage = new SnippetTabPage(snippetControl);
            tabPage.Text = Path.GetFileName(fileName);

            fileTabControl.TabPages.Add(tabPage);

            // Load file
            snippetControl.LoadFile(fileName);
            snippetControl.Focus();

            WorkbenchWindow window = new WorkbenchWindow(fileTabControl, tabPage);
            MainViewContent view = new MainViewContent(fileName, snippetControl, window);
            WorkbenchSingleton.Workbench.ShowView(view);

            UpdateActiveView(view);

            return view;
        }