예제 #1
0
        private static SlideBulk ComposeSlideBulk(PresentationInfo presentationInfo,
            IEnumerable<TechnicalServices.Persistence.SystemPersistence.Presentation.Slide> slideArr)
        {
            XmlSerializableDictionary<int, SlideLinkList> linkDic = new XmlSerializableDictionary<int, SlideLinkList>();
            XmlSerializableDictionary<int, Point> positionDic = new XmlSerializableDictionary<int, Point>();
            SlideBulk slideBulk = new SlideBulk();
            foreach (TechnicalServices.Persistence.SystemPersistence.Presentation.Slide slide in slideArr)
            {
                slideBulk.SlideList.Add(slide);
                positionDic[slide.Id] = presentationInfo.SlidePositionList[slide.Id];
                IList<LinkInfo> linkInfoList;
                if (!presentationInfo.SlideLinkInfoList.TryGetValue(slide.Id, out linkInfoList)) continue;
                foreach (LinkInfo linkInfo in linkInfoList)
                {
                    if (!slideArr.Any(sl => sl.Id == linkInfo.NextSlideId)) continue;
                    SlideLinkList slideLinkList;
                    if (!linkDic.TryGetValue(slide.Id, out slideLinkList))
                    {
                        linkDic[slide.Id] = slideLinkList = new SlideLinkList();
                    }
                    slideLinkList.LinkList.Add(linkInfo.CreateLinkStub());
                }
            }

            slideBulk.LinkDictionary = linkDic;
            slideBulk.SlidePositionList = positionDic;
            return slideBulk;
        }
예제 #2
0
 private void CheckSlideNames(SlideBulk slideBulk)
 {
     HashSet<string> addedSlideName = new HashSet<string>();     //presentation.SlideList.Select(sl => sl.Name)
     foreach (TechnicalServices.Persistence.SystemPersistence.Presentation.Slide slide in slideBulk.SlideList)
     {
         bool isContinue = true;
         while (isContinue && 
             (addedSlideName.Any(name => name.Equals(slide.Name, StringComparison.InvariantCultureIgnoreCase))
             ||
             !_importSlideController.IsSlideUniqueName(slide.Name, string.Empty)))
         {
             string newName;
             isContinue = _importSlideController.GetNewName(
                 string.Format("Сцена с названием {0} уже есть в сценарии. Введите другое название", slide.Name), out newName);
             slide.Name = newName;
         }
         addedSlideName.Add(slide.Name);
         if (!isContinue) throw new InterruptOperationException(slide.Name);
     }
 }
예제 #3
0
 public void SaveSlideBulk(string fileName, SlideBulk slideBulk)
 {
     throw new System.NotImplementedException();
 }
예제 #4
0
 private void AddSlideAndLink(TechnicalServices.Persistence.SystemPersistence.Presentation.Presentation presentation,
     SlideBulk slideBulk)
 {
     //SetInitialPosition(presentation.SlidePositionList.Values, slideBulk.SlidePositionList.Values);
     // слайды
     // айдишники меняются, так что запоминаем те которые были
     Dictionary<int, int> oldNewIdMapping = new Dictionary<int, int>(slideBulk.SlideList.Count);
     foreach (TechnicalServices.Persistence.SystemPersistence.Presentation.Slide slide in slideBulk.SlideList)
     {
         int oldId = slide.Id;
         if (slide.LabelId != Label.NullId
             && presentation.SlideList.Select(sl=>sl.LabelId).Where(lb=>lb != Label.NullId).Any(
             lb=>lb == slide.LabelId))
         {
             slide.LabelId = Label.NullId;
         }
         _importSlideController.AddSlide(slide);
             //, GetPoint(slideBulk.SlidePositionList[slide.Id]));
         oldNewIdMapping[slide.Id] = oldId;
     }
     // линки
     foreach (TechnicalServices.Persistence.SystemPersistence.Presentation.Slide slide in slideBulk.SlideList)
     {
         SlideLinkList slideLinkList;
         if (!slideBulk.LinkDictionary.TryGetValue(oldNewIdMapping[slide.Id], out slideLinkList)) continue;
         foreach (Link link in slideLinkList.LinkList.OrderByDescending(ln=>ln.IsDefault))
         {
             _importSlideController.AddLink(slide, link.NextSlide);
         }
     }
 }
 public void SaveSlideBulk(string fileName, SlideBulk slideBulk)
 {
     _presentationDAL.SaveSlideBulk(fileName, slideBulk);
 }
예제 #6
0
 private void SaveToDisk(string fileName, SlideBulk slideBulk)
 {
     _standalonePresentationWorker.SaveSlideBulk(fileName, slideBulk);
 }