/// <summary>
        /// Open a new tab for the selected server, if we can connect to the server.
        /// </summary>
        /// <param name="connection_id">id</param>
        /// <param name="title">connection name to put in the tab header, should probably be accompanied by the id?</param>
        private void ConnectToServer(AppDBServerLink connection)
        {
            try
            {
                var tabcontent = new ConnectionTabControl();

                tabcontent.Height = double.NaN;
                tabcontent.Width  = double.NaN;

                tabcontent.Margin = new Thickness(0, 0, 0, 0);
                tabcontent.HorizontalAlignment = HorizontalAlignment.Stretch;
                tabcontent.VerticalAlignment   = VerticalAlignment.Stretch;

                // setup the datasource to provide querynames
                tabcontent.Initialize(appDB, connection.id);

                // this also connects to the database and will throw an exception when we can't connect
                tabcontent.SetDatabaseConnection((AppDBServerType)connection.type, connection.GetConnectionString());

                // create a new tab with usercontrol instance and stretch align that to the tab
                var tab = new TabItem();

                var header = new CloseableTabHeader(connection.name);
                header.OnClose = () =>
                {
                    // implementation when x button is used on tab
                    pgTabs.Items.Remove(tab);
                    QueryComposerResources.UnsetComposerHelper(tabcontent.DBConnection);
                };
                tab.Header  = header;
                tab.Content = tabcontent;

                pgTabs.Items.Add(tab);
                pgTabs.SelectedIndex = pgTabs.Items.IndexOf(tab);

                // if updatelayout() isn't used, recalculatesize() won't work
                pgTabs.UpdateLayout();
                header.RecalculateSize();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Connecting", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
        /// <summary>
        /// Open a new tab for the selected server, if we can connect to the server.
        /// </summary>
        /// <param name="connection_id">id</param>
        /// <param name="title">connection name to put in the tab header, should probably be accompanied by the id?</param>
        private void ConnectToServer(AppDBServerLink connection)
        {
            try
            {
                var tabcontent = new ConnectionTabControl();

                tabcontent.Height = double.NaN;
                tabcontent.Width = double.NaN;

                tabcontent.Margin = new Thickness(0, 0, 0, 0);
                tabcontent.HorizontalAlignment = HorizontalAlignment.Stretch;
                tabcontent.VerticalAlignment = VerticalAlignment.Stretch;

                // setup the datasource to provide querynames
                tabcontent.Initialize(appDB, connection.id);

                // this also connects to the database and will throw an exception when we can't connect
                tabcontent.SetDatabaseConnection((AppDBServerType)connection.type, connection.GetConnectionString());

                // create a new tab with usercontrol instance and stretch align that to the tab
                var tab = new TabItem();

                var header = new CloseableTabHeader(connection.name);
                header.OnClose = () =>
                {
                    // implementation when x button is used on tab
                    pgTabs.Items.Remove(tab);
                    QueryComposerResources.UnsetComposerHelper(tabcontent.DBConnection);
                };
                tab.Header = header;
                tab.Content = tabcontent;

                pgTabs.Items.Add(tab);
                pgTabs.SelectedIndex = pgTabs.Items.IndexOf(tab);

                // if updatelayout() isn't used, recalculatesize() won't work
                pgTabs.UpdateLayout();
                header.RecalculateSize();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Connecting", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }