public override void clicked(TaskPositioner positioner)
        {
            EmbeddedResourceProvider embeddedResourceProvider = new EmbeddedResourceProvider(assembly, resourceRoot);

            if (sortFiles)
            {
                embeddedResourceProvider.sortFiles(NaturalSortAlgorithm.CompareFunc);
            }
            timelineController.setResourceProvider(embeddedResourceProvider);

            //Load and run the mvc context
            context             = mvcCore.loadContext(embeddedResourceProvider.openFile(mvcContextName));
            context.RuntimeName = UniqueName;
            context.setResourceProvider(embeddedResourceProvider);
            mvcCore.startRunningContext(context);
        }
示例#2
0
        private IEnumerable <IdleStatus> runSplashScreen()
        {
            finishedSplash = false;
            if (String.IsNullOrEmpty(this.PrimaryArchive))
            {
                allowSplashRestarts = true;
                if (DataFileMissing != null)
                {
                    DataFileMissing.Invoke(this, controller);
                }
                else
                {
                    MessageBox.show("Could not find resource archive. Please reinstall Anomalous Medical.", "Resource Archive Error", MessageBoxStyle.Ok | MessageBoxStyle.IconError, result =>
                    {
                        controller.exit();
                    });
                }
                yield break;
            }

            splashScreen.updateStatus(InitializingCorePosition, "Initializing Core");
            yield return(IdleStatus.Ok);

            //Configure the filesystem
            VirtualFileSystem archive = VirtualFileSystem.Instance;
            //Add primary archive
            bool mainArchiveAdded = archive.addArchive(this.PrimaryArchive);

            controller.addWorkingArchive();

            var resourceManager = PluginManager.Instance.createLiveResourceManager("AnomalousMedical"); //We don't ever unload the shaders, so this can be garbage collected after its done here.
            var ogreResources   = resourceManager.getSubsystemResource("Ogre");

            commonResources = ogreResources.addResourceGroup("Common");

            controller.initializeControllers(createBackground(), new LicenseManager(MedicalConfig.LicenseFile));
            controller.LicenseManager.getKey(processKeyResults);
            licenseDisplay.setSceneViewController(controller.SceneViewController);

            //GUI
            splashScreen.updateStatus(CreatingGuiPosition, "Creating GUI");
            yield return(IdleStatus.Ok);

            //Layout Chain
            LayoutChain layoutChain = new LayoutChain();

            layoutChain.addLink(new SingleChildChainLink(GUILocationNames.Notifications, controller.NotificationManager.LayoutContainer), true);
            layoutChain.addLink(new PopupAreaChainLink(GUILocationNames.FullscreenPopup), true);
            layoutChain.SuppressLayout = true;
            editorBorder = new BorderLayoutChainLink(GUILocationNames.EditorBorderLayout);
            layoutChain.addLink(editorBorder, true);
            layoutChain.addLink(new MDIChainLink(GUILocationNames.MDI, controller.MDILayout), true);
            layoutChain.addLink(new PopupAreaChainLink(GUILocationNames.ContentAreaPopup), true);
            contentArea = new BorderLayoutChainLink(GUILocationNames.ContentArea);
            layoutChain.addLink(contentArea, true);
            layoutChain.addLink(new FinalChainLink("SceneViews", controller.MDILayout.DocumentArea), true);
            layoutChain.SuppressLayout = false;
            layoutChain.layout();

            controller.createGUI(layoutChain);
            controller.GUIManager.setMainInterfaceEnabled(false);
            controller.GUIManager.Disposing += GUIManager_Disposing;

            //Scene Load
            uint   currentPosition = LoadingScenePosition;
            String message         = "Loading Scene";
            bool   updateStatus    = true;
            bool   firstOgre       = true;

            splashScreen.updateStatus(currentPosition, message);
            yield return(IdleStatus.Ok);

            String           sceneToLoad           = DefaultScene;
            ResourceProvider sceneResourceProvider = new VirtualFilesystemResourceProvider();

            if (!mainArchiveAdded && !sceneResourceProvider.exists(sceneToLoad))
            {
                //Make sure we have one of our scenes
                sceneToLoad           = "Empty.sim.xml";
                sceneResourceProvider = new EmbeddedResourceProvider(GetType().Assembly, "Medical.Resources.");
                controller.NotificationManager.showNotification("No data files found.\nPlease reinstall.", MyGUIResourceNames.ErrorIcon);
            }

            foreach (var status in controller.openNewSceneStatus(sceneToLoad, sceneResourceProvider))
            {
                switch (status.Subsystem)
                {
                case OgreInterface.PluginName:
                    if (status.NumItems != 0)
                    {
                        currentPosition = LoadingScenePosition + (uint)(status.CurrentPercent * LoadingSceneDelta);
                        message         = "Loading Artwork";
                        updateStatus    = firstOgre || currentPosition > splashScreen.Position;
                        firstOgre       = false;
                    }
                    break;

                default:
                    updateStatus = true;
                    if (status.Message != null)
                    {
                        message = status.Message;
                    }
                    else
                    {
                        message = "Loading Scene";
                    }
                    break;
                }

                if (updateStatus)
                {
                    controller.VirtualTextureManager.update();
                    splashScreen.updateStatus(currentPosition, message);
                }

                yield return(IdleStatus.Ok);
            }

            finishedSplash = true;

            if (!foundLicense)
            {
                splashScreen.updateStatus(WaitingForLicensePosition, "Waiting for License");
            }
            checkCompleteSplash();
            yield return(IdleStatus.Ok);
        }