Beispiel #1
0
 private void ConnectionTree_DoubleClick(object sender, EventArgs e)
 {
     if (ConnectionTree.SelectedNode is CollectionTreeNode)
     {
         var CollectionNode        = ConnectionTree.SelectedNode as CollectionTreeNode;
         var collectionExplorertab = new CollectionExplorerTab(CollectionNode.Server.ConnectionString, CollectionNode.DbName, CollectionNode.CollectionName);
         collectionExplorertab.Server = CollectionNode.Server;
         var tab = new TabPage();
         collectionExplorertab.Dock = DockStyle.Fill;
         tab.Controls.Add(collectionExplorertab);
         tab.Text = CollectionNode.CollectionName;
         CollectionExplorer.Controls.Add(tab);
         CollectionExplorer.SelectedTab = tab;
     }
 }
Beispiel #2
0
        private void BtnDeleteCollection_Click(object sender, EventArgs e)
        {
            var    CollectionNode = ConnectionTree.SelectedNode as CollectionTreeNode;
            string Message        = string.Format("Are You Sure You want to delete '{0}' Collection", CollectionNode.CollectionName);

            if (MessageBox.Show(this, Message, "Delete Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                MongoGeneralLogic.DropCollection(CollectionNode.Server.ConnectionString, CollectionNode.DbName, CollectionNode.CollectionName);
                var parent = CollectionNode.Parent;
                parent.Collapse();
                parent.Expand();
                //Close All Open Tabs OF Collection Explorer
                foreach (TabPage ParentTab in CollectionExplorer.TabPages)
                {
                    CollectionExplorerTab tab = ParentTab.Controls[0] as CollectionExplorerTab;
                    if (tab.Server == CollectionNode.Server && tab.CollectionName == CollectionNode.CollectionName && tab.DbName == CollectionNode.DbName)
                    {
                        CollectionExplorer.TabPages.Remove(tab.Parent as TabPage);
                    }
                }
            }
        }