private void BtnSelectDestination_Click(object sender, EventArgs e)
        {
            ConnectionsFrm frm = new ConnectionsFrm();

            frm.AsSelection = true;
            frm.ShowDialog();
            if (frm.SelectedServer != null)
            {
                MigrationOptions.DestinationServer = frm.SelectedServer;
                TxtDest.Text = frm.SelectedServer.ToString();
            }
        }
        private void BtnSelectSource_Click(object sender, EventArgs e)
        {
            ConnectionsFrm frm = new ConnectionsFrm();

            frm.AsSelection = true;
            frm.ShowDialog(); if (frm.SelectedServer != null)
            {
                MigrationOptions.SourceServer = frm.SelectedServer;
                TxtSource.Text = frm.SelectedServer.ToString();
                GetCollectionFromSource();
            }
        }
Beispiel #3
0
        void NewConnection(MDTServer server = null)
        {
            var c = new ConnectionsFrm();

            if (server != null || c.ShowDialog() == DialogResult.OK)
            {
                var            CurrentConnection = server ?? Session.CurrentConnections.Last();
                var            ConnectionDb      = MongoGeneralLogic.GetServerDataBases(CurrentConnection);
                string         ConnectionName    = !string.IsNullOrEmpty(CurrentConnection.ConnectionAlias) ? CurrentConnection.ConnectionAlias : CurrentConnection.Server;
                ServerTreeNode connectionNode    = new ServerTreeNode()
                {
                    Text                   = ConnectionName,
                    ImageIndex             = 0,
                    ServerConnectionString = CurrentConnection.ConnectionString,
                    Server                 = CurrentConnection,
                    ContextMenuStrip       = ServerContextMenu,
                };
                foreach (var db in ConnectionDb)
                {
                    var dbTreeNode = new DbTreeNode()
                    {
                        Text                   = db,
                        Name                   = "Db_" + db,
                        ImageIndex             = 1,
                        ContextMenuStrip       = DbContextMenu,
                        DbName                 = db,
                        Server                 = CurrentConnection,
                        ServerConnectionString = CurrentConnection.ConnectionString
                    };
                    dbTreeNode.Nodes.Add("");

                    connectionNode.Nodes.Add(dbTreeNode);
                }
                ConnectionTree.Nodes.Add(connectionNode);
                connectionNode.Expand();
            }
        }