public void Remove(Mp3SongViewModel paramMp3SongViewModel) { if (this.Mp3SongViewModels.Remove(paramMp3SongViewModel)) { this.RaisePropertyChanged(() => this.Mp3SongViewModels); return; } this.dialogService.ShowMessage(Resources.DataGridVM_Exception_Remove, string.Format(Resources.DataGridVM_Inner_Exception_Remove, paramMp3SongViewModel.FilePath)); }
private void MoveDownSelectedElements() { for (int i = this.Mp3SongViewModels.Count - 2; i >= 0; i--) { int upperElement = i; int lowerElement = i + 1; if (!this.SelectedMp3SongViewModels.Contains(this.Mp3SongViewModels[lowerElement]) && this.SelectedMp3SongViewModels.Contains(this.Mp3SongViewModels[upperElement])) { Mp3SongViewModel tempMp3SongViewModel = this.Mp3SongViewModels[lowerElement]; this.Mp3SongViewModels.Remove(tempMp3SongViewModel); this.Mp3SongViewModels.Insert(upperElement, tempMp3SongViewModel); } } }
private void MoveUpSelectedElements() { for (int i = 1; i < this.Mp3SongViewModels.Count; i++) { int upperElement = i - 1; int lowerElement = i; if (!this.SelectedMp3SongViewModels.Contains(this.Mp3SongViewModels[upperElement]) && this.SelectedMp3SongViewModels.Contains(this.Mp3SongViewModels[lowerElement])) { Mp3SongViewModel tempMp3SongViewModel = this.Mp3SongViewModels[upperElement]; this.Mp3SongViewModels.Remove(tempMp3SongViewModel); this.Mp3SongViewModels.Insert(lowerElement, tempMp3SongViewModel); } } }
public void AddWhenNew(string paramFilePath) { try { if (!this.IsNewMp3Song(paramFilePath)) { return; } Mp3Song mp3Song = new Mp3Song(this.modelFactory.CreateMp3File(paramFilePath), this.modelFactory.CreateFileModifier()); Mp3SongViewModel mp3SongViewModel = new Mp3SongViewModel(mp3Song, this.dialogService); this.Mp3SongViewModels.Add(mp3SongViewModel); } catch (FileException) { this.dialogService.ShowMessage(Resources.DataGridVM_Exception_Add, string.Format(Resources.DataGridVM_Inner_Exception_Add, paramFilePath)); } }