Esempio n. 1
0
        private DiagramEditor addDiagram(Diagram schema)
        {
            foreach (MyTabPage myTabPage in tabControlEditors.TabPages)
                if (myTabPage.Controls[0] is DiagramEditor && (myTabPage.Controls[0] as DiagramEditor).CurrentSchema==schema)
                {
                    tabControlEditors.SelectedTab = myTabPage;
                    return myTabPage.Controls[0] as DiagramEditor;
                }

            MyTabPage tp = new MyTabPage();
            //tp.ImageKey = "Diagram";
            tp.ImageIndex = 0;

            tp.Text = schema == null ? "New Diagram" : schema.Name;
            tp.BackColor = Color.FromKnownColor(KnownColor.Window);
            tp.AutoScroll = true;

            DiagramEditor d = new DiagramEditor();
            d.MainForm = this;
            if(schema!=null)
                d.CurrentSchema = schema;
            d.propertyGrid = this.propertyGrid;
            d.ContextMenuStrip = menuStripTree;
            tp.Controls.Add(d);
            tabControlEditors.TabPages.Add(tp);
            tabControlEditors.SelectTab(tp);

            d.Size = d.MinimumSize = tp.Size - new Size(tp.Padding.Left + tp.Padding.Right, tp.Padding.Top + tp.Padding.Bottom);
            SetFont(tp, Font);

            return d;
        }
Esempio n. 2
0
        internal void addFileEditor(string filePath, string content="")
        {
            foreach (MyTabPage myTabPage in tabControlEditors.TabPages)
                if (!string.IsNullOrEmpty(filePath) && myTabPage.ToolTipText == filePath)
                {
                    tabControlEditors.SelectedTab = myTabPage;
                    return;
                }
            //if (!File.Exists(filePath))
            //    throw new Exception("File not found");

            MyTabPage tp = new MyTabPage();
            //tp.ImageKey = "File";
            tp.ImageIndex = 2;

            TemplateEditor ed = new TemplateEditor(filePath, content);
            ed.Dock = DockStyle.Fill;
            tp.Controls.Add(ed);
            tp.ToolTipText = filePath;
            if (File.Exists(filePath))
                tp.Text = Path.GetFileName(filePath);
            tabControlEditors.TabPages.Add(tp);
            tabControlEditors.SelectTab(tp);

            SetFont(tp, Font);
        }
Esempio n. 3
0
        internal void addSQLEditor(string filePath, string sql, bool temp = false)
        {
            foreach (MyTabPage myTabPage in tabControlEditors.TabPages)
                if (!string.IsNullOrEmpty(filePath) && myTabPage.ToolTipText == filePath)
                {
                    tabControlEditors.SelectedTab = myTabPage;
                    return;
                }

            MyTabPage tp = new MyTabPage();
            //tp.ImageKey = "Query";
            tp.ImageIndex = 1;

            SQLEditorAndResults sqlEd = new SQLEditorAndResults(filePath, sql, temp);
            sqlEd.Dock = DockStyle.Fill;
            tp.Controls.Add(sqlEd);
            tp.ToolTipText = filePath;
            tp.Text = (temp || string.IsNullOrEmpty(filePath)) ? "Query" : Path.GetFileName(filePath);
            tabControlEditors.TabPages.Add(tp);
            tabControlEditors.SelectTab(tp);

            SetFont(tp, Font);
        }
Esempio n. 4
0
        private void cmdShowUIMetadataPreview(string arg)
        {
            UIMetadataPreview p = new UIMetadataPreview(this.propertyGrid);
            p.Connection = Provider.ActiveConnection;

            foreach (MyTabPage myTabPage in tabControlEditors.TabPages)
                if (!string.IsNullOrEmpty(p.Name) && myTabPage.ToolTipText == p.GetName())
                {
                    tabControlEditors.SelectedTab = myTabPage;
                    return;
                }

            MyTabPage tp = new MyTabPage();
            //tp.ImageKey = "Query";
            tp.ImageIndex = 1;

            p.Dock = DockStyle.Fill;
            tp.Controls.Add(p);
            tp.ToolTipText = p.GetName();
            tp.Text = p.GetName();
            tabControlEditors.TabPages.Add(tp);
            tabControlEditors.SelectTab(tp);

            SetFont(tp, Font);

            p.Preview();
        }