private void btnAddQuery_Click(object sender, RoutedEventArgs e)
        {
            var link = new AppDBQueryLink(new AppDBDummyQuery(0, connectionId, "New Query", string.Empty));
            var frm  = new frmQueryEdit();

            frm.Initialize(link, DBConnection);

            bool?b = frm.ShowDialog();

            if (b == true)
            {
                btnRefreshQuery.IsEnabled = false;

                var editable = (IAppDBEditableQueries)appDB;
                editable.SaveQuery(link);

                Reload();
            }
        }
        private void btnEditQuery_Click(object sender, RoutedEventArgs e)
        {
            var row = cmbQueries.SelectedItem;

            if (row != null)
            {
                var link = new AppDBQueryLink(row);

                var frm = new frmQueryEdit();
                frm.Initialize(link, DBConnection);

                bool?b = frm.ShowDialog();
                if (b == true)
                {
                    btnRefreshQuery.IsEnabled = false;

                    var editable = (IAppDBEditableQueries)appDB;
                    editable.SaveQuery(link);

                    // we don't have to do Reload() here, the object (row) should be edited directly, but we still need to reset CurrentQuery (used by GoQuery button)
                    cmbQueries_SelectionChanged(cmbQueries, null);
                }
            }
        }
        private void btnEditQuery_Click(object sender, RoutedEventArgs e)
        {
            var row = cmbQueries.SelectedItem;
            if (row != null)
            {
                var link = new AppDBQueryLink(row);

                var frm = new frmQueryEdit();
                frm.Initialize(link, DBConnection);

                bool? b = frm.ShowDialog();
                if (b == true)
                {
                    btnRefreshQuery.IsEnabled = false;

                    var editable = (IAppDBEditableQueries)appDB;
                    editable.SaveQuery(link);

                    // we don't have to do Reload() here, the object (row) should be edited directly, but we still need to reset CurrentQuery (used by GoQuery button)
                    cmbQueries_SelectionChanged(cmbQueries, null);
                }
            }
        }
        private void btnAddQuery_Click(object sender, RoutedEventArgs e)
        {
            var link = new AppDBQueryLink(new AppDBDummyQuery(0, connectionId, "New Query", string.Empty));
            var frm = new frmQueryEdit();
            frm.Initialize(link, DBConnection);

            bool? b = frm.ShowDialog();
            if (b == true)
            {
                btnRefreshQuery.IsEnabled = false;

                var editable = (IAppDBEditableQueries)appDB;
                editable.SaveQuery(link);

                Reload();
            }
        }