当前位置: 首页>>代码示例>>C#>>正文


C# DisplayType.CreateNewDisplay方法代码示例

本文整理汇总了C#中DisplayType.CreateNewDisplay方法的典型用法代码示例。如果您正苦于以下问题:C# DisplayType.CreateNewDisplay方法的具体用法?C# DisplayType.CreateNewDisplay怎么用?C# DisplayType.CreateNewDisplay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DisplayType的用法示例。


在下文中一共展示了DisplayType.CreateNewDisplay方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreatePresentationWithBackgrounds

        private bool CreatePresentationWithBackgrounds(PresentationInfo presentationInfo, BackgroundImageDescriptor[] descriptors, DisplayType selectedDisplay)
        {
            PresentationInfo pi;
            string uniqueName = presentationInfo.UniqueName;
            Presentation presentation = PresentationController.NewPresentation(presentationInfo.Name, presentationInfo.Author, descriptors.Count());
            presentation.UniqueName = uniqueName;
            presentation.Comment = presentationInfo.Comment;
            for (int i = 0; i < presentation.SlideList.Count; i++)
            {
                Display display = selectedDisplay.CreateNewDisplay();
                ActiveDisplay activeDisplay = display as ActiveDisplay;
                if (activeDisplay != null)
                {
                    activeDisplay.BackgroundImage = descriptors[i].Id;
                    presentation.SlideList[i].DisplayList.Add(activeDisplay);
                }
            }

            pi = new PresentationInfo(presentation);

            creatingPresentation = pi;
            int[] labelNotExists;

            if (CreatePresentationResult.Ok == DesignerClient.Instance.PresentationWorker.CreatePresentation(pi, out labelNotExists))
            {
                if (!DesignerClient.Instance.IsStandAlone)
                {
                    if (!DesignerClient.Instance.PresentationWorker.AcquireLockForPresentation(pi.UniqueName, RequireLock.ForEdit))
                    {
                        MessageBoxExt.Show("Не удалось заблокировать созданный сценарий для редактирования!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return false;
                    }

                    foreach (Slide slide in presentation.SlideList)
                    {
                        if (!DesignerClient.Instance.PresentationWorker.AcquireLockForSlide(pi.UniqueName, slide.Id, RequireLock.ForEdit))
                        {
                            MessageBoxExt.Show("Не удалось заблокировать созданную сцену для редактирования!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return false;
                        }
                    }

                    pi = new PresentationInfoExt(pi, new LockingInfo(identity, RequireLock.ForEdit, new PresentationKey(pi.UniqueName)));
                }
                else
                    pi = new PresentationInfoExt(pi, null);

                int[] notLockedSlide;
                ResourceDescriptor[] notExists;
                DeviceResourceDescriptor[] deviceResourceDescriptorsNotExists;
                if (!DesignerClient.Instance.PresentationWorker.SaveSlideChanges(pi.UniqueName,
                                                                                 presentation.SlideList.ToArray(),
                                                                                 out notLockedSlide,
                                                                                 out notExists,
                                                                                 out
                                                                                         deviceResourceDescriptorsNotExists,
                                                                                 out labelNotExists))
                {
                    MessageBoxExt.Show("Не удалось сохранить созданные сцены!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return false;
                }

                if (!DesignerClient.Instance.IsStandAlone)
                    foreach (Slide slide in presentation.SlideList)
                    {
                        DesignerClient.Instance.PresentationWorker.ReleaseLockForSlide(pi.UniqueName, slide.Id);
                    }

                ShowJustCreatedPresentation(pi);
            }
            else
                MessageBoxExt.Show("Не удалось создать сценарий!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            return true;
        }
开发者ID:AlexSneg,项目名称:VIRD-1.0,代码行数:74,代码来源:PresentationListController.cs


注:本文中的DisplayType.CreateNewDisplay方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。