private void makeTempPresets()
        {
            const int SideSize = 480;

            String defaultRml = EmbeddedResourceHelpers.ReadResourceContents(EmbeddedTemplateNames.SimpleSlide_rml, EmbeddedTemplateNames.Assembly);
            //Couple simple presets
            TemplateSlide presetSlide = new TemplateSlide()
            {
                Name     = "Single Panel",
                IconName = "Lecture.SlideLayouts.OnePanel"
            };

            presetSlide.addPanel(new RmlSlidePanelTemplate()
            {
                Rml         = defaultRml,
                Size        = SideSize,
                ElementName = new BorderLayoutElementName(GUILocationNames.ContentArea, BorderLayoutLocations.Left),
            });
            slideLayoutPicker.addPresetSlide(presetSlide);

            presetSlide = new TemplateSlide()
            {
                Name     = "Dual Panel",
                IconName = "Lecture.SlideLayouts.TwoPanel"
            };
            presetSlide.addPanel(new RmlSlidePanelTemplate()
            {
                Rml         = defaultRml,
                Size        = SideSize,
                ElementName = new BorderLayoutElementName(GUILocationNames.ContentArea, BorderLayoutLocations.Left),
            });
            presetSlide.addPanel(new RmlSlidePanelTemplate()
            {
                Rml         = defaultRml,
                Size        = SideSize,
                ElementName = new BorderLayoutElementName(GUILocationNames.ContentArea, BorderLayoutLocations.Right),
            });
            slideLayoutPicker.addPresetSlide(presetSlide);

            presetSlide = new TemplateSlide(new FullScreenSlideLayoutStrategy())
            {
                Name     = "Full Screen",
                IconName = "Lecture.SlideLayouts.Full",
            };
            presetSlide.addPanel(new RmlSlidePanelTemplate()
            {
                Rml         = defaultRml,
                Size        = 100,
                ElementName = new LayoutElementName(GUILocationNames.ContentAreaPopup),
            });
            slideLayoutPicker.addPresetSlide(presetSlide);
        }
예제 #2
0
        public LinnworksApiMock()
        {
            this.server = FluentMockServer.Start();

            Categories = JsonConvert
                         .DeserializeObject <List <TestCategory> >(
                EmbeddedResourceHelpers.ReadFile("Linnworks.CodingTests.Part1.Server.API.Client.UnitTests.Responses.GetAllCategories.json"));
            ProductCategoryCount = JsonConvert
                                   .DeserializeObject <ExecuteCustomScriptResult <ProductCategoryCount> >(
                EmbeddedResourceHelpers.ReadFile("Linnworks.CodingTests.Part1.Server.API.Client.UnitTests.Responses.ProductsCategorieCount.json"));

            SetCategoriesEndpoint();
            SetExecuteCustomScript();
            SetUpAddCategory();
        }
 /// <summary>
 /// Check a loaded slideshow to see if it needs updates or if the program does.
 /// Returns true if it is safe to finish loading or false if this function will
 /// handle that step somehow later.
 /// </summary>
 /// <returns></returns>
 private bool updateSmartLecture()
 {
     if (slideshow.Version < Slideshow.CurrentVersion)
     {
         MessageBox.show("This project is out of date, would you like to update it now?\nUpdating this project will allow you to edit it, however, it will be incompatible with older versions of Anomalous Medical.\nIt is reccomended that you do this update.", "Update Required", MessageBoxStyle.Yes | MessageBoxStyle.No | MessageBoxStyle.IconQuest, (result) =>
         {
             if (result == MessageBoxStyle.Yes)
             {
                 try
                 {
                     //First do the save as if needed to zip up old project
                     String backingLoc = editorController.ResourceProvider.BackingProvider.BackingLocation;
                     if (!backingLoc.EndsWith(".sl"))
                     {
                         saveAs(backingLoc + ".sl");
                     }
                     if (slideshow.Version < 2)
                     {
                         EmbeddedResourceHelpers.CopyResourceToStream(EmbeddedTemplateNames.MasterTemplate_trml, "MasterTemplate.trml", editorController.ResourceProvider, EmbeddedTemplateNames.Assembly);
                         EmbeddedResourceHelpers.CopyResourceToStream(EmbeddedTemplateNames.SlideMasterStyles_rcss, "SlideMasterStyles.rcss", editorController.ResourceProvider, EmbeddedTemplateNames.Assembly);
                     }
                     slideshow.updateToVersion(Slideshow.CurrentVersion, editorController.ResourceProvider);
                     unsafeSave();
                     finishLoadingSlideshow();
                 }
                 catch (Exception ex)
                 {
                     MessageBox.show(String.Format("There was an error updating your project.\nException type: {0}\n{1}", ex.GetType().Name, ex.Message), "Update Error", MessageBoxStyle.Ok | MessageBoxStyle.IconError);
                 }
             }
             else
             {
                 closeProject();
             }
             InlineRmlUpgradeCache.removeSlideshowPanels(slideshow);
         });
         return(false);
     }
     else if (slideshow.Version > Slideshow.CurrentVersion)
     {
         MessageBox.show("This project was created in a newer version of Anomalous Medical.\nPlease update Anomalous Medical to be able to edit this file.", "Update Required", MessageBoxStyle.Ok | MessageBoxStyle.IconWarning);
         closeProject();
         return(false);
     }
     return(true);
 }
예제 #4
0
        public void createItem(string path, EditorController editorController)
        {
            Slide slide = new Slide();

            applySceneStateToSlide(slide);
            RmlSlidePanel panel = new RmlSlidePanel()
            {
                ElementName = new BorderLayoutElementName(GUILocationNames.ContentArea, BorderLayoutLocations.Left),
                Size        = 480,
            };

            slide.addPanel(panel);
            if (!editorController.ResourceProvider.directoryExists(slide.UniqueName))
            {
                editorController.ResourceProvider.createDirectory("", slide.UniqueName);
            }
            EmbeddedResourceHelpers.CopyResourceToStream(EmbeddedTemplateNames.SimpleSlide_rml, panel.getRmlFilePath(slide), editorController.ResourceProvider, EmbeddedTemplateNames.Assembly);
            using (editorController.ResourceProvider.openWriteStream(Path.Combine(slide.UniqueName, Slide.StyleSheetName))) { }
            if (SlideCreated != null)
            {
                SlideCreated.Invoke(slide);
            }
        }
예제 #5
0
        public String createProject(EditorResourceProvider resourceProvider, string projectName)
        {
            DDAtlasPlugin ddPlugin = new DDAtlasPlugin();

            ddPlugin.PluginName      = projectName;
            ddPlugin.PluginNamespace = projectName;
            StartSlideshowTask mvcTask = new StartSlideshowTask("Task", projectName, "", "Slideshows");

            mvcTask.SlideshowFile = SlideshowName;
            ddPlugin.addTask(mvcTask);
            saveObject(ddPlugin, resourceProvider, "Plugin.ddp");

            Assembly editorAssembly = Assembly.GetExecutingAssembly();

            EmbeddedResourceHelpers.CopyResourceToStream(EmbeddedTemplateNames.MasterTemplate_trml, "MasterTemplate.trml", resourceProvider, EmbeddedTemplateNames.Assembly);
            EmbeddedResourceHelpers.CopyResourceToStream(EmbeddedTemplateNames.SlideMasterStyles_rcss, "SlideMasterStyles.rcss", resourceProvider, EmbeddedTemplateNames.Assembly);

            Slideshow slideshow = new Slideshow();

            saveObject(slideshow, resourceProvider, SlideshowName);

            return(SlideshowName);
        }
 private async Task <ExecuteCustomScriptResult <ProductCategoryCount> > GetProductCategoryCount()
 {
     return(await ExecuteCustomScript <ProductCategoryCount>(EmbeddedResourceHelpers.ReadFile("Linnworks.CodingTests.Part1.Server.API.Client.CustomScripts.ProductCategoriesCount.sql")));
 }