/// <summary> /// Updates the register view /// </summary> private void UpdateRegisterView() { bool updated = false; for (int i = 0; i < 31; i++) { RegisterItem regItem = this.registers[i]; int getValue = this.virtualMachine.GetRegisterValue(regItem.GetRegister()); if (regItem.Value != getValue) { regItem.Value = getValue; updated = true; } } //Update the register view if (updated) { this.RegistersView.Dispatcher.Invoke(() => { this.RegistersView.Items.Refresh(); }); } }
/// <summary> /// Intializes the register list box /// </summary> private void InitializeRegisterListBox() { this.registers = new List <RegisterItem>(); for (int i = 1; i <= 31; i++) { RegisterItem regItem = new RegisterItem() { Register = "R" + i, Value = 0 }; this.registers.Add(regItem); //this.RegistersView.Items[this.RegistersView.Items.Count - 1]; } this.RegistersView.ItemsSource = this.registers; this.RegistersView.AutoGenerateColumns = true; this.RegistersView.CanUserAddRows = false; this.RegistersView.CanUserDeleteRows = false; }