예제 #1
0
        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);
        }
예제 #2
0
 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);
     }
 }
예제 #3
0
 public IDisposable SuppressValueChanged()
 {
     return(m_valueChanged.SuppressCallback());
 }
예제 #4
0
 public IDisposable SuppressCallback()
 {
     return(m_suppressibleValueChanged.SuppressCallback());
 }