You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using MVVMTextInputDetection.Model;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
|
|
|
|
|
namespace MVVMTextInputDetection.ViewModel
|
|
|
|
|
{
|
|
|
|
|
class CalculateViewModel : INotifyPropertyChanged
|
|
|
|
|
{
|
|
|
|
|
public Calculate CalculateModel { get; set; }
|
|
|
|
|
|
|
|
|
|
public event PropertyChangedEventHandler? PropertyChanged;
|
|
|
|
|
|
|
|
|
|
public CalculateViewModel()
|
|
|
|
|
{
|
|
|
|
|
this.CalculateModel = new Calculate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int Number
|
|
|
|
|
{
|
|
|
|
|
get { return this.CalculateModel.Number; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
CalculateModel.Number = value;
|
|
|
|
|
OnPropertyChanged("Number");
|
|
|
|
|
|
|
|
|
|
CheckNumberRange(this.CalculateModel.Number);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void CheckNumberRange(int number)
|
|
|
|
|
{
|
|
|
|
|
if (number > 99 || number < 0)
|
|
|
|
|
MessageBox.Show("Number range exceeded!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void OnPropertyChanged(string propertyName)
|
|
|
|
|
{
|
|
|
|
|
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|