private void UserControl_Initialized(object sender, EventArgs e) { MessageText.Text = _message; if (_aBtnContent != null) { AffirmativeBtn.Content = _aBtnContent; } if (_bBtnContent != null) { NegativeBtn.Content = _bBtnContent; } if (_icon != FontAwesomeIcon.None) { Icon.Icon = _icon; Icon.Visibility = Visibility.Visible; } if (_affirmativeAction != null || _negativeAction != null) { ButtonsGrd.Visibility = Visibility.Visible; if (_affirmativeAction != null && _negativeAction == null) { NegativeBtn.Visibility = Visibility.Collapsed; AffirmativeBtn.SetValue(Grid.ColumnSpanProperty, 2); } if (_affirmativeAction == null && _negativeAction != null) { AffirmativeBtn.Visibility = Visibility.Collapsed; NegativeBtn.SetValue(Grid.ColumnSpanProperty, 2); } } }
public void PressNumber(int value) { if (value < 0) { EvaluateStringInput(Math.Abs(value).ToString()); NegativeBtn.Click(); } else { EvaluateStringInput(Math.Abs(value).ToString()); } }
public void EvaluateStringInput(string exp) { if (exp[0] == '-') { exp = exp.Substring(1); foreach (char c in exp) { PressKey(c); } NegativeBtn.Click(); } else { exp = exp.Trim(); foreach (char c in exp) { PressKey(c); } } }