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.
Trek-12/source/Trek-12/Models/Game/OperationCell.cs

55 lines
1.4 KiB

using System.ComponentModel;
namespace Models.Game
{
/// <summary>
/// Represents a cell in the operation grid of the game.
/// </summary>
public class OperationCell : Position, INotifyPropertyChanged
{
/// <summary>
/// It tells if the operation is checked or not in the operation grid of the game.
/// </summary>
private bool isChecked;
public bool IsChecked
{
get => isChecked;
set
{
if (isChecked == value)
return;
isChecked = value;
OnPropertyChanged("IsChecked");
}
}
/// <summary>
/// Constructor of the OperationCell class.
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
public OperationCell(int x, int y) : base(x, y)
{
IsChecked = false;
}
public event PropertyChangedEventHandler? PropertyChanged;
void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
/// <summary>
/// Check the operation cell.
/// </summary>
public void Check()
{
IsChecked = true;
}
}
}