private Int32 GetValueFromNumberBox(NumberBox sender) { switch (sender.CurrentNotation) { case Notation.Decimal: return Convert.ToInt32((sender as NumberBox).Text, 10); case Notation.Heximal: return Convert.ToInt32((sender as NumberBox).Text, 16); default: throw new NotImplementedException(); } }
private void SetValueToNumberBox(NumberBox sender, Int32 newValue) { switch (sender.CurrentNotation) { case Notation.Decimal: sender.Text = String.Format("{0}", newValue); break; case Notation.Heximal: sender.Text = String.Format("{0:X}", newValue); break; default: throw new NotImplementedException(); } }