Cosmos/source/Cosmos.VS.Windows/ToolWindows/DataBytesUC.xaml.cs
2017-12-07 19:13:31 +00:00

51 lines
1.1 KiB
C#

using System;
using System.Windows.Controls;
using System.Windows.Media;
namespace Cosmos.VS.Windows {
public partial class DataBytesUC : UserControl {
public DataBytesUC() {
InitializeComponent();
}
protected void UpdateDisplay() {
if (mValue.HasValue) {
tblkData.Text = mPrefix + mValue.Value.ToString("X" + mDigits);
} else {
tblkData.Text = mPrefix + (new string('-', mDigits));
}
tblkData.Foreground = mPrevValue == mValue ? Brushes.Black : Brushes.Red;
}
protected UInt32? mPrevValue;
protected UInt32? mValue;
public UInt32? Value {
get { return mValue; }
set {
mValue = value;
UpdateDisplay();
mPrevValue = mValue;
}
}
protected string mPrefix = "0x";
public string Prefix {
get { return mPrefix; }
set {
mPrefix = value;
UpdateDisplay();
}
}
protected int mDigits = 8;
public int Digits {
get { return mDigits; }
set {
mDigits = value;
UpdateDisplay();
}
}
}
}