예제 #1
0
 public override void clicked(TaskPositioner taskPositioner)
 {
     if (Plugin.AtlasPluginManager.allDependenciesLoadedFor(this.Plugin))
     {
         String fullContextPath = Path.Combine(Plugin.PluginRootFolder, ContextFile).Replace('\\', '/');
         VirtualFilesystemResourceProvider resourceProvider = new VirtualFilesystemResourceProvider(Path.GetDirectoryName(fullContextPath));
         try
         {
             AnomalousMvcContext context;
             using (Stream stream = resourceProvider.openFile(Path.GetFileName(fullContextPath)))
             {
                 context = Plugin.MvcCore.loadContext(stream);
             }
             context.RuntimeName = UniqueName;
             context.setResourceProvider(resourceProvider);
             Plugin.TimelineController.setResourceProvider(resourceProvider);
             Plugin.MvcCore.startRunningContext(context);
         }
         catch (Exception ex)
         {
             Log.Error("Cannot load context '{0}'\nReason: {1}", ContextFile, ex.Message);
         }
     }
     else
     {
         MessageBox.show("Additional files needed to run this task. Would you like to download them now?", "Files Needed", MessageBoxStyle.IconQuest | MessageBoxStyle.Yes | MessageBoxStyle.No, result =>
         {
             if (result == MessageBoxStyle.Yes)
             {
                 Plugin.AtlasPluginManager.requestDependencyDownloadFor(this.Plugin);
             }
         });
     }
 }
예제 #2
0
 public override void clicked(TaskPositioner taskPositioner)
 {
     if (Plugin.AtlasPluginManager.allDependenciesLoadedFor(this.Plugin))
     {
         VirtualFilesystemResourceProvider resourceProvider = new VirtualFilesystemResourceProvider(Plugin.PluginRootFolder);
         try
         {
             Slideshow slideshow;
             using (Stream stream = resourceProvider.openFile(SlideshowFile))
             {
                 slideshow = SharedXmlSaver.Load <Slideshow>(stream);
             }
             if (slideshow.Version == Slideshow.CurrentVersion)
             {
                 AnomalousMvcContext context = slideshow.createContext(resourceProvider, Plugin.GuiManager);
                 context.RuntimeName = UniqueName;
                 context.setResourceProvider(resourceProvider);
                 Plugin.TimelineController.setResourceProvider(resourceProvider);
                 Plugin.MvcCore.startRunningContext(context);
             }
             else
             {
                 MessageBox.show(String.Format("Cannot run slideshow \"{0}.\" It was created in a different version of Anomalous Medical.\nYou will need to download an updated version.", Name), "Error", MessageBoxStyle.IconError | MessageBoxStyle.Ok);
                 InlineRmlUpgradeCache.removeSlideshowPanels(slideshow);
             }
         }
         catch (Exception ex)
         {
             Log.Error("Cannot load context '{0}'\nReason: {1}", SlideshowFile, ex.Message);
         }
     }
     else
     {
         MessageBox.show("Additional files needed to run this task. Would you like to download them now?", "Files Needed", MessageBoxStyle.IconQuest | MessageBoxStyle.Yes | MessageBoxStyle.No, result =>
         {
             if (result == MessageBoxStyle.Yes)
             {
                 Plugin.AtlasPluginManager.requestDependencyDownloadFor(this.Plugin);
             }
         });
     }
 }