private void RamWatchNewWatch_Load(object sender, EventArgs e) { if (InitialLocation.X > 0 || InitialLocation.Y > 0) { Location = InitialLocation; } _loading = false; SetAddressBoxProperties(); switch (_mode) { default: case Mode.New: switch (MemoryDomains.First().WordSize) { default: case 1: SizeDropDown.SelectedItem = SizeDropDown.Items[0]; break; case 2: SizeDropDown.SelectedItem = SizeDropDown.Items[1]; break; case 4: SizeDropDown.SelectedItem = SizeDropDown.Items[2]; break; } break; case Mode.Duplicate: case Mode.Edit: switch (_watchList[0].Size) { case WatchSize.Byte: SizeDropDown.SelectedItem = SizeDropDown.Items[0]; break; case WatchSize.Word: SizeDropDown.SelectedItem = SizeDropDown.Items[1]; break; case WatchSize.DWord: SizeDropDown.SelectedItem = SizeDropDown.Items[2]; break; } var index = DisplayTypeDropDown.Items.IndexOf(Watch.DisplayTypeToString(_watchList[0].Type)); DisplayTypeDropDown.SelectedItem = DisplayTypeDropDown.Items[index]; if (_watchList.Count > 1) { NotesBox.Enabled = false; NotesBox.Text = string.Empty; AddressBox.Enabled = false; AddressBox.Text = _watchList.Select(a => a.AddressString).Aggregate((addrStr, nextStr) => addrStr + ("," + nextStr)); BigEndianCheckBox.ThreeState = true; if (_watchList.Select(s => s.Size).Distinct().Count() > 1) { DisplayTypeDropDown.Enabled = false; } } else { NotesBox.Text = _watchList[0].Notes; AddressBox.SetFromLong(_watchList[0].Address); } SetBigEndianCheckBox(); DomainDropDown.Enabled = false; break; } }
private void RamWatchNewWatch_Load(object sender, EventArgs e) { if (InitialLocation.X > 0 || InitialLocation.Y > 0) { Location = InitialLocation; } _loading = false; SetAddressBoxProperties(); switch (_mode) { default: case Mode.New: SizeDropDown.SelectedItem = MemoryDomains.First().WordSize switch { 1 => SizeDropDown.Items[0], 2 => SizeDropDown.Items[1], 4 => SizeDropDown.Items[2], _ => SizeDropDown.Items[0] }; break; case Mode.Duplicate: case Mode.Edit: SizeDropDown.SelectedItem = Watches[0].Size switch { WatchSize.Byte => SizeDropDown.Items[0], WatchSize.Word => SizeDropDown.Items[1], WatchSize.DWord => SizeDropDown.Items[2], _ => SizeDropDown.SelectedItem }; var index = DisplayTypeDropDown.Items.IndexOf(Watch.DisplayTypeToString(Watches[0].Type)); DisplayTypeDropDown.SelectedItem = DisplayTypeDropDown.Items[index]; if (Watches.Count > 1) { NotesBox.Enabled = false; NotesBox.Text = ""; AddressBox.Enabled = false; AddressBox.Text = Watches.Select(a => a.AddressString).Aggregate((addrStr, nextStr) => $"{addrStr},{nextStr}"); BigEndianCheckBox.ThreeState = true; if (Watches.Select(s => s.Size).Distinct().Count() > 1) { DisplayTypeDropDown.Enabled = false; } } else { NotesBox.Text = Watches[0].Notes; AddressBox.SetFromLong(Watches[0].Address); } SetBigEndianCheckBox(); DomainDropDown.Enabled = false; break; } }