private void SetSelected(Link value, bool save) { if (_selectedLink == value) { return; } if (_selectedLink != null) { PreviousSelectedQueue.Remove(value); PreviousSelectedQueue.Enqueue(value); } _selectedLink = value; OnPropertyChanged(nameof(SelectedLink)); if (save && value?.Source != null) { ValuesStorage.Set(KeySelected, value.DisplayName); } }
private void Remove(LinkInput link) { PreviousSelectedQueue.Remove(link); link.PropertyChanged -= Link_PropertyChanged; link.Close -= OnLinkClose; if (SelectedLink == link) { SelectedLink = PreviousSelectedQueue.DequeueOrDefault() ?? Links[Links.IndexOf(link) - 1]; } if (SelectedLink == link) { SelectedLink = Links.FirstOrDefault(); } Links.Remove(link); SaveLinks(); }