示例#1
0
        public String createProject(EditorResourceProvider resourceProvider, string projectName)
        {
            AnomalousMvcContext mvcContext = new AnomalousMvcContext();

            mvcContext.StartupAction  = "Common/Startup";
            mvcContext.ShutdownAction = "Common/Shutdown";

            RmlView view = new RmlView("Index");

            view.RmlFile     = "Index.rml";
            view.ElementName = new BorderLayoutElementName(GUILocationNames.ContentArea, BorderLayoutLocations.Left);
            view.Buttons.add(new CloseButtonDefinition("Close", "Common/ExitApp"));
            mvcContext.Views.add(view);

            mvcContext.Controllers.add(new MvcController("Common",
                                                         new RunCommandsAction("Startup",
                                                                               new SaveCameraPositionCommand(),
                                                                               new SaveLayersCommand(),
                                                                               new SaveMusclePositionCommand(),
                                                                               new SaveMedicalStateCommand(),
                                                                               new HideMainInterfaceCommand(),
                                                                               new RunActionCommand("Index/Show")),
                                                         new RunCommandsAction("Shutdown",
                                                                               new RestoreCameraPositionCommand(),
                                                                               new RestoreLayersCommand(),
                                                                               new RestoreMusclePositionCommand(),
                                                                               new RestoreMedicalStateCommand(),
                                                                               new ShowMainInterfaceCommand()
                                                                               ),
                                                         new RunCommandsAction("ExitApp",
                                                                               new ShutdownCommand())
                                                         ));

            mvcContext.Controllers.add(new MvcController("Index",
                                                         new RunCommandsAction("Show",
                                                                               new PlayTimelineCommand(TimelineName),
                                                                               new ShowViewCommand("Index")
                                                                               )
                                                         ));

            saveObject(mvcContext, resourceProvider, MvcContextName);

            DDAtlasPlugin ddPlugin = new DDAtlasPlugin();

            ddPlugin.PluginName      = projectName;
            ddPlugin.PluginNamespace = projectName;
            StartAnomalousMvcTask mvcTask = new StartAnomalousMvcTask("Task", projectName, "", "Apps");

            mvcTask.ContextFile = MvcContextName;
            ddPlugin.addTask(mvcTask);
            saveObject(ddPlugin, resourceProvider, "Plugin.ddp");

            Timeline mainTimeline = new Timeline();

            saveObject(mainTimeline, resourceProvider, TimelineName);

            resourceProvider.createDirectory("", "Resources");

            EmbeddedResourceHelpers.CopyResourceToStream(EmbeddedTemplateNames.MasterTemplate_trml, "MasterTemplate.trml", resourceProvider, Assembly.GetExecutingAssembly());

            using (StreamWriter streamWriter = new StreamWriter(resourceProvider.openWriteStream("Index.rml")))
            {
                streamWriter.Write(indexRml, projectName);
            }

            return(null);
        }