Ejemplo n.º 1
0
        private void AddTab()
        {
            var newTab = new ScriptManagerTab();

            this.tc.Tabs.Add(newTab);
            this.tc.SelectedTab = newTab;
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        public ScriptHost()
        {
            InitializeComponent();
            var defaultTab = new ScriptManagerTab();

            tc.Tabs.Add(defaultTab);
            tc.MouseDoubleClick += Tc_MouseDoubleClick;
        }