private void btnAddConn_Click(object sender, EventArgs e) { _crudOp = CRUDOpType.Add; ClearFileds(); tabControl1.TabPages[1].Selected = true; }
private void btnSave_Click(object sender, EventArgs e) { if (_crudOp == CRUDOpType.NoOp) { return; } if (ValidateConnectionSettings()) { if (_crudOp == CRUDOpType.Add) { _appSettingvalue.AvailableConnections.Add(string.Format("mongodb://{0}:{1}/{2}", txtHost.Text.Trim(), txtPort.Text.Trim(), txtDBname.Text.Trim())); } else { _appSettingvalue.AvailableConnections.RemoveAt(_selectedConnection); _appSettingvalue.AvailableConnections.Insert(_selectedConnection, string.Format("mongodb://{0}:{1}/{2}", txtHost.Text.Trim(), txtPort.Text.Trim(), txtDBname.Text.Trim())); } _appSettingvalue.SaveSettings(Application.LocalUserAppDataPath + @"\apexMongoMonitor.config"); _crudOp = CRUDOpType.NoOp; LoadAvailableConnections(); tabControl1.TabPages[0].Selected = true; } }
private void btnEditConn_Click(object sender, EventArgs e) { if (lstViewAvailableConnections.SelectedIndices.Count < 1) { return; } //Set Value if (_rx.IsMatch(lstViewAvailableConnections.SelectedItems[0].Text)) { MatchCollection mc = _rx.Matches(lstViewAvailableConnections.SelectedItems[0].Text); txtHost.Text = mc[1].Value; txtPort.Text = mc[2].Value; txtDBname.Text = mc[3].Value; } _crudOp = CRUDOpType.Edit; _selectedConnection = lstViewAvailableConnections.SelectedIndices[0]; tabControl1.TabPages[1].Selected = true; }