/// <summary> /// Event handler for when the delete button is clicked /// Deletes the checked record(s) from the list /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void delete_btn_Click(object sender, EventArgs e) { if (lbl_invalidImportError.Visible) { lbl_invalidImportError.Visible = false; } foreach (ListViewItem iterator in recordListView.SelectedItems) { int id = Convert.ToInt32(iterator.SubItems[5].Text); recordListView.Items.Remove(iterator); this.controller.removeRecord(id); } if (invoker.checkUndoStack() == false) { undoBtn.Enabled = false; } else { undoBtn.Enabled = true; } if (invoker.checkRedoStack() == false) { redoBtn.Enabled = false; } else { redoBtn.Enabled = true; } controller.readRecordListToFile(); SetCollectionInfo(); }
/// <summary> /// Constructor that takes a RecordController object from the LoginForm /// </summary> /// <param name="newController"></param> public ListRecordForm(RecordController newController) { controller = newController; invoker = controller.getInvoker(); reqHandler = new DiscogsRequestHandler(); InitializeComponent(); if (invoker.checkUndoStack() == false) { undoBtn.Enabled = false; } else { undoBtn.Enabled = true; } if (invoker.checkRedoStack() == false) { redoBtn.Enabled = false; } else { redoBtn.Enabled = true; } controller.readRecordListToFile(); this.FormBorderStyle = FormBorderStyle.FixedSingle; this.MaximizeBox = false; this.IsMdiContainer = true; recordListView.View = View.Details; this.populateList(controller.getRecordList().getList()); SetCollectionInfo(); }