Inheritance: System.Windows.Forms.TabPage
Beispiel #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);
            }
        }
Beispiel #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;
        }
Beispiel #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();
            }
        }
Beispiel #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);
            }
        }
Beispiel #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();
            }
        }
Beispiel #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;
        }