private static object[] GetChildren(TreeNode parent)
        {
            List <object> l = new List <object>();

            if (parent.Nodes != null)
            {
                foreach (TreeNode n in parent.Nodes)
                {
                    if (n.Tag is ManagedConnection)
                    {
                        ManagedConnection mc = n.Tag as ManagedConnection;
                        ServerType        s  = mc.Config;
                        s.DisplayName = n.Text;
                        l.Add(s);
                    }
                    else
                    {
                        FolderType f = new FolderType();
                        f.Name  = n.Text;
                        f.Items = GetChildren(n);
                        f.Name  = n.Text;
                        l.Add(f);
                    }
                }
            }

            return(l.ToArray());
        }
        private void Save()
        {
            ManagedConnection c = currentConnection;

            c.Config.DisplayName = DisplayNameFld.Text;
            c.Config.HostName    = HostNameFld.Text;
            c.Config.Port        = Convert.ToInt32(PortFld.Text);
        }
        public ServerModify(ManagedConnection c)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            ApplyButton       = this.ApplyBtn;
            currentConnection = c;
        }
Exemple #4
0
 private static void OnConnectStateChanged(ManagedConnection mc, bool oldConnectedState, bool newConnectedState)
 {
     if (ConnectStateChanged != null)
     {
         if (oldConnectedState != newConnectedState)
         {
             ConnectStateChanged(mc, newConnectedState);
             oldConnectedState = newConnectedState;
         }
     }
 }
        //public static TreeNode CreateServerNode(string serverName)
        //{
        //    ManagedConnection connection = ManagedConnection.CreateDefaultConnection();
        //    connection.Config.DisplayName = serverName;
        //    return (CreateServerNode(connection));
        //}

        public static TreeNode CreateServerNode(ServerType server)
        {
            ManagedConnection connection = new ManagedConnection(server);

            return(CreateServerNode(connection));
        }
 public ServerModify(string newCaption, ManagedConnection c) : this(c)
 {
     this.Text = newCaption;
 }