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 Release GetCurrentRelease() { Release rel = null; try { rel = Releases.Last(); } catch (Exception ex) { MessageBox.Show(string.Format("GetCurrentRelease Error: {0}", ex.Message)); } return(rel); }
private void Update() { foreach (ReleaseScheduleViewModel release in Releases) { release.SuccessfulCheckout -= ReleaseSuccessfulCheckoutHandler; } Releases.Clear(); foreach (Release release in m_model.Releases) { Releases.Add(new ReleaseScheduleViewModel() { Model = release, CheckoutProfiles = m_model.CheckoutProfiles }); Releases.Last().SuccessfulCheckout += ReleaseSuccessfulCheckoutHandler; } TierControl.Project = m_model; }