using MwFramework.ManagerService; using Stylet; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MainShell.Models { public class RegionModel : PropertyChangedBase , IParameterItem { private int _startRow = 1; private int _startCol = 1; private int _endRow = 1; private int _endCol = 1; public int StartRow { get => _startRow; set { if (SetAndNotify(ref _startRow, value)) OnPropertyChanged(nameof(RowCount)); } } public int StartCol { get => _startCol; set { if (SetAndNotify(ref _startCol, value)) OnPropertyChanged(nameof(ColCount)); } } public int EndRow { get => _endRow; set { if (SetAndNotify(ref _endRow, Math.Max(_startRow, value))) OnPropertyChanged(nameof(RowCount)); } } public int EndCol { get => _endCol; set { if (SetAndNotify(ref _endCol, Math.Max(_startCol, value))) OnPropertyChanged(nameof(ColCount)); } } // 只读属性,方便 UI 显示占用规模 public int RowCount => EndRow - StartRow + 1; public int ColCount => EndCol - StartCol + 1; public IParameterItem Clone() { return MemberwiseClone() as IParameterItem; } } }