private void btnAdd_Click(object sender, EventArgs e) { UserDataEntry userDataNew = new UserDataEntry(); userDataNew.SetValue(new int[0]); SelectedEntry = userDataNew; bool IsEdited = EditData(); if (IsEdited) { ActiveUserData.Add(userDataNew); LoadUserData(userDataNew); } }
private void btnAdd_Click(object sender, EventArgs e) { if (activePane == null) { return; } UserDataEntry userDataNew = ActiveUserData.CreateUserData(); userDataNew.SetValue(new int[0]); SelectedEntry = userDataNew; bool IsEdited = EditData(); if (IsEdited) { ActiveUserData.Entries.Add(userDataNew); LoadUserData(userDataNew); } }
private void LoadUserData(UserDataEntry item) { ListViewItem listItem = new ListViewItem(); listItem.Text = item.Name; listItem.SubItems.Add(item.Type.ToString()); string value = ""; switch (item.Type) { case UserDataType.String: if (item.GetString() != null) { value += $" {item.GetString()}"; } break; case UserDataType.Float: if (item.GetFloats() != null) { foreach (var val in item.GetFloats()) { value += $" {val}"; } } break; case UserDataType.Int: if (item.GetInts() != null) { foreach (var val in item.GetInts()) { value += $" {val}"; } } break; } listItem.SubItems.Add(value); listViewCustom1.Items.Add(listItem); }
private void listViewCustom1_SelectedIndexChanged(object sender, EventArgs e) { if (listViewCustom1.SelectedItems.Count > 0) { btnScrolDown.Enabled = true; btnScrollUp.Enabled = true; btnEdit.Enabled = true; btnRemove.Enabled = true; SelectedEntry = ActiveUserData[listViewCustom1.SelectedIndices[0]]; } else { SelectedEntry = null; btnScrolDown.Enabled = false; btnScrollUp.Enabled = false; btnEdit.Enabled = false; btnRemove.Enabled = false; } }
public void Reset() { ActiveUserData = new List <UserDataEntry>(); SelectedEntry = null; listViewCustom1.Items.Clear(); }