private void listView2_DoubleClick(object sender, EventArgs e) { var selectedItem = listView2.SelectedItems[0] as CustomListItem; if (selectedItem == null) return; var diag = new ChangeValueDialog(selectedItem, "Memory Location ", "Change Memory Value"); diag.ShowDialog(); if (diag.DialogResult == DialogResult.OK) { selectedItem.Value = diag.ReturnValue; _cpu.Store(selectedItem.Idx << 2, selectedItem.Value); } }
private void listView1_DoubleClick(object sender, EventArgs e) { if(listView1.SelectedItems.Count == 0) return; var selectedItem = listView1.SelectedItems[0] as CustomListItem; if (selectedItem == null || selectedItem.Idx == 0) return; var diag = new ChangeValueDialog(selectedItem, "Register $", "Change Register Value"); diag.ShowDialog(); if (diag.DialogResult == DialogResult.OK) { selectedItem.Value = diag.ReturnValue; _cpu.RegWrite(selectedItem.Idx, selectedItem.Value); } }