Esempio n. 1
0
        public void Export(string fileName, PresentationInfo presentationInfo,
            TechnicalServices.Persistence.SystemPersistence.Presentation.Slide[] slideToExport)
        {
            try
            {
                if (slideToExport == null || slideToExport.Length == 0) return;
                _continue = _exportSlideController.GetUserInterActive(slideToExport.Length == 1);

                // загружаем сцены
                TechnicalServices.Persistence.SystemPersistence.Presentation.Slide[] slideArr =
                    LoadSlides(presentationInfo, slideToExport);

                // формируем балк для выгрузки
                SlideBulk slideBulk = ComposeSlideBulk(presentationInfo, slideArr);
                // сохраняем на диск
                SaveToDisk(fileName, slideBulk);
                //_exportSlideController.SuccessMessage("Экспорт сцен успешно завершен");
            }
            catch (InterruptOperationException)
            {
                if (slideToExport.Length > 1)
                    _exportSlideController.ErrorMessage(string.Format("Экспорт сцен был прерван пользователем"));
            }
            catch (Exception ex)
            {
                _exportSlideController.ErrorMessage(string.Format("При экспорте сцен произошла неизвестная ошибка: {0}", ex));
            }
        }
Esempio n. 2
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;
        }
 protected override bool IsPresentationExists(PresentationInfo presentationInfo)
 {
     bool isExists = base.IsPresentationExists(presentationInfo);
     if (!isExists)
     {
         _presentationStorage.Remove(presentationInfo.UniqueName);
         _presentationStorageByName.Remove(presentationInfo.Name);
     }
     return isExists;
 }
 public void Export(PresentationInfo[] presentationInfos)
 {
     ExportPresentation exportPresentation = new ExportPresentation(
         DesignerClient.Instance.ClientConfiguration,
         DesignerClient.Instance.PresentationWorker,
         DesignerClient.Instance.StandalonePresentationWorker,
         this);
     using (SimpleClient<IDesignerService> client = new SimpleClient<IDesignerService>())
     {
         client.Open();
         exportPresentation.Export(presentationInfos, client.Channel);
     }
 }
Esempio n. 5
0
        //[Obsolete]
        //public static Presentation SavePresentationLevelChanges(this Presentation presentation, Presentation other)
        //{
        //    presentation.Name = other.Name;
        //    presentation.StartSlide = other.StartSlide;
        //    presentation.Author = other.Author;
        //    presentation.Comment = other.Comment;
        //    // и раскладку слайдов
        //    foreach (Slide slide in presentation.SlideList)
        //    {
        //        if (slide.State == SlideState.New)
        //        {
        //            slide.State = SlideState.Normal;
        //            continue;
        //        }
        //        slide.LinkList.Clear();
        //        Slide otherSlide = other.SlideList.Find(sl => sl.Id == slide.Id);
        //        foreach (Link otherLink in otherSlide.LinkList)
        //        {
        //            slide.LinkList.Add(
        //                new Link()
        //                {IsDefault = otherLink.IsDefault,
        //                 NextSlide = presentation.SlideList.Find (sl => sl.Id == otherLink.NextSlide.Id)
        //                });
        //        }
        //    }
        //    // группы дисплеев
        //    presentation.DisplayGroupList.Clear();
        //    presentation.DisplayGroupList.AddRange(other.DisplayGroupList);
        //    // позиции слайдов
        //    presentation.SlidePositionList.Clear();
        //    foreach (KeyValuePair<int, Point> keyValuePair in other.SlidePositionList)
        //    {
        //        presentation.SlidePositionList.Add(keyValuePair.Key, keyValuePair.Value);
        //    }
        //    return presentation;
        //}

        //public static void ChangeResourceContentPathWithNewName(this Presentation presentation,
        //    string oldName, string newName)
        //{
        //    foreach (Slide slide in presentation.SlideList)
        //    {
        //        slide.ChangeResourceContentPathWithNewName(oldName,newName);            
        //    }
        //}
       
        public static Presentation SavePresentationLevelChanges(this Presentation presentation,
            PresentationInfo presentationInfoOther)
        {
            presentation.Name = presentationInfoOther.Name;
            presentation.StartSlide = presentation.SlideList.Find(
                sl => sl.Id == presentationInfoOther.StartSlideId);
            if (presentation.StartSlide == null)
                throw new Exception(String.Format("Slide {0} not exists",
                    presentationInfoOther.StartSlideId));
            presentation.Author = presentationInfoOther.Author;
            presentation.Comment = presentationInfoOther.Comment;

            // группы дисплеев
            presentation.DisplayGroupList.Clear();
            presentation.DisplayGroupList.AddRange(presentationInfoOther.DisplayGroupList);

            // позиции слайдов
            presentation.SlidePositionList.Clear();
            foreach (KeyValuePair<int, Point> keyValuePair in presentationInfoOther.SlidePositionList)
            {
                presentation.SlidePositionList.Add(keyValuePair.Key, keyValuePair.Value);
            }
            presentation.DisplayPositionList.Clear();
            foreach (KeyValuePair<string, int> keyValuePair in presentationInfoOther.DisplayPositionList)
            {
                presentation.DisplayPositionList.Add(keyValuePair.Key, keyValuePair.Value);
            }

            // линки
            presentation.LinkDictionary.Clear();
            foreach (KeyValuePair<int, IList<LinkInfo>> pair in presentationInfoOther.SlideLinkInfoList)
            {
                SlideLinkList slideLinkList = new SlideLinkList();
                foreach (LinkInfo linkInfo in pair.Value)
                {
                    Link link = new Link();
                    link.IsDefault = linkInfo.IsDefault;
                    link.NextSlide = presentation.SlideList.Find(
                        sl => sl.Id == linkInfo.NextSlideId);
                    if (link.NextSlide == null) throw new Exception(
                        String.Format("Slide {0} not exists", linkInfo.NextSlideId));
                    slideLinkList.LinkList.Add(link);
                }
                presentation.LinkDictionary.Add(pair.Key, slideLinkList);
            }
            return presentation;
        }
 public ExportPresentationCommand(string commandName, PresentationInfo presentationInfo,
     string newPresentationName,
     IPresentationClient remotePresentationClient, IPresentationClient standalonePresentationClient,
     Func<string, bool> delegateForDeletedPresentation)
     : base(commandName)
 {
     _remotePresentationClient = remotePresentationClient;
     _standalonePresentationClient = standalonePresentationClient;
     _standaloneClientResourceCRUD = _standalonePresentationClient.GetResourceCrud();
     _clientPresentationCRUD = _remotePresentationClient.GetPresentationExportCrud();
     _presentationInfo = presentationInfo;
     _newPresentationName = newPresentationName;
     //_presentationService = presentationService;
     _delegateForDeletedPresentation = delegateForDeletedPresentation;
     //_clientPresentationCRUD = new ClientSidePresentationTransfer(directory, presentationClient);
     //_clientSourceStandalone = new ClientSideStandAloneSourceTransfer(standaloneResourceEx);
 }
        public PresentationPropertiesForm(PresentationInfo AInfo, bool creatingNew)
        {
            InitializeComponent();
            _isCreateNew = creatingNew;
            DestInfo = new PresentationInfo(AInfo);
            info = AInfo;

            nameText.Text = DestInfo.Name;
            authorText.Text = DestInfo.Author;
            commentText.Text = DestInfo.Comment;
            //nameText.DataBindings.Add("Text", DestInfo, "Name");
            //authorText.DataBindings.Add("Text", DestInfo, "Author");
            createdLabel.DataBindings.Add("Text", DestInfo, "CreationDate");
            modifiedLabel.DataBindings.Add("Text", DestInfo, "LastChangeDate");
            //commentText.DataBindings.Add("Text", DestInfo, "Comment");
            slideCountLabel.DataBindings.Add("Text", DestInfo, "SlideCount");

            if (creatingNew)
            {
                this.Text = "Создание нового сценария";
                this.modifiedLabel.Visible = false;
                this.label8.Visible = false;
                this.slideCountLabel.Visible = false;
                this.label6.Visible = false;
                this.createdLabel.Visible = false;
                this.label4.Visible = false;
                authorText.ReadOnly = false;
            }
            else
            {
                //https://sentinel2.luxoft.com/sen/issues/browse/PMEDIAINFOVISDEV-1302
                //authorText.ReadOnly = true;
                this.Text = String.Concat(DestInfo.Name, " - Свойства");
            }

        }
        protected Presentation Merge(UserIdentity identity,
                                     PresentationInfo presentationInfo,
                                     Slide[] newSlideArr,
                                     Presentation presentationStored,
                                     out LockingInfo[] lockedSlides,
                                     out Slide[] slideAlreadyExists)
        {
            IEnumerable<Slide> existedSlides = presentationStored.SlideList.Where(
                sl => newSlideArr.Any(newsl=>newsl.Id == sl.Id));
            if (existedSlides.Count() != 0)
            {
                slideAlreadyExists = existedSlides.ToArray();
                lockedSlides = new LockingInfo[] {};
                return null;
            }

            foreach (Slide slide in newSlideArr)
            {
                //Slide slideStored = presentationStored.SlideList.Find(
                //    sl => sl.Id == slide.Id);
                //if (slideStored != null) return null;
                slide.State = SlideState.Normal;
                presentationStored.SlideList.Add(slide);
            }
            // анализ удаленных слайдов
            List<Slide> slideListDeleted = presentationStored.SlideList.FindAll(
                sl => !presentationInfo.SlideInfoList.Exists(sli => sli.Id == sl.Id));
            if (!IsStandAlone)
            {
                IEnumerable<LockingInfo> lockedSl = slideListDeleted.Select(
                    sl => _lockService.GetLockInfo(ObjectKeyCreator.CreateSlideKey(presentationInfo.UniqueName, sl.Id))).Where(
                    li=>li != null);

                if (lockedSl.Count() != 0)
                {
                    lockedSlides = lockedSl.ToArray();
                    slideAlreadyExists = new Slide[] {};
                    return null;
                }
            }
            // удаляем слайды
            presentationStored.SlideList.RemoveAll(slideListDeleted.Contains);
            presentationStored.SavePresentationLevelChanges(presentationInfo);
            slideAlreadyExists = new Slide[] { };
            lockedSlides = new LockingInfo[] { };
            return presentationStored;
        }
 protected virtual void ObjectChanged(UserIdentity userIdentity, IList<ObjectInfo> objectInfoList,
                                       PresentationInfo presentationInfo, bool presentationLevel)
 {
     PresentationChange(presentationInfo);
     if (!presentationLevel)
         SlideChanged(presentationInfo,
                      objectInfoList.Select(oi => oi.ObjectKey).OfType<SlideKey>().Select(sk => sk.Id));
 }
Esempio n. 10
0
 public static string GetPresentationStatusDescr(PresentationInfo info)
 {
     return GetPresentationStatusDescr(info.UniqueName, info.Name);
 }
Esempio n. 11
0
 public static string GetPresentationStatusDescr(PresentationInfo info, PresentationStatus status, UserIdentity id)
 {
     return GetPresentationStatusDescr(info.Name, status, id);
 }
Esempio n. 12
0
 public bool SaveSlideChanges(UserIdentity userIdentity, string presentationUniqueName,
     Slide[] slideToSave, out int[] slideIdNotLocked,
     out ResourceDescriptor[] resourcesNotExists,
     out DeviceResourceDescriptor[] deviceResourcesNotExists,
     out int[] labelNotExists)
 {
     resourcesNotExists = new ResourceDescriptor[] { };
     deviceResourcesNotExists = new DeviceResourceDescriptor[] {};
     labelNotExists =
         slideToSave.Select(sl => sl.LabelId).Where(id=>id>0).Distinct().Except(
             _configuration.LabelStorageAdapter.GetLabelStorage().Select(lb => lb.Id)).ToArray();
     List<int> slideNotLocked = new List<int>(slideToSave.Length);
     slideIdNotLocked = slideNotLocked.ToArray();
     if (labelNotExists.Length != 0) return false;
     if (slideToSave.Length == 0) return true;
     if (!IsStandAlone)
     {
         //Presentation pres = BinarySerializer.Deserialize<Presentation>(presentation);
         // проверка что слайды залочены данным пользователем
         foreach (Slide slide in slideToSave)
         {
             LockingInfo info =
                 _lockService.GetLockInfo(ObjectKeyCreator.CreateSlideKey(presentationUniqueName, slide.Id));
             if (info == null || !info.UserIdentity.Equals(userIdentity))
                 slideNotLocked.Add(slide.Id);
         }
     }
     slideIdNotLocked = slideNotLocked.ToArray();
     string[] deletedEquipment;
     Presentation presentation = _presentationDAL.GetPresentation(presentationUniqueName,
         _sourceDAL, _deviceSourceDAL, out deletedEquipment);
     if (presentation == null) return false;
     PresentationInfo presentationInfo = new PresentationInfo(presentation);
     resourcesNotExists = GetNotExistedResource(slideToSave);
     deviceResourcesNotExists = GetNotExistedDeviceResource(slideToSave, presentationInfo);
     if (slideIdNotLocked.Length != 0 || resourcesNotExists.Length != 0 || deviceResourcesNotExists.Length != 0)
         return false;
     presentation = Merge(presentation, slideToSave);
     if (presentation == null) return false;
     bool isSuccess = _presentationDAL.SavePresentation(userIdentity, presentation);
     if (isSuccess)
     {
         List<ObjectInfo> objectInfoList = new List<ObjectInfo>();
         foreach (Slide slide in slideToSave)
         {
             objectInfoList.Add(new ObjectInfo(userIdentity,
                                               ObjectKeyCreator.CreateSlideKey(presentationUniqueName, slide.Id)));
         }
         PresentationKey presentationKey = ObjectKeyCreator.CreatePresentationKey(presentationUniqueName);
         ObjectChanged(userIdentity, objectInfoList, new PresentationInfo(presentation), false);
     }
     return isSuccess;
 }
Esempio n. 13
0
 public void Init()
 {
     m_presentationInfo = PresentationController.Instance.PresentationInfo;
     SourcesController.CreateSourceController(this, m_presentationInfo);
     m_controller = SourcesController.Instance;
     PresentationController.Instance.OnPresentationLockChanged += new PresentationLockChanged(Instance_OnPresentationLockChanged);
 }
        public PresentationDesignerForm(PresentationInfo aPresentationInfo)
        {
            m_PresentationInfo = aPresentationInfo;
            m_Presentation = aPresentationInfo.CreatePresentationStub();
            PresentationController.CreatePresentationController();
            PresentationController.Instance.PresentationChanged = false;
            PresentationChanged = new Changed(() =>
            {
                this.saveMenuButton.Enabled = PresentationController.Instance.PresentationChanged;
                this.savePresentationToolButton.Enabled = PresentationController.Instance.PresentationChanged;
                this.ChangedStatus.Visible = PresentationController.Instance.PresentationChanged;
                this.ChangedStatus.Text = PresentationController.Instance.ChangedTextStatus;
            });
            PresentationController.Instance.OnChanged += PresentationChanged;
            PresentationController.Instance.OnPresentationLockChanged += new PresentationLockChanged(Instance_OnPresentationLockChanged);
            PresentationController.Instance.OnPresentationRemoved += new Changed(Instance_OnPresentationRemoved);
            PresentationController.Instance.OnPresentationLockedExternally += new PresentationLockedExternally(Instance_OnPresentationLockedExternally);
            PresentationController.Instance.OnPresentationUnlockedExternally += new PresentationUnlockedExternally(Instance_OnPresentationUnlockedExternally);
            PresentationController.Instance.OnSlideSelectionChanged += new SlideSelectionChanged(Instance_OnSlideSelectionChanged);
            PresentationController.Instance.OnOtherUserLockForShow += new SlideChanged(Instance_OnOtherUserLockForShow);
            UndoService.CreateUndoService();
            PresentationController.Instance.AssignPresentation(m_Presentation, m_PresentationInfo);
            InitializeComponent();

            RefreshTitle();
            this.statusStrip.ContextMenuStrip = null;
            this.ChangedStatus.Visible = false;

            this.WindowState = FormWindowState.Maximized;
            UndoService.Instance.OnHistoryChanged += new HistoryChanged(OnHistoryChanged);

            identity = Thread.CurrentPrincipal as UserIdentity;
            slideDiagram.SwitchPlayerMode(false);

            toolStripEx2.Enabled = false;
            PresentationController.Instance.RefreshLockingInfo();


            LockingInfo li = ((PresentationInfoExt)m_PresentationInfo).LockingInfo;
            if (li != null)
            {
                string info = String.Format(lockedByUser, 
                    string.IsNullOrEmpty(li.UserIdentity.User.FullName) ? li.UserIdentity.User.Name : li.UserIdentity.User.FullName,
                    li.RequireLock == RequireLock.ForShow ? "для показа" :  "для редактирования");
                this.LockingStatus.Visible = true;
                this.LockingStatus.Text = info;
                if (li.RequireLock == RequireLock.ForShow)
                {
                    layoutPreviewMenuButton.Enabled = false;
                    previewToolButton.Enabled = false;
                }
            }

            if (layoutPreviewMenuButton.Enabled || previewToolButton.Enabled)
            {
                layoutPreviewMenuButton.Enabled = previewToolButton.Enabled = !LayoutController.Instance.IsShownByPlayer();
            }

            SlideGraphController.Instance.OnSlideHover += new EventHandler<SlideEventArgs>(Instance_OnSlideHover);

            updateMenuButton.Enabled = !DesignerClient.Instance.IsStandAlone;
            refreshDisplayMenuButton.Enabled = !DesignerClient.Instance.IsStandAlone;
            refreshSlidesMenuButton.Enabled = !DesignerClient.Instance.IsStandAlone;
            commonSourcesRefreshMenuButton.Enabled = !DesignerClient.Instance.IsStandAlone;
            equipmentRefreshMenuButton.Enabled = !DesignerClient.Instance.IsStandAlone;
            toXmlMenuButton.Enabled = !DesignerClient.Instance.IsStandAlone;

            LayoutController.Instance.OnShownStatusChanged += new Action<bool>(Instance_OnShownStatusChanged);
            layoutPreviewMenuButton.Visible = previewToolButton.Visible = !DesignerClient.Instance.IsStandAlone;
        }
Esempio n. 15
0
        public CreatePresentationResult CreatePresentation(UserIdentity sender,
            PresentationInfo presentationInfo,
            out int[] labelNotExists)
        {
            labelNotExists = presentationInfo.GetUsedLabels().Except(
                _configuration.LabelStorageAdapter.GetLabelStorage().Select(lb => lb.Id)).ToArray();
            if (labelNotExists.Length != 0) return CreatePresentationResult.LabelNotExists;
            if (null != _presentationDAL.GetPresentationInfo(presentationInfo.UniqueName)) return CreatePresentationResult.SameUniqueNameExists;
            if (null != _presentationDAL.GetPresentationInfoByPresentationName(presentationInfo.Name))
                return CreatePresentationResult.SameNameExists;

            bool isSuccess = _presentationDAL.SavePresentation(sender,
                                                     presentationInfo.CreatePresentationStub());
            if (isSuccess) return CreatePresentationResult.Ok;
            else return CreatePresentationResult.SameNameExists;
        }
 public SavePresentationResult SavePresentationChanges(PresentationInfo presentationInfo, Slide[] slides, out ResourceDescriptor[] notExistedResources, out DeviceResourceDescriptor[] notExistedDeviceResources, out int[] labelNotExists,
     out UserIdentity[] whoLock, out int[] slidesAlreadyExistsId)
 {
     return _presentationClient.Channel.SavePresentationChanges(UserIdentity, presentationInfo, slides, out notExistedResources, out notExistedDeviceResources, out labelNotExists,
         out whoLock, out slidesAlreadyExistsId);
 }
 public CreatePresentationResult CreatePresentation(PresentationInfo presentationInfo, out int[] labelNotExists)
 {
     return _presentationClient.Channel.CreatePresentation(UserIdentity, presentationInfo, out labelNotExists);
 }
Esempio n. 18
0
        public void InitLayoutController()
        {
            m_presentation = PresentationController.Instance.Presentation;
            m_presentationInfo = PresentationController.Instance.PresentationInfo;
            PresentationController.Instance.OnSlideLockChanged += new SlideLockChanged(OnSlideLockChanged);
            PresentationController.Instance.OnSlideLayoutChanged += new SlideLayoutChanged(Instance_OnSlideLayoutChanged);
            PresentationController.Instance.OnSavePresentation += new SavePresentation(Instance_OnSavePresentation);
            UndoService.Instance.OnHistoryChanged += new HistoryChanged(OnHistoryChanged);
            this.Model.HistoryManager.RecordComplete += new EventHandler(HistoryManager_CommandCompleted);
            DesignerClient.Instance.PresentationNotifier.OnResourceAdded += new EventHandler<NotifierEventArg<ResourceDescriptor>>(PresentationNotifier_OnResourceAdded);
            DesignerClient.Instance.PresentationNotifier.OnResourceDeleted += new EventHandler<NotifierEventArg<ResourceDescriptor>>(PresentationNotifier_OnResourceDeleted);
            backProvider = new BackgroundProvider();
            //load background sources
            Dictionary<string, IList<ResourceDescriptor>> _rd = DesignerClient.Instance.PresentationWorker.GetLocalSources(m_presentation.UniqueName);
            foreach (var resource in _rd)
            {
                foreach (ResourceDescriptor r in resource.Value)
                    if (r is BackgroundImageDescriptor)
                    {
                        backgrounds.Add(r.ResourceInfo.Id, (BackgroundImageDescriptor)r);
                    }
            }

            Instance_OnSlideLayoutChanged(PresentationController.Instance.CurrentSlideLayout);
        }
Esempio n. 19
0
 public static PresentationKey CreatePresentationKey(PresentationInfo presentationInfo)
 {
     return new PresentationKey(presentationInfo.UniqueName);
 }
 public PreparePresentationController(PresentationInfo info)
 {
     _info = info;
 }
Esempio n. 21
0
 protected void PresentationChange(PresentationInfo info)
 {
     if (OnPresentationChanged != null)
     {
         OnPresentationChanged.Invoke(this, new PresentationChangedEventArgs(info));
     }
 }
 public PreparePresentationController(PresentationInfo info, int slideId)
 {
     _info = info;
     _slideId = slideId;
 }
Esempio n. 23
0
 protected void SlideChanged(PresentationInfo info, IEnumerable<int> slideIds)
 {
     if (OnSlideChanged != null)
     {
         OnSlideChanged.Invoke(this, new SlideChangedEventArgs(info.UniqueName, slideIds));
     }
 }
Esempio n. 24
0
        public void Export(PresentationInfo[] presentationInfos,
            IDesignerService designerService)
        {
            if (presentationInfos == null || presentationInfos.Length == 0) return;
            try
            {
                //if (!ExportPresentationController.Instanse.ConfirmExport(presentationInfos.Select(pi => pi.Name)))
                //    return;
                string newPresentationName;
                if (!_exportPresentationController.ConfirmExport(_config.ScenarioFolder, "*.xml", presentationInfos.Select(pi => pi.Name), out newPresentationName))
                    return;

                CommandInvoker invoker = new CommandInvoker();

                //IContinue isContinue =
                //    ExportPresentationController.Instanse.GetUserInteractive(presentationInfos.Length == 1);
                IContinue isContinue =
                    _exportPresentationController.GetUserInteractive(presentationInfos.Length == 1);

                // сначала экспортируем схемы для презентации
                ExportPresentationSchemaFilesCommand exportPresentationSchemaFilesCommand =
                    new ExportPresentationSchemaFilesCommand(string.Format("экспорт файлов-схем для сценария"),
                                                             _remotePresentationClient, _config.ScenarioFolder);

                invoker.AddCommand(exportPresentationSchemaFilesCommand);

                // теперь для каждой презентации своя команда
                //List<TechnicalServices.Common.Command> presentationExportCommandList =
                //    new List<TechnicalServices.Common.Command>(presentationInfos.Length);
                foreach (PresentationInfo presentationInfo in presentationInfos)
                {
                    //presentationExportCommandList.Add(
                    Command exportPresentationCommand =
                    new ExportPresentationCommand(string.Format("Экспорт сценария {0}", presentationInfo.Name),
                                                      presentationInfo,
                                                      presentationInfos.Length == 1 ? newPresentationName : null,
                                                      _remotePresentationClient,
                                                      _standalonePresentationClient,
                                                      new Func<string, bool>(isContinue.Continue));
                    invoker.AddCommand(exportPresentationCommand);
                }

                // экспорт глобальных сорсов
                ExportGlobalSourcesCommand exportGlobalSourcesCommand = new
                    ExportGlobalSourcesCommand("Экспорт глобальных источников",
                                               _remotePresentationClient,
                                               _standalonePresentationClient);

                invoker.AddCommand(exportGlobalSourcesCommand);

                // выполняем
                bool isSuccess = CommandInvoker.Execute(invoker);

                //ExportPresentationController.Instanse.SuccessMessage("Экспорт презентаций успешно завершен");
                if (isSuccess)
                    _exportPresentationController.SuccessMessage("Экспорт сценариев успешно завершен");
            }
            catch (InterruptOperationException)
            {
                _exportPresentationController.ErrorMessage(string.Format("Экспорт сценариев был прерван пользователем"));
                //ExportPresentationController.Instanse.ErrorMessage(
                //    string.Format("Экспорт сценариев был прерван пользователем"));
            }
            catch (Exception ex)
            {
                _exportPresentationController.ErrorMessage(string.Format("При экспорте сценариев произошла неизвестная ошибка: {0}", ex));
                //ExportPresentationController.Instanse.ErrorMessage(
                //    string.Format("При экспорте сценариев произошла неизвестная ошибка: {0}", ex));
            }

        }
Esempio n. 25
0
 public SavePresentationResult SavePresentationChanges(UserIdentity userIdentity, PresentationInfo presentationInfo,
     Slide[] newSlideArr, out ResourceDescriptor[] resourcesNotExists,
     out DeviceResourceDescriptor[] deviceResourcesNotExists, out int[] labelNotExists,
     out UserIdentity[] whoLock,
     out int[] slidesAlreadyExistsId)
 {
     resourcesNotExists = new ResourceDescriptor[] { };
     deviceResourcesNotExists = new DeviceResourceDescriptor[] {};
     whoLock = new UserIdentity[] { };
     slidesAlreadyExistsId = new int[] { };
     labelNotExists = presentationInfo.GetUsedLabels().Except(
         _configuration.LabelStorageAdapter.GetLabelStorage().Select(lb => lb.Id)).ToArray();
     if (labelNotExists.Length != 0) return SavePresentationResult.LabelNotExists;
     if (!IsStandAlone)
     {
         // необходим лок уровня презентации
         LockingInfo info = _lockService.GetLockInfo(ObjectKeyCreator.CreatePresentationKey(presentationInfo));
         if (info == null || !info.UserIdentity.Equals(userIdentity)) return SavePresentationResult.PresentationNotLocked;
     }
     string[] deletedEquipment;
     Presentation presentationStored = _presentationDAL.GetPresentation(
         presentationInfo.UniqueName, _sourceDAL, _deviceSourceDAL, out deletedEquipment);
     if (presentationStored == null) return SavePresentationResult.PresentationNotExists;
     resourcesNotExists = GetNotExistedResource(newSlideArr);
     deviceResourcesNotExists = GetNotExistedDeviceResource(newSlideArr, presentationInfo);
     if (resourcesNotExists.Length != 0 || deviceResourcesNotExists.Length != 0) return SavePresentationResult.ResourceNotExists;
     LockingInfo[] lockedSlides;
     Slide[] slideAlreadyExists;
     presentationStored = Merge(userIdentity, presentationInfo, newSlideArr, presentationStored,
         out lockedSlides, out slideAlreadyExists);
     if (presentationStored == null)
     {
         SavePresentationResult result = SavePresentationResult.Unknown;
         if (lockedSlides.Length != 0)
         {
             whoLock = lockedSlides.Select(li => li.UserIdentity).ToArray();
             result = SavePresentationResult.SlideLocked;
         }
         if (slideAlreadyExists.Length != 0)
         {
             slidesAlreadyExistsId = slideAlreadyExists.Select(sl => sl.Id).ToArray();
             result = SavePresentationResult.SlideAlreadyExists;
         }
         return result;
     }
     bool isSuccess = _presentationDAL.SavePresentation(userIdentity, presentationStored);
     if (isSuccess)
     {
         PresentationKey presentationKey = ObjectKeyCreator.CreatePresentationKey(presentationStored);
         ObjectChanged(userIdentity, new List<ObjectInfo> { new ObjectInfo(userIdentity, presentationKey) },
                       new PresentationInfo(presentationStored), true);
     }
     else
     {
         return SavePresentationResult.Unknown;
     }
     return SavePresentationResult.Ok;
 }
Esempio n. 26
0
        public PresentationInfo GetPresentationInfo()
        {
            PresentationInfo info = new PresentationInfo();

            if (PresentationControl.IsActive())
            {
                info.SlidesNumber = PresentationControl.TotalSlides();
                info.CurrentSlide = PresentationControl.CurrentSlide();
                info.FileName = CurrentSlidePresentation;
            }
            else
            {
                info.SlidesNumber = 0;
                info.CurrentSlide = 0;
                info.FileName = "";
            }

            Log("Get presentation info");

            return info;
        }
Esempio n. 27
0
 protected DeviceResourceDescriptor[] GetNotExistedDeviceResource(
     IEnumerable<Slide> slideArr, PresentationInfo presentationInfo)
 {
     List<DeviceResourceDescriptor> resourcesAbsent = new List<DeviceResourceDescriptor>();
     foreach (Slide slide in slideArr)
     {
         foreach (DeviceResourceDescriptor descriptor in slide.GetDeviceResource(presentationInfo))
         {
             if (!_deviceSourceDAL.IsExists(descriptor))
                 resourcesAbsent.Add(descriptor);
         }
     }
     return resourcesAbsent.ToArray();
 }
 public PresentationChangedEventArgs(PresentationInfo info)
 {
     _info = info;
 }
 static void importPresentation_OnPresentationDeleted(PresentationInfo presentationInfo)
 {
     DesignerClient.Instance.PresentationNotifier.PresentationDeleted(
         Thread.CurrentPrincipal as UserIdentity,
         new PresentationInfoExt(presentationInfo, null));
 }
 public PresentationPropertiesForm(PresentationInfo info)
     : this(info, false)
 { }