Esempio n. 1
0
        public static ConnectAsDialog NewConnectAsDialog(RdcTreeNode node, Form parentForm)
        {
            ConnectAsDialog connectAsDialog = new ConnectAsDialog("连接 " + node.Text + " 为", "连接", parentForm);

            connectAsDialog.LogonCredentials   = new LogonCredentials();
            connectAsDialog.ConnectionSettings = new ConnectionSettings();
            if (node.LogonCredentials != null)
            {
                connectAsDialog.LogonCredentials.Copy(node.LogonCredentials);
            }
            if (node.ConnectionSettings != null)
            {
                connectAsDialog.ConnectionSettings.Copy(node.ConnectionSettings);
            }
            connectAsDialog.CreateControls(inputServerName: false, connectAsDialog.LogonCredentials, connectAsDialog.ConnectionSettings, node.FileGroup);
            return(connectAsDialog);
        }
Esempio n. 2
0
        public void DoConnectAs()
        {
            RdcTreeNode rdcTreeNode = this;
            ServerRef   serverRef   = rdcTreeNode as ServerRef;

            if (serverRef != null)
            {
                rdcTreeNode = serverRef.ServerNode;
            }
            using (ConnectAsDialog connectAsDialog = ConnectAsDialog.NewConnectAsDialog(rdcTreeNode, Program.TheForm))
            {
                if (connectAsDialog.ShowDialog() == DialogResult.OK)
                {
                    connectAsDialog.UpdateSettings();
                    ConnectAs(connectAsDialog.LogonCredentials, connectAsDialog.ConnectionSettings);
                }
            }
        }