Ejemplo n.º 1
0
        ////private bool Disconnect(DatabaseNode node)
        ////{
        ////    try {
        ////        node.Disconnect();
        ////        return true;
        ////    } catch (DbException e) {
        ////        MessageBox.Show(this, e.Message, "Error Disconnecting", MessageBoxButtons.OK, MessageBoxIcon.Error);
        ////    }
        ////    return false;
        ////}

        private void openTableDataMenuItem_Click(object sender, EventArgs e)
        {
            var tableNode = (TableNode)treeView.SelectedNode;

            if (tableNode != null)
            {
                var      table    = tableNode.Table;
                var      key      = table.Database.Name + '.' + table.Name;
                Document document = GetDocument(key);

                if (document != null)
                {
                    document.Activate();
                    if (MessageBox.Show(this, "A copy of this table is already open.\r\nDo you want to open another copy?",
                                        "Table: " + key, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
                    {
                        return;
                    }
                }

                document      = new TableDocument(table);
                document.Text = key;
                document.Show(this.DockPanel);
            }
        }
Ejemplo n.º 2
0
        private void openDataWithFilterToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var tableNode = (TableNode)treeView.SelectedNode;

            if (tableNode != null)
            {
                var table = tableNode.Table;
                var key   = table.Database.Name + '.' + table.Name;

                using (FilterDialog filterDialog = new FilterDialog(new TableFilter(table))) {
                    filterDialog.Text          = "Open with filter: " + key;
                    filterDialog.ControlBox    = true;
                    filterDialog.ShowIcon      = false;
                    filterDialog.StartPosition = FormStartPosition.CenterParent;
                    if (filterDialog.ShowDialog(this) == DialogResult.OK)
                    {
                        var filter   = filterDialog.Filter;
                        var document = new TableDocument(table, filter);
                        document.Text = key;
                        document.Show(this.DockPanel);
                    }
                }
            }
        }