public static ConnectToDialog NewConnectToDialog(Form parentForm) { ConnectToDialog connectToDialog = new ConnectToDialog("连接到", "连接", parentForm); connectToDialog.Server = TemporaryServer.CreateForQuickConnect(); connectToDialog.CreateControls(inputServerName: true, connectToDialog.Server.LogonCredentials, connectToDialog.Server.ConnectionSettings, null); return(connectToDialog); }
public static void ConnectTo() { using (ConnectToDialog connectToDialog = ConnectToDialog.NewConnectToDialog(Program.TheForm)) { if (connectToDialog.ShowDialog() == DialogResult.OK) { Server server = TemporaryServer.Create(connectToDialog); server.Connect(); ServerTree.Instance.SelectedNode = server; } } }
public static TemporaryServer Create(ConnectToDialog dlg) { TemporaryServer server = dlg.Server; dlg.UpdateSettings(); server.Properties.ServerName.Value = dlg.QuickConnectTabPage.ServerNameTextBox.Text; server.Properties.DisplayName.Value = dlg.QuickConnectTabPage.ServerNameTextBox.Text; server.LogonCredentials.InheritSettingsType.Mode = InheritanceMode.None; server.ConnectionSettings.InheritSettingsType.Mode = InheritanceMode.None; server.FinishConstruction(ConnectToGroup.Instance); ConnectToGroup.Instance.IsInTree = true; return(server); }