コード例 #1
0
        public void AddWindow(string name, string filter)
        {
            if (!tabEditor.Visible)
            {
                tabEditor.Visible = true;
            }

            TabPage tab = FindPage(filter, name);

            if (tab != null)
            {
                tabEditor.SelectTab(tab);
                return;
            }

            RichQCEditor textBox    = new RichQCEditor();
            string       pathToFile = ProjectUtils.GetFilePathForTreeNodeItem(filter, name);

            if (!string.IsNullOrEmpty(pathToFile))
            {
                textBox.Text = File.ReadAllText(pathToFile);
            }

            tab            = new TabPage(name);
            tab.Name       = filter;
            textBox.Parent = tab;
            textBox.Dock   = DockStyle.Fill;
            tabEditor.TabPages.Add(tab);
            tabEditor.SelectTab(tab);
        }
コード例 #2
0
ファイル: CommandList.cs プロジェクト: BerntA/QCScript
        public CommandList(RichQCEditor editor)
        {
            InitializeComponent();

            _qcEditor               = editor;
            this.KeyDown           += new KeyEventHandler(OnKeyDown);
            textSearch.KeyDown     += new KeyEventHandler(OnKeyDown);
            itemList.KeyDown       += new KeyEventHandler(OnKeyDown);
            textSearch.TextChanged += new EventHandler(OnTextSearchChanged);
        }
コード例 #3
0
        private void SaveFile(TabPage tab)
        {
            RichQCEditor richText = GetTextBoxFromTab(tab);

            if (richText == null)
            {
                return;
            }

            string pathToFile = ProjectUtils.GetFilePathForTreeNodeItem(tab.Name, tab.Text);

            if (!string.IsNullOrEmpty(pathToFile))
            {
                File.WriteAllText(pathToFile, richText.Text);
            }
        }