예제 #1
0
        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);
        }
예제 #2
0
 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;
         }
     }
 }
예제 #3
0
        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);
        }
예제 #4
0
 public void MoveNode(RdcTreeNode node, GroupBase newParent)
 {
     if (newParent == null || !newParent.HandleMove(node))
     {
         Operation(OperationBehavior.RestoreSelected, delegate
         {
             if (node.Parent == null)
             {
                 base.Nodes.Remove(node);
                 OnGroupChanged(RootNode, ChangeType.TreeChanged);
             }
             else
             {
                 if (node is ServerBase)
                 {
                     TemporaryServer temporaryServer = (node as ServerBase).ServerNode as TemporaryServer;
                     if (temporaryServer != null)
                     {
                         node = temporaryServer;
                     }
                 }
                 GroupBase groupBase = node.Parent as GroupBase;
                 groupBase.Nodes.Remove(node);
                 OnGroupChanged(groupBase, ChangeType.TreeChanged);
             }
             if (newParent == null)
             {
                 base.Nodes.Add(node);
                 OnGroupChanged(RootNode, ChangeType.TreeChanged);
             }
             else
             {
                 newParent.Nodes.Add(node);
                 OnGroupChanged(newParent, ChangeType.TreeChanged);
             }
             OnNodeChanged(node, ChangeType.TreeChanged);
             if (!node.IsVisible)
             {
                 node.EnsureVisible();
             }
         });
     }
 }