Beispiel #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);
        }
Beispiel #2
0
        public TElement New(DirectoryInfo path)
        {
            TElement conversation = m_makeEmpty(path);

            m_data.Add(conversation.Id, conversation);
            Added.Execute(conversation);
            return(conversation);
        }