private void AddTab() { var newTab = new ScriptManagerTab(); this.tc.Tabs.Add(newTab); this.tc.SelectedTab = newTab; }
private void LoadScript(string filename = null) { var tab = new ScriptManagerTab(); if (filename == null) { OpenFileDialog sfd = new OpenFileDialog(); sfd.Filter = "C# script files (*.cs)|*.cs|All files (*.*)|*.*"; sfd.RestoreDirectory = true; if (sfd.ShowDialog() == DialogResult.OK) { try { filename = sfd.FileName; } catch (Exception e) { RTCV.Common.Logging.GlobalLogger.Error(e, "Unable to open file."); MessageBox.Show($"Unable to open file. Error message: {e.Message}"); return; } } } tab.ScriptManager.LoadScript(filename); var shortName = Path.GetFileNameWithoutExtension(filename); tab.Name = shortName; tab.Text = shortName; tc.Tabs.Insert(tc.Tabs.Count - 1, tab); tc.SelectedTab = tab; }
public ScriptHost() { InitializeComponent(); var defaultTab = new ScriptManagerTab(); tc.Tabs.Add(defaultTab); tc.MouseDoubleClick += Tc_MouseDoubleClick; }