public void OpenMultipleFiles(string[] files) { for (int i = 0; i < files.Count(); i++) { if (!FileIsAlreadyOpen(files[i])) { AddTab(); try { EditorControl tabControlsEditor = (EditorControl)tabControl1.TabPages[tabControl1.SelectedIndex].Controls.Find("EDITORCONTROL", true)[0]; tabControlsEditor.LoadFile(files[i]); tabControl1.TabPages[tabControl1.SelectedIndex].Text = Path.GetFileName(files[i]); this.Text = "BasicScriptingLanguage Editor - " + Path.GetFileName(files[i]); fileStatusLabel.Text = "Path: " + files[i]; } catch (Exception ex) { MessageBox.Show("Error loading file: " + ex.Message, "BasicScriptingLanguage Editor", MessageBoxButtons.OK, MessageBoxIcon.Error); tabControl1.TabPages.RemoveAt(tabControl1.SelectedIndex); } } } }
public void OpenFile(string fileToOpen) { if (!FileIsAlreadyOpen(fileToOpen)) { EditorControl tabControlsEditor = (EditorControl)tabControl1.TabPages[tabControl1.SelectedIndex].Controls.Find("EDITORCONTROL", true)[0]; tabControlsEditor.LoadFile(fileToOpen); tabControl1.TabPages[tabControl1.SelectedIndex].Text = Path.GetFileName(fileToOpen); this.Text = "BasicScriptingLanguage Editor - " + Path.GetFileName(fileToOpen); fileStatusLabel.Text = "Path: " + fileToOpen; } }
public TabbedUI(string fileToOpen) { Font = SystemFonts.MessageBoxFont; InitializeComponent(); AddTab(); EditorControl tabControlsEditor = (EditorControl)tabControl1.TabPages[tabControl1.SelectedIndex].Controls.Find("EDITORCONTROL", true)[0]; tabControlsEditor.LoadFile(fileToOpen); tabControl1.TabPages[tabControl1.SelectedIndex].Text = Path.GetFileName(fileToOpen); this.Text = "BasicScriptingLanguage Editor - " + Path.GetFileName(fileToOpen); fileStatusLabel.Text = "Path: " + fileToOpen; }
//Openfile private void menuItem7_Click(object sender, EventArgs e) { OpenFileDialog of = new OpenFileDialog(); of.Filter = "BasicScriptFiles|*.bsl|Everything|*.*"; if (of.ShowDialog() == DialogResult.OK) { if (tabControl1.SelectedIndex == -1) { AddTab(); } foreach (var item in tabControl1.TabPages[tabControl1.SelectedIndex].Controls) { Control itemm = (Control)item; if (itemm.Name == "EDITORCONTROL") { EditorControl castControlAsEditor = (EditorControl)itemm; if (castControlAsEditor.CurrentFile == "New Document" && castControlAsEditor.HasChanges != true) { EditorControl toOpenFileIn = (EditorControl)itemm; toOpenFileIn.LoadFile(of.FileName); tabControl1.TabPages[tabControl1.SelectedIndex].Text = Path.GetFileName(of.FileName); this.Text = "BasicScriptingLanguage Editor - " + Path.GetFileName(of.FileName); fileStatusLabel.Text = "Path: " + of.FileName; } else if (castControlAsEditor.HasChanges == true | castControlAsEditor.CurrentFile != "New Document") { AddTab(); EditorControl tabControlsEditor = (EditorControl)tabControl1.TabPages[tabControl1.SelectedIndex].Controls.Find("EDITORCONTROL", true)[0]; tabControlsEditor.LoadFile(of.FileName); tabControl1.TabPages[tabControl1.SelectedIndex].Text = Path.GetFileName(of.FileName); this.Text = "BasicScriptingLanguage Editor - " + Path.GetFileName(of.FileName); fileStatusLabel.Text = "Path: " + of.FileName; } } } } }