/// <summary> /// 使用指定的参数创建实例。 /// </summary> /// <param name="connId">连接名称。</param> public WinAddConnection(string connId, ConfigOperationType configOperationType) { InitializeComponent(); this.WindowStartupLocation = WindowStartupLocation.CenterScreen; this.IsShowHelp = false; this.configOperationType = configOperationType; if (!string.IsNullOrWhiteSpace(connId)) { this.configId = connId; ConnectionConfig config = GlobalBusiness.GetConnectionConfig(connId); this.tbConnIP.Text = config.IP; this.tbConnPort.Text = config.Port.ToString(); this.tbConnName.Text = config.Name; this.tbConnPassword.Text = config.Password; } }
/// <summary> /// 当连接信息保存完毕时发生。 /// </summary> /// <param name="config"></param> private void WinAddConnection_SavedConnectionConfig(ConnectionConfig config, ConfigOperationType crudType) { if (crudType == ConfigOperationType.ADD) { TreeView tree = this.CreateRootNode(config); this.gridRedisList.Children.Add(tree); } else if (crudType == ConfigOperationType.EDIT) { this.currentSelectedTreeViewItem.Items.Clear(); this.currentSelectedTreeViewItem.Tag = new NodeInfo() { ConfigId = config.Id, Header = config.Name }; this.currentSelectedTreeViewItem.Header = config.Name; } }
/// <summary> /// 使用默认参数创建实例。 /// </summary> public WinAddConnection(ConfigOperationType crudType) : this(null, crudType) { }