public RTAAPrefixPresenter(IRealTimeAdherenceModel model) { _model = model; _newAddedSet = new List<AdherenceEvent>(50); _removedSet = new List<AdherenceEvent>(50); WhenAdding = o => { IsDirty = true; var e = new AdherenceEvent { Text = o.Text, Start = o.Start.RemoveSeconds(), End = o.End.Second == 0 ? o.End : o.End.AddSeconds(60 - o.End.Second), Remark = "added", Reason = SelectedAbsence }; _newAddedSet.Add(e); return e; }; WhenChanged = o => { IsDirty = true; }; WhenRemoving = o => { IsDirty = true; _newAddedSet.Remove(o); _removedSet.Add(o); }; }
public void DeleteAdhEvent(AdherenceEvent target) { if (AgentAdherenceEvents[CurrentIndex] == null) return; AgentAdherenceEvents[CurrentIndex].SaftyInvoke<List<AdherenceEvent>>(list => { list.Remove(target); _removingAdhEventDelegate(target); this.QuietlyReload(ref _agentAdherenceEvents, "AgentAdherenceEvents"); }); }