using FluentTerminal.Models; using GalaSoft.MvvmLight; namespace FluentTerminal.App.ViewModels.Menu { public class MenuItemViewModelBase : ViewModelBase { #region Properties private string _text; public string Text { get => _text; set => Set(ref _text, value); } private string _description; public string Description { get => _description; set => Set(ref _description, value); } private object _icon; /// /// Defines menu item icon. /// /// /// Acceptable values of this property are: /// /// IconElement /// (usually SymbolIcon /// or FontIcon); /// Symbol enum value, /// which will be used for creating /// SymbolIcon; /// , in which case it'll be converted to /// Symbol enum value; /// , in which case a new /// FontIcon instance will /// be created, whose /// Glyph property /// will be set to the value of this property. /// FontFamily /// property of the newly created instance will be set to "Segoe MDL2 Assets". /// /// public object Icon { get => _icon; set => Set(ref _icon, value); } #endregion Properties #region Constructor protected MenuItemViewModelBase(string text, string description, object icon) { _text = text; _description = description; _icon = icon; } #endregion Constructor #region Methods public virtual bool EquivalentTo(MenuItemViewModelBase other) { if (ReferenceEquals(this, other)) return true; if (other == null) return false; return _text.NullableEqualTo(other._text) && _description.NullableEqualTo(other._description) && (_icon?.Equals(other._icon) ?? other._icon == null); } #endregion Methods } }