Ejemplo n.º 1
0
        private void SetTabPageContent(DatabaseObjectDisplayInfo info, TabPage tabPage)
        {
            if (info.DisplayType == DatabaseObjectDisplayType.Script)
            {
                UC_SqlQuery sqlQuery = this.GetUcControl <UC_SqlQuery>(tabPage);

                if (sqlQuery == null)
                {
                    sqlQuery = this.AddControlToTabPage <UC_SqlQuery>(tabPage);
                }

                sqlQuery.Show(info);

                if (!string.IsNullOrEmpty(sqlQuery.Editor.Text))
                {
                    RichTextBoxHelper.Highlighting(sqlQuery.Editor, info.DatabaseType, false);

                    if (info.Error != null)
                    {
                        RichTextBoxHelper.HighlightingError(sqlQuery.Editor, info.Error);
                    }
                }
                else
                {
                    sqlQuery.Editor.Focus();
                }
            }
            else if (info.DisplayType == DatabaseObjectDisplayType.Data)
            {
                UC_DataViewer dataViewer = this.GetUcControl <UC_DataViewer>(tabPage);

                if (dataViewer == null)
                {
                    dataViewer = this.AddControlToTabPage <UC_DataViewer>(tabPage);
                    dataViewer.OnDataFilter += this.DataFilter;
                }

                dataViewer.Show(info);
            }
            else if (info.DisplayType == DatabaseObjectDisplayType.TableDesigner)
            {
                UC_TableDesigner tableDesigner = this.GetUcControl <UC_TableDesigner>(tabPage);

                if (tableDesigner == null)
                {
                    tableDesigner             = this.AddControlToTabPage <UC_TableDesigner>(tabPage);
                    tableDesigner.OnFeedback += this.Feedback;
                }

                tableDesigner.Show(info);
            }
        }