public void Add(ICharacter character) { if (character != null) { var index = this.itemList.IndexOf(this.currentItem); while (this.itemList.Count != index + 1) { this.itemList.RemoveAt(this.itemList.Count - 1); } this.itemList.Add(new CharacterNavigatorItem(character)); if (this.currentItem != null) { this.currentItem.IsCurrent = false; } this.currentItem = this.itemList.Last(); this.currentItem.IsCurrent = true; this.currentCharacter = this.currentItem.Character; while (this.itemList.Count >= this.MaximumCount) { this.itemList.RemoveAt(0); } this.NotifyOfPropertyChange(nameof(Count)); this.NotifyOfPropertyChange(nameof(CanBackward)); this.NotifyOfPropertyChange(nameof(CanForward)); CommandManager.InvalidateRequerySuggested(); } }
public void Clear() { if (this.currentItem != null) { this.currentItem.IsCurrent = false; } this.currentItem = null; this.currentCharacter = null; this.itemList.Clear(); this.NotifyOfPropertyChange(nameof(Count)); this.NotifyOfPropertyChange(nameof(CanBackward)); this.NotifyOfPropertyChange(nameof(CanForward)); CommandManager.InvalidateRequerySuggested(); }