Inheritance: System.Windows.Forms.TabPage
示例#1
0
        private void OpenExistingFile(string pathToFile)
        {
            // Is this file already open?
            //
            foreach (FileEditorTab page in TabPages)
            {
                if (page.FileLocation == pathToFile)
                {
                    return;
                }
            }


            // Read file & Open a new Tab
            //
            try
            {
                String txt = File.ReadAllText(pathToFile);

                FileEditorTab newPage = new FileEditorTab();
                newPage.FileLocation = pathToFile;
                newPage.Content      = txt;

                this.TabPages.Add(newPage);
                SelectedIndex = TabCount - 1;
            }
            catch (IOException ex)
            {
                Console.WriteLine("Unable to open file: {0}", ex.Message);
            }
        }
示例#2
0
        public void AddNewFile()
        {
            // Add a new FileEditorTab (which has a FastColoredTextbox inside it)
            FileEditorTab newPage = new FileEditorTab();

            newPage.Padding = new System.Windows.Forms.Padding(3);

            this.TabPages.Add(newPage);
            SelectedIndex = TabCount - 1;
        }
示例#3
0
        public void CloseFile(FileEditorTab fileTab)
        {
            // TODO: Make AskToSaveFile so that it also has a CANCEL button
            //
            fileTab.AskToSaveFile();
            TabPages.Remove(fileTab);

            if (TabCount == 0)
            {
                this.AddNewFile();
            }
        }
示例#4
0
        private void OpenExistingFile(string pathToFile)
        {
            // Is this file already open?
            //
            foreach (FileEditorTab page in TabPages)
            {
                if (page.FileLocation == pathToFile)
                    return;
            }

            // Read file & Open a new Tab
            //
            try
            {
                String txt = File.ReadAllText(pathToFile);

                FileEditorTab newPage = new FileEditorTab();
                newPage.FileLocation = pathToFile;
                newPage.Content = txt;

                this.TabPages.Add(newPage);
                SelectedIndex = TabCount - 1;
            }
            catch (IOException ex)
            {
                Console.WriteLine("Unable to open file: {0}", ex.Message);
            }
        }
示例#5
0
        public void CloseFile(FileEditorTab fileTab)
        {
            // TODO: Make AskToSaveFile so that it also has a CANCEL button
            //
            fileTab.AskToSaveFile();
            TabPages.Remove(fileTab);

            if (TabCount == 0)
            {
                this.AddNewFile();
            }
        }
示例#6
0
        public void AddNewFile()
        {
            // Add a new FileEditorTab (which has a FastColoredTextbox inside it)
            FileEditorTab newPage = new FileEditorTab();
            newPage.Padding = new System.Windows.Forms.Padding(3);

            this.TabPages.Add(newPage);
            SelectedIndex = TabCount - 1;
        }