public void UpdateMemoryWords(MemoryWordFormat addressFormat, MemoryWordFormat valueFormat) { _addressRangeFormatString = GetFormat(addressFormat, _firstAddress) + "-" + GetFormat(addressFormat, _lastAddress); foreach (var memoryWord in _memoryWords) { memoryWord.UpdateAddressFormat(addressFormat); memoryWord.UpdateValueFormat(valueFormat); } }
private string GetFormat(MemoryWordFormat format, uint value, bool usePrefix=true) { switch (format) { case MemoryWordFormat.Decimal: return "" + value; case MemoryWordFormat.Hexa: var s = ""; if (usePrefix) s = "0x"; return s + value.ToString("x2"); case MemoryWordFormat.Binary: return Convert.ToString(value, 2); } return ""; }
private string GetFormat(MemoryWordFormat format, uint value, bool usePrefix = true) { switch (format) { case MemoryWordFormat.Decimal: return("" + value); case MemoryWordFormat.Hexa: var s = ""; if (usePrefix) { s = "0x"; } return(s + value.ToString("x2")); case MemoryWordFormat.Binary: return(Convert.ToString(value, 2)); } return(""); }
public void UpdateValueFormat(MemoryWordFormat valueFormat) { _valueFormatString = GetFormat(valueFormat, _value, false); OnPropertyChanged(() => Value); }
public void UpdateAddressFormat(MemoryWordFormat addressFormat) { _addressFormatString = GetFormat(addressFormat, _address); OnPropertyChanged(() => Address); }
public MemoryFormatViewModel(string name, MemoryWordFormat memoryWordFormat) { _name = name; _memoryWordFormat = memoryWordFormat; }