private void CalendarViewDateTaskChanged_SelectedDatesChanged(CalendarView sender, CalendarViewSelectedDatesChangedEventArgs args) { List <DateTimeOffset> listRemovedDates = args.RemovedDates.ToList(); for (int i = Commits.Count - 1; i >= 0; --i) { if (listRemovedDates.FirstOrDefault(f => f.Date.StartDay() == Commits[i].Date.StartDay()) != default(DateTimeOffset)) { Commits.RemoveAt(i); } } }
/// <summary> /// Appends a new commit in the history. /// IF the commit is already present, it replaces that commit instead /// </summary> /// <param name="commit"></param> public void AppendOrReplaceCommit(Commit commit) { int found = -1; int index = 0; while (index < Commits.Count && found < 0) { Commit other = (Commit)Commits[index]; if (other.Sha == commit.Sha) { found = index; } index += 1; } Commits.Insert(index, commit); commit.setFather(this); if (found >= 0) { Commits.RemoveAt(found); } }