public void ShowListView() { listView1.Items.Clear(); ArrayList arr = Model.LoadData(); for (int i = 0; i < arr.Count; i++) { HotkeyItem a = (HotkeyItem)arr[i]; listView1.Items.Add(i.ToString()); int j = listView1.Items.Count - 1; listView1.Items[j].SubItems.Add(a.getHotkey()); listView1.Items[j].SubItems.Add(a.Description); listView1.Items[j].SubItems.Add(a.AudioFile.Substring(a.AudioFile.LastIndexOf('\\') + 1)); } }
private void btnAdd_Click(object sender, EventArgs e) { HotkeyItem a = getHotkeyItemInForm(); String validate_hotkey = ValidateHotkeyItem(a); if (validate_hotkey != "true") { Form1.ShowMessage(validate_hotkey); } else if (Model.Add(a)) { ShowListView(); btnEdit.Enabled = false; btnRemove.Enabled = false; } else { Form1.ShowMessage("Hotkey " + a.getHotkey() + " is already exist"); } }