private void NotifyCollectionChangedHandler(object sender, NotifyCollectionChangedEventArgs args) { if (args.Action == NotifyCollectionChangedAction.Add) { foreach (Release release in args.NewItems) { Releases.Add(new ReleaseScheduleViewModel() { Model = release, CheckoutProfiles = m_model.CheckoutProfiles }); Releases.Last().SuccessfulCheckout += ReleaseSuccessfulCheckoutHandler; } } else if (args.Action == NotifyCollectionChangedAction.Remove) { foreach (Release release in args.OldItems) { foreach (ReleaseScheduleViewModel releaseRecordViewModel in Releases.Where(p => p.Model == release).ToList()) { releaseRecordViewModel.SuccessfulCheckout -= ReleaseSuccessfulCheckoutHandler; Releases.Remove(releaseRecordViewModel); } } } //else if (args.Action == NotifyCollectionChangedAction.Replace) //{ // Releases.First(r => r.Model == args.OldItems[0]).Model = args.NewItems[0] as Release; //} }
private void RemoveReleases() { var releases = m_SelectedReleases.Select(a => a.ReleaseId).ToList(); m_ReleasesEntity.Releases = m_ReleasesEntity.Releases .Where(a => !releases.Contains(a)) .ToList(); RefreshSelectedReleases(); var collection = m_DataContext.GetCollection <CinemaHallReleaseEntity> (); collection.Update(m_ReleasesEntity); var deletedReleases = Releases .Where(a => releases.Contains(a.ReleaseId)) .ToList(); foreach (var deletedRelease in deletedReleases) { Releases.Remove(deletedRelease); } IsEmptyList = !m_ReleasesEntity.Releases.Any(); }
public void DeleteExtension(string vsixId) { var extension = GetExtensionByVsixId(vsixId); Projects.Remove(extension.Release.Project); ReleaseRatings.RemoveRange(extension.Release.Ratings); Releases.Remove(extension.Release); Extensions.Remove(extension); SaveChanges(); }
public void Remove(IDbObject idbObject) { if (idbObject is Game) { Games.Remove(idbObject as Game); OnPropertyChanged("FilteredCollection"); } if (idbObject is Release) { Releases.Remove(idbObject as Release); OnPropertyChanged("FilteredCollection"); } }
protected async Task ReleaseLoad() { if (projects != null) { foreach (var proj in projects) { var rs = await relclient.GetDeploymentsAsync(proj.Name).ConfigureAwait(false); foreach (var release in rs) { var old = Releases.FirstOrDefault(x => x.Id == release.Id); var oldbr = BuildRelease.FirstOrDefault(x => x.Id == release.Id); Releases.Remove(old); BuildRelease.Remove(oldbr); release.ProjectReference = new(); release.ProjectReference.Name = proj.Name; Releases.Add(release); BuildRelease br = GetRelease(proj, release); BuildRelease.Add(br); } } } }