private IEnumerable <TElement> Load(IEnumerable <Tuple <Id <FileInProject>, DocumentPath> > withFileIdsAndInfos) { List <Tuple <Id <FileInProject>, DocumentPath, TElement> > toLoad = new List <Tuple <Id <FileInProject>, DocumentPath, TElement> >(); foreach (var fileInfo in withFileIdsAndInfos) { TryAddToLoadList(toLoad, fileInfo.Item1, fileInfo.Item2); } List <TElement> result = m_loader(toLoad.Select(t => Tuple.Create(t.Item1, t.Item2))).ToList(); using (m_suppressibleGotChanged.SuppressCallback()) { for (int i = 0; i < result.Count; i++) { var conversation = result[i]; TElement existing = toLoad[i].Item3; m_data[conversation.Id] = conversation; if (existing != null) { Reloaded.Execute(existing, conversation); } else { Added.Execute(conversation); } } } return(this); }
public static void TestManySuppression() { bool triggered = false; SuppressibleAction action = new SuppressibleAction(() => { triggered = true; }); { using (action.SuppressCallback()) { using (action.SuppressCallback()) { Assert.True(action.Suppressed); var executed = action.TryExecute(); Assert.False(executed); Assert.False(triggered); } Assert.False(triggered); Assert.True(action.Suppressed); } Assert.True(triggered); Assert.False(action.Suppressed); } }
public IDisposable SuppressValueChanged() { return(m_valueChanged.SuppressCallback()); }
public IDisposable SuppressCallback() { return(m_suppressibleValueChanged.SuppressCallback()); }