/// <summary> /// Add a new child to this node. /// </summary> /// <param name="type"></param> /// <param name="name"></param> public void AddNewChild(NetConfig.Type type, string name) { TreeNode treeNode = null; switch (type) { case NetConfig.Type.Region: var newRegionParams = new NetConfig.RegionParams((NetConfig.RegionParams) this.Params, name); treeNode = new TreeNode(this, newRegionParams); break; case NetConfig.Type.FileSensor: var newFileSensorParams = new NetConfig.FileSensorParams((NetConfig.RegionParams) this.Params, name); treeNode = new TreeNode(this, newFileSensorParams); break; case NetConfig.Type.DatabaseSensor: var newDatabaseSensorParams = new NetConfig.DatabaseSensorParams((NetConfig.RegionParams) this.Params, name); treeNode = new TreeNode(this, newDatabaseSensorParams); break; } this.Children.Add(treeNode); }