public QueryPropertiesWindow(ChildWindow childWindow, DatabaseSchemaView schemaView)
        {
            InitializeComponent();

            _childWindow  = childWindow;
            _dbSchemaView = schemaView;

            linkAddObject.Visibility = Visibility.Collapsed;

            // SQL Formatting options ============================
            // main query
            _linkToPageFormatting.Add(LinkMain, new MainQueryTab(childWindow.SqlFormattingOptions));
            _linkToPageFormatting.Add(LinkMainCommon, new CommonTab(childWindow.SqlFormattingOptions, childWindow.SqlFormattingOptions.MainQueryFormat));
            _linkToPageFormatting.Add(LinkMainExpressions, new ExpressionsTab(childWindow.SqlFormattingOptions, childWindow.SqlFormattingOptions.MainQueryFormat));
            // CTE query
            _linkToPageFormatting.Add(LinkCte, new SubQueryTab(childWindow.SqlFormattingOptions, SubQueryType.Cte));
            _linkToPageFormatting.Add(LinkCteCommon, new CommonTab(childWindow.SqlFormattingOptions, childWindow.SqlFormattingOptions.CTESubQueryFormat));
            _linkToPageFormatting.Add(LinkCteExpressions, new ExpressionsTab(childWindow.SqlFormattingOptions, childWindow.SqlFormattingOptions.CTESubQueryFormat));
            // Derived table
            _linkToPageFormatting.Add(LinkDerived, new SubQueryTab(childWindow.SqlFormattingOptions, SubQueryType.Derived));
            _linkToPageFormatting.Add(LinkDerivedCommon, new CommonTab(childWindow.SqlFormattingOptions, childWindow.SqlFormattingOptions.DerivedQueryFormat));
            _linkToPageFormatting.Add(LinkDerivedExpressions, new ExpressionsTab(childWindow.SqlFormattingOptions, childWindow.SqlFormattingOptions.DerivedQueryFormat));
            // expression
            _linkToPageFormatting.Add(LinkExpression, new SubQueryTab(childWindow.SqlFormattingOptions, SubQueryType.Expression));
            _linkToPageFormatting.Add(LinkExpressionCommon, new CommonTab(childWindow.SqlFormattingOptions, childWindow.SqlFormattingOptions.ExpressionSubQueryFormat));
            _linkToPageFormatting.Add(LinkExpressionExpressions, new ExpressionsTab(childWindow.SqlFormattingOptions, childWindow.SqlFormattingOptions.ExpressionSubQueryFormat));

            _sqlGenerationControl = new SqlGenerationPage(childWindow.SqlGenerationOptions, childWindow.SqlFormattingOptions);
            _linkToPageGeneral.Add(linkBehavior, GetPropertyPage(new ObjectProperties(childWindow.ContentControl.BehaviorOptions)));
            _linkToPageGeneral.Add(linkSchemaView, GetPropertyPage(new ObjectProperties(schemaView.Options)));
            _linkToPageGeneral.Add(linkDesignPane, GetPropertyPage(new ObjectProperties(childWindow.ContentControl.DesignPaneOptions)));
            _linkToPageGeneral.Add(linkVisual, GetPropertyPage(new ObjectProperties(childWindow.ContentControl.VisualOptions)));
            _linkToPageGeneral.Add(linkDatasource, GetPropertyPage(new ObjectProperties(childWindow.ContentControl.DataSourceOptions)));
            _linkToPageGeneral.Add(linkMetadataLoading, GetPropertyPage(new ObjectProperties(childWindow.ContentControl.MetadataLoadingOptions)));
            _linkToPageGeneral.Add(linkMetadataStructure, GetPropertyPage(new ObjectProperties(childWindow.ContentControl.MetadataStructureOptions)));
            _linkToPageGeneral.Add(linkQueryColumnList, GetPropertyPage(new ObjectProperties(childWindow.ContentControl.QueryColumnListOptions)));
            _linkToPageGeneral.Add(linkQueryNavBar, GetPropertyPage(new ObjectProperties(childWindow.ContentControl.QueryNavBarOptions)));
            _linkToPageGeneral.Add(linkUserInterface, GetPropertyPage(new ObjectProperties(childWindow.ContentControl.UserInterfaceOptions)));
            _linkToPageGeneral.Add(linkExpressionEditor, GetPropertyPage(new ObjectProperties(childWindow.ContentControl.ExpressionEditorOptions)));

            _textEditorOptions.Assign(childWindow.ContentControl.TextEditorOptions);
            _textEditorOptions.Updated += TextEditorOptionsOnUpdated;
            _linkToPageGeneral.Add(linkTextEditor, GetPropertyPage(new ObjectProperties(_textEditorOptions)));

            _textEditorSqlOptions.Assign(childWindow.ContentControl.TextEditorSqlOptions);
            _textEditorSqlOptions.Updated += TextEditorOptionsOnUpdated;
            _linkToPageGeneral.Add(linkTextEditorSql, GetPropertyPage(new ObjectProperties(_textEditorSqlOptions)));

            GeneralLinkClick(linkGeneration, null);
            FormattingLinkClick(LinkMain, null);

            childWindow.MetadataStructureOptions.Updated += MetadataStructureOptionsOnUpdated;
        }
        public QueryPropertiesForm(ChildForm childForm, DatabaseSchemaView dbView)
        {
            InitializeComponent();
            LocalizeGroups();
            _childForm = childForm;
            _dbView    = dbView;

            _linkToPage1.Add(linkSqlGeneration, new SqlGenerationPage(childForm.SqlGenerationOptions, childForm.SqlFormattingOptions));

            // create and register property pages ==================================
            // BehaviorOptions page
            RegisterPropertyPage(linkBehaviorOptions, new ObjectProperties(childForm.BehaviorOptions));
            // DatabaseSchemaViewOptions page
            RegisterPropertyPage(linkDatabaseSchemaView, new ObjectProperties(dbView.Options));
            // DesignPaneOptions page
            RegisterPropertyPage(linkDesignPane, new ObjectProperties(childForm.DesignPaneOptions));
            // VisualOptions page
            RegisterPropertyPage(linkVisualOptions, new ObjectProperties(childForm.VisualOptions));
            // AddObjectDialogOptions page
            RegisterPropertyPage(linkAddObjectDialog, new ObjectProperties(childForm.AddObjectDialogOptions));
            // DataSourceOptions page
            RegisterPropertyPage(linkDatasourceOptions, new ObjectProperties(childForm.DataSourceOptions));
            // QueryColumnListOptions page
            RegisterPropertyPage(linkQueryColumnList, new ObjectProperties(childForm.QueryColumnListOptions));
            // QueryNavBarOptions
            RegisterPropertyPage(linkQueryNavBar, new ObjectProperties(childForm.QueryNavBarOptions));
            // UserInterfaceOptions
            RegisterPropertyPage(linkQueryView, new ObjectProperties(childForm.UserInterfaceOptions));

            RegisterPropertyPage(lbExpressionEditor, new ObjectProperties(childForm.ExpressionEditorOptions));

            _textEditorOptions.Assign(childForm.TextEditorOptions);
            _textEditorOptions.Updated += TextEditorOptionsOnUpdated;
            RegisterPropertyPage(lbTextEditor, new ObjectProperties(_textEditorOptions));

            _textEditorSqlOptions.Assign(childForm.TextEditorSqlOptions);
            _textEditorSqlOptions.Updated += TextEditorOptionsOnUpdated;
            RegisterPropertyPage(lbTextEditorSql, new ObjectProperties(_textEditorSqlOptions));

            childForm.MetadataStructureOptions.Updated += MetadataStructureOptionsOnUpdated;

            // SQL Formatting options ============================
            // main query
            _linkToPage2.Add(linkMain, new MainQueryTab(childForm.SqlFormattingOptions));
            _linkToPage2.Add(linkMainCommon, new CommonTab(childForm.SqlFormattingOptions, childForm.SqlFormattingOptions.MainQueryFormat));
            _linkToPage2.Add(linkMainExpressions, new ExpressionsTab(childForm.SqlFormattingOptions, childForm.SqlFormattingOptions.MainQueryFormat));
            // CTE query
            _linkToPage2.Add(linkCte, new SubQueryTab(childForm.SqlFormattingOptions, SubQueryType.Cte));
            _linkToPage2.Add(linkCteCommon, new CommonTab(childForm.SqlFormattingOptions, childForm.SqlFormattingOptions.CTESubQueryFormat));
            _linkToPage2.Add(linkCteExpressions, new ExpressionsTab(childForm.SqlFormattingOptions, childForm.SqlFormattingOptions.CTESubQueryFormat));
            // Derived table
            _linkToPage2.Add(linkDerived, new SubQueryTab(childForm.SqlFormattingOptions, SubQueryType.Derived));
            _linkToPage2.Add(linkDerivedCommon, new CommonTab(childForm.SqlFormattingOptions, childForm.SqlFormattingOptions.DerivedQueryFormat));
            _linkToPage2.Add(linkDerivedExpressions, new ExpressionsTab(childForm.SqlFormattingOptions, childForm.SqlFormattingOptions.DerivedQueryFormat));
            // expression
            _linkToPage2.Add(linkExpression, new SubQueryTab(childForm.SqlFormattingOptions, SubQueryType.Expression));
            _linkToPage2.Add(linkExpressionCommon, new CommonTab(childForm.SqlFormattingOptions, childForm.SqlFormattingOptions.ExpressionSubQueryFormat));
            _linkToPage2.Add(linkExpressionExpressions, new ExpressionsTab(childForm.SqlFormattingOptions, childForm.SqlFormattingOptions.ExpressionSubQueryFormat));

            // Activate the first page on tab1
            SideMenu1_LinkClicked(linkSqlGeneration,
                                  new LinkLabelLinkClickedEventArgs(linkSqlGeneration.Links[0], MouseButtons.Left));
            // Activate the first page on tab2
            SideMenu2_LinkClicked(linkMain,
                                  new LinkLabelLinkClickedEventArgs(linkMain.Links[0], MouseButtons.Left));
        }