Example #1
0
        public void createGUI(LayoutChain layoutChain)
        {
            MyGUIInterface.Instance.CommonResourceGroup.addResource(GetType().AssemblyQualifiedName, "EmbeddedScalableResource", true);

            //GUI
            guiManager.createGUI(mdiLayout, layoutChain, mainWindow);
            guiManager.ScreenSizeChanged += guiManager_ScreenSizeChanged;

            imageRendererProgress = new MyGUIImageRendererProgress();
            imageRenderer.ImageRendererProgress = imageRendererProgress;
            imageRenderer.ImageTextWriter       = new RocketTextWriter();

            continuePrompt = new MyGUIContinuePromptProvider();

            imageDisplayFactory = new MyGUIImageDisplayFactory(sceneViewController);
            textDisplayFactory  = new MyGUITextDisplayFactory(sceneViewController);

            giveGUIsToTimelineController(timelineController);
        }
Example #2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public AnomalyController(App app, Solution solution, IAnomalyImplementation implementation)
        {
            this.app            = app;
            this.solution       = solution;
            this.implementation = implementation;

            //Create the log.
            logListener = new LogFileListener();
            logListener.openLogFile(AnomalyConfig.DocRoot + "/log.log");
            Log.Default.addLogListener(logListener);

            mainWindow         = new NativeOSWindow(String.Format("{0} - Anomaly", solution.Name), new IntVector2(-1, -1), new IntSize2(AnomalyConfig.EngineConfig.HorizontalRes, AnomalyConfig.EngineConfig.VerticalRes));
            mainWindow.Closed += mainWindow_Closed;

            //Setup DPI
            float pixelScale = mainWindow.WindowScaling;

            ScaleHelper._setScaleFactor(pixelScale);

            var builder = new ServiceCollection();

            //Initialize the plugins
            pluginManager   = new PluginManager(AnomalyConfig.ConfigFile, builder);
            sceneController = new SceneController(pluginManager);
            //Hardcoded assemblies
            MyGUIInterface.EventLayerKey = EventLayers.Main;

            GuiFrameworkCamerasInterface.MoveCameraEventLayer   = EventLayers.Cameras;
            GuiFrameworkCamerasInterface.SelectWindowEventLayer = EventLayers.AfterMain;
            GuiFrameworkCamerasInterface.ShortcutEventLayer     = EventLayers.Main;

            GuiFrameworkEditorInterface.ToolsEventLayers = EventLayers.Tools;

            //Setup microcode cache load
            OgreInterface.MicrocodeCachePath      = Path.Combine(AnomalyConfig.DocRoot, "ShaderCache.mcc");
            OgreInterface.AllowMicrocodeCacheLoad = AnomalyConfig.LastShaderVersion == UnifiedMaterialBuilder.Version;
            AnomalyConfig.LastShaderVersion       = UnifiedMaterialBuilder.Version;

            implementation.AddPlugins(pluginManager);
            pluginManager.OnConfigureDefaultWindow = createWindow;

            //Create core classes
            systemTimer = new NativeSystemTimer();

            mainTimer = new NativeUpdateTimer(systemTimer);
            mainTimer.FramerateCap = AnomalyConfig.EngineConfig.MaxFPS;
            idleHandler            = new IdleHandler(mainTimer.OnIdle);
            inputHandler           = new NativeInputHandler(mainWindow, false);
            eventManager           = new EventManager(inputHandler, Enum.GetValues(typeof(EventLayers)));
            eventUpdate            = new EventUpdateListener(eventManager);

            builder.TryAddSingleton <EventManager>(eventManager); //This is externally owned

            pluginManager.initializePlugins();
            frameClearManager = new FrameClearManager(OgreInterface.Instance.OgrePrimaryWindow.OgreRenderTarget, new Color(0.2f, 0.2f, 0.2f));

            lightManager = pluginManager.RendererPlugin.createSceneViewLightManager();

            //Core resources
            MyGUIInterface.Instance.CommonResourceGroup.addResource(this.GetType().AssemblyQualifiedName, "EmbeddedResource", true);
            OgreResourceGroupManager.getInstance().initializeAllResourceGroups();

            //Intialize the platform
            mainTimer.addUpdateListener(eventUpdate);
            mainTimer.addUpdateListener(updateEventListener);
            pluginManager.setPlatformInfo(mainTimer, eventManager);

            GuiFrameworkInterface.Instance.handleCursors(mainWindow);

            //Layout Chain
            mdiLayout = new MDILayoutManager();

            //Scene views
            sceneViewController      = new SceneViewController(mdiLayout, eventManager, mainTimer, pluginManager.RendererPlugin.PrimaryWindow, MyGUIInterface.Instance.OgrePlatform.RenderManager, null);
            sceneStatsDisplayManager = new SceneStatsDisplayManager(sceneViewController, OgreInterface.Instance.OgrePrimaryWindow.OgreRenderTarget);
            sceneStatsDisplayManager.StatsVisible = true;
            sceneViewController.createWindow("Camera 1", AnomalyConfig.CameraConfig.MainCameraPosition, AnomalyConfig.CameraConfig.MainCameraLookAt, Vector3.Min, Vector3.Max, 0.0f, float.MaxValue, 100);

            virtualTextureLink = new VirtualTextureSceneViewLink(this);

            //Tools
            selectionMovementTools         = new SimObjectMover("SelectionMover", PluginManager.Instance.RendererPlugin, eventManager, sceneViewController);
            selectionMovementTools.Visible = true;
            selectionMovementTools.addMovableObject("Selection", new SelectionMovableObject(selectionController));

            mainForm = new AnomalyMain(this);

            LayoutChain layoutChain = new LayoutChain();

            layoutChain.addLink(new SingleChildChainLink(GUILocationNames.Taskbar, mainForm.LayoutContainer), true);
            layoutChain.addLink(new PopupAreaChainLink(GUILocationNames.FullscreenPopup), true);
            layoutChain.SuppressLayout = true;
            layoutChain.addLink(new MDIChainLink(GUILocationNames.MDI, mdiLayout), true);
            layoutChain.addLink(new PopupAreaChainLink(GUILocationNames.ContentAreaPopup), true);
            layoutChain.addLink(new FinalChainLink("SceneViews", mdiLayout.DocumentArea), true);
            layoutChain.SuppressLayout = false;

            guiManager = new GUIManager();
            guiManager.createGUI(mdiLayout, layoutChain, mainWindow);

            layoutChain.layout();

            splashScreen                = new SplashScreen(mainWindow, 100, "Anomaly.GUI.SplashScreen.SplashScreen.layout", "Anomaly.GUI.SplashScreen.SplashScreen.xml");
            splashScreen.Hidden        += splashScreen_Hidden;
            splashScreen.StatusUpdated += splashScreen_StatusUpdated;
            splashScreen.updateStatus(0, "Loading...");

            idleHandler.runTemporaryIdle(finishInitialization());
        }
        public OgreModelEditorController(App app, String defaultModel)
        {
            this.app = app;

            //Create the log.
            logListener = new LogFileListener();
            logListener.openLogFile(OgreModelEditorConfig.DocRoot + "/log.log");
            Log.Default.addLogListener(logListener);

            //Main window
            mainWindow         = new NativeOSWindow("Ogre Model Editor", new IntVector2(-1, -1), new IntSize2(OgreModelEditorConfig.EngineConfig.HorizontalRes, OgreModelEditorConfig.EngineConfig.VerticalRes));
            mainWindow.Closed += mainWindow_Closed;

            //Setup DPI
            ScaleHelper._setScaleFactor(mainWindow.WindowScaling);

            //Initailize plugins
            MyGUIInterface.EventLayerKey = EventLayers.Main;

            GuiFrameworkCamerasInterface.MoveCameraEventLayer   = EventLayers.Cameras;
            GuiFrameworkCamerasInterface.SelectWindowEventLayer = EventLayers.AfterMain;
            GuiFrameworkCamerasInterface.ShortcutEventLayer     = EventLayers.Main;

            GuiFrameworkEditorInterface.ToolsEventLayers = EventLayers.Tools;

            //Setup microcode cache load
            OgreInterface.MicrocodeCachePath        = Path.Combine(OgreModelEditorConfig.DocRoot, "ShaderCache.mcc");
            OgreInterface.AllowMicrocodeCacheLoad   = OgreModelEditorConfig.LastShaderVersion == UnifiedMaterialBuilder.Version;
            OgreModelEditorConfig.LastShaderVersion = UnifiedMaterialBuilder.Version;
            OgreInterface.TrackMemoryLeaks          = true;
            OgreInterface.CompressedTextureSupport  = OgreModelEditorConfig.CompressedTextureSupport;

            RuntimePlatformInfo.addPath(OgreModelEditorConfig.OpenGLESEmulatorPath);

            pluginManager = new PluginManager(OgreModelEditorConfig.ConfigFile, new ServiceCollection());
            pluginManager.OnConfigureDefaultWindow = createWindow;
            pluginManager.addPluginAssembly(typeof(OgreInterface).Assembly);
            pluginManager.addPluginAssembly(typeof(NativePlatformPlugin).Assembly);
            pluginManager.addPluginAssembly(typeof(MyGUIInterface).Assembly);
            pluginManager.addPluginAssembly(typeof(GuiFrameworkInterface).Assembly);
            pluginManager.addPluginAssembly(typeof(GuiFrameworkCamerasInterface).Assembly);
            pluginManager.addPluginAssembly(typeof(GuiFrameworkEditorInterface).Assembly);
            pluginManager.addPluginAssembly(typeof(GuiFrameworkDebuggingInterface).Assembly);
            pluginManager.initializePlugins();
            frameClearManager = new FrameClearManager(OgreInterface.Instance.OgrePrimaryWindow.OgreRenderTarget, new Color(0.2f, 0.2f, 0.2f));

            lightManager = pluginManager.RendererPlugin.createSceneViewLightManager();

            //Core resources
            MyGUIInterface.Instance.CommonResourceGroup.addResource(this.GetType().AssemblyQualifiedName, "EmbeddedResource", true);
            OgreResourceGroupManager.getInstance().addResourceLocation(GetType().AssemblyQualifiedName, "EmbeddedResource", "DebugShaders", true);
            OgreResourceGroupManager.getInstance().initializeAllResourceGroups();

            //Intialize the platform
            systemTimer = new NativeSystemTimer();

            mainTimer = new NativeUpdateTimer(systemTimer);
            mainTimer.FramerateCap = OgreModelEditorConfig.EngineConfig.MaxFPS;
            idleHandler            = new IdleHandler(mainTimer.OnIdle);

            inputHandler = new NativeInputHandler(mainWindow, false);
            eventManager = new EventManager(inputHandler, Enum.GetValues(typeof(EventLayers)));
            eventUpdate  = new EventUpdateListener(eventManager);
            mainTimer.addUpdateListener(eventUpdate);
            mainTimer.addUpdateListener(updateEventListener);
            pluginManager.setPlatformInfo(mainTimer, eventManager);
            GuiFrameworkInterface.Instance.handleCursors(mainWindow);

            //Layout Chain
            mdiLayout = new MDILayoutManager();

            //Scene views
            sceneViewController      = new SceneViewController(mdiLayout, eventManager, mainTimer, pluginManager.RendererPlugin.PrimaryWindow, MyGUIInterface.Instance.OgrePlatform.RenderManager, null);
            sceneStatsDisplayManager = new SceneStatsDisplayManager(sceneViewController, OgreInterface.Instance.OgrePrimaryWindow.OgreRenderTarget);
            sceneStatsDisplayManager.StatsVisible = true;
            sceneViewController.createWindow("Camera 1", OgreModelEditorConfig.CameraConfig.MainCameraPosition, OgreModelEditorConfig.CameraConfig.MainCameraLookAt, Vector3.Min, Vector3.Max, 0.0f, float.MaxValue, 100);

            virtualTextureLink = new VirtualTextureSceneViewLink(this);

            materialController = new MaterialController(this);

            //Tools
            objectMover = new SimObjectMover("ModelMover", PluginManager.Instance.RendererPlugin, eventManager, sceneViewController);

            mainForm = new OgreModelEditorMain(this);

            LayoutChain layoutChain = new LayoutChain();

            layoutChain.addLink(new SingleChildChainLink(GUILocationNames.Taskbar, mainForm.LayoutContainer), true);
            layoutChain.addLink(new PopupAreaChainLink(GUILocationNames.FullscreenPopup), true);
            layoutChain.SuppressLayout = true;
            layoutChain.addLink(new MDIChainLink(GUILocationNames.MDI, mdiLayout), true);
            layoutChain.addLink(new PopupAreaChainLink(GUILocationNames.ContentAreaPopup), true);
            layoutChain.addLink(new FinalChainLink("SceneViews", mdiLayout.DocumentArea), true);
            layoutChain.SuppressLayout = false;

            guiManager = new GUIManager(mdiLayout, mainWindow);
            guiManager.createGUILayout(layoutChain);

            layoutChain.layout();

            splashScreen                = new SplashScreen(mainWindow, 100, "OgreModelEditor.GUI.SplashScreen.SplashScreen.layout", "OgreModelEditor.GUI.SplashScreen.SplashScreen.xml");
            splashScreen.Hidden        += splashScreen_Hidden;
            splashScreen.StatusUpdated += splashScreen_StatusUpdated;
            splashScreen.updateStatus(0, "Loading...");

            idleHandler.runTemporaryIdle(finishInitialization(defaultModel));
        }
Example #4
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.TryAddSingleton <SceneController>();

            services.TryAddSingleton <EngineController>();

            //Register gui services

            services.TryAddSingleton <DocumentController>();

            services.TryAddSingleton <TaskMenu>(
                s => new TaskMenu(s.GetRequiredService <DocumentController>(),
                                  s.GetRequiredService <TaskController>(),
                                  s.GetRequiredService <GUIManager>(),
                                  new LayoutElementName(GUILocationNames.FullscreenPopup)));

            services.AddSingleton <TaskController>(s =>
            {
                var app = s.GetRequiredService <App>();
                var tc  = new TaskController();
                tc.addTask(new CallbackTask("Exit", "Exit", "", "Main", (item) =>
                {
                    app.exit();
                }));

                return(tc);
            });

            services.AddSingleton <MDILayoutManager>();

            services.AddSingleton <GUIManager>(s =>
            {
                return(new GUIManager(s.GetRequiredService <MDILayoutManager>(), s.GetRequiredService <OSWindow>()));
            });

            services.AddSingleton <Taskbar>(s =>
            {
                //Taskbar
                var taskbar           = new AppButtonTaskbar();
                var taskMenu          = s.GetRequiredService <TaskMenu>();
                taskbar.OpenTaskMenu += (int left, int top, int width, int height) =>
                {
                    taskMenu.setSize(width, height);
                    taskMenu.show(left, top);
                };
                taskbar.setAppIcon("AppButton/WideImage", "AppButton/NarrowImage");

                return(taskbar);
            });

            services.AddTransient <BorderLayoutChainLink <GUILocationNames.EditorBorderLayoutType> >(s => new BorderLayoutChainLink <GUILocationNames.EditorBorderLayoutType>(GUILocationNames.EditorBorderLayout));
            services.AddTransient <BorderLayoutChainLink <GUILocationNames.ContentAreaType> >(s => new BorderLayoutChainLink <GUILocationNames.ContentAreaType>(GUILocationNames.ContentArea));

            services.AddSingleton <LayoutChain>(s =>
            {
                var mdiLayout           = s.GetRequiredService <MDILayoutManager>();
                LayoutChain layoutChain = new LayoutChain();
                //layoutChain.addLink(new SingleChildChainLink(GUILocationNames.Notifications, controller.NotificationManager.LayoutContainer), true);
                var taskbar = s.GetRequiredService <Taskbar>();
                layoutChain.addLink(new SingleChildChainLink(GUILocationNames.Taskbar, taskbar), true);
                layoutChain.addLink(new PopupAreaChainLink(GUILocationNames.FullscreenPopup), true);
                layoutChain.SuppressLayout = true;
                var editorBorder           = s.GetRequiredService <BorderLayoutChainLink <GUILocationNames.EditorBorderLayoutType> >();
                layoutChain.addLink(editorBorder, true);
                layoutChain.addLink(new MDIChainLink(GUILocationNames.MDI, mdiLayout), true);
                layoutChain.addLink(new PopupAreaChainLink(GUILocationNames.ContentAreaPopup), true);
                var contentArea = s.GetRequiredService <BorderLayoutChainLink <GUILocationNames.ContentAreaType> >();
                layoutChain.addLink(contentArea, true);
                layoutChain.addLink(new FinalChainLink("SceneViews", mdiLayout.DocumentArea), true);
                layoutChain.SuppressLayout = false;
                layoutChain.layout();

                return(layoutChain);
            });

            services.AddSingleton <SceneViewController>(s =>
            {
                var ogrePlatformProvider = s.GetRequiredService <OgrePlatformProvider>();
                return(new SceneViewController(
                           s.GetRequiredService <MDILayoutManager>(),
                           s.GetRequiredService <EventManager>(),
                           s.GetRequiredService <UpdateTimer>(),
                           s.GetRequiredService <RendererWindow>(),
                           ogrePlatformProvider.OgrePlatform.RenderManager,
                           s.GetService <BackgroundScene>()));
            });

            services.AddSingleton <SceneStatsDisplayManager>();

            //Individual windows, can be created more than once.
            services.AddTransient <TestWindow>(s =>
            {
                var win = new TestWindow();
                s.GetRequiredService <GUIManager>().addManagedDialog(win);
                return(win);
            });

            services.AddTransient <RocketWindow>(s =>
            {
                var win = new RocketWindow();
                s.GetRequiredService <GUIManager>().addManagedDialog(win);
                return(win);
            });
        }
        public void updateThumbnail(bool forceUpdateSceneThumb = false)
        {
            Dictionary <RmlEditorViewInfo, LayoutContainer> layoutPositions = new Dictionary <RmlEditorViewInfo, LayoutContainer>();

            if (slideEditorController.ResourceProvider != null)
            {
                //Setup a LayoutChain to mimic the main one.
                LayoutChain layoutChain = new LayoutChain();
                layoutChain.addLink(new PopupAreaChainLink(GUILocationNames.ContentAreaPopup), true);
                layoutChain.addLink(new BorderLayoutNoAnimationChainLink(GUILocationNames.ContentArea), true);

                IntSize2        thumbTotalSize = new IntSize2(SlideImageManager.ThumbWidth, SlideImageManager.ThumbHeight);
                FreeImageBitmap thumb          = slideEditorController.SlideImageManager.createThumbBitmap(slide);
                layoutChain.SuppressLayout = true;
                LayoutContainer sceneContainer = new NullLayoutContainer(thumbTotalSize);
                layoutChain.addContainer(new BorderLayoutElementName(GUILocationNames.ContentArea, BorderLayoutLocations.Center), sceneContainer, null);
                foreach (var editor in rmlEditors.Values)
                {
                    if (editor.Component != null)
                    {
                        float               sizeRatio = (float)SlideImageManager.ThumbHeight / editor.Component.ViewHost.Container.RigidParentWorkingSize.Height;
                        IntSize2            size      = (IntSize2)(editor.Component.ViewHost.Container.DesiredSize * sizeRatio);
                        NullLayoutContainer container = new NullLayoutContainer(size);
                        layoutPositions.Add(editor, container);
                        layoutChain.addContainer(editor.View.ElementName, container, null);
                    }
                }
                layoutChain.SuppressLayout = false;
                layoutChain.WorkingSize    = thumbTotalSize;
                layoutChain.Location       = new IntVector2(0, 0);
                layoutChain.layout();

                //Render thumbnail, Start with the scene
                IntVector2 sceneThumbPosition = sceneContainer.Location;
                String     sceneThumbFile     = slide.SceneThumbName;
                if (forceUpdateSceneThumb)
                {
                    slideEditorController.SlideImageManager.addUnsavedSceneThumb(slide, renderSceneThumbnail());
                }

                SceneThumbInfo sceneThumbInfo = slideEditorController.SlideImageManager.loadThumbSceneBitmap(slide, renderSceneThumbnail);
                IntSize2       centerSize     = sceneContainer.WorkingSize;
                RectangleF     destRect       = new RectangleF(sceneThumbPosition.x, sceneThumbPosition.y, centerSize.Width, centerSize.Height);

                thumb.FillBackground(new RGBQUAD(FreeImageAPI.Color.FromArgb(sceneThumbInfo.Color.toARGB())));

                int requiredWidth  = (sceneThumbInfo.SceneThumb.Width - ((sceneThumbInfo.SceneThumb.Width - sceneThumbInfo.IncludeX) * 2));
                int requiredHeight = (sceneThumbInfo.SceneThumb.Height - (sceneThumbInfo.IncludeY * 2));

                int   sceneThumbWidth          = sceneThumbInfo.SceneThumb.Width;
                int   sceneThumbHeight         = sceneThumbInfo.SceneThumb.Height;
                int   sceneThumbHalfWidth      = sceneThumbWidth / 2;
                int   sceneThumbHalfHeight     = sceneThumbHeight / 2;
                float requiredHeightWidthRatio = (float)requiredHeight / requiredWidth;
                float centerHeightWidthRatio   = (float)centerSize.Height / centerSize.Width;

                float srcWidth  = requiredWidth;
                float srcHeight = requiredHeight;

                if (requiredHeightWidthRatio < centerHeightWidthRatio) //Compare ratios between our source required area and the destination
                {
                    //Use the full required width, add height from source image
                    //Convert the center size to the same size ratio as the required size
                    float sizeRatio = (float)requiredWidth / centerSize.Width;
                    srcHeight = centerSize.Height * sizeRatio;
                    if (srcHeight > sceneThumbHeight) //Stretch out the image as much as possible, limiting by the size of the scene thumb if needed.
                    {
                        srcHeight = sceneThumbHeight;
                    }
                    float destHeight = srcHeight / sizeRatio;
                    destRect = new RectangleF(destRect.Left, destRect.Height / 2 + destRect.Top - destHeight / 2, destRect.Width, destHeight); //Make a dest rect that takes as much image as it can
                }
                else
                {
                    //Use the full required height, add width from source image
                    float sizeRatio = (float)requiredHeight / centerSize.Height;
                    srcWidth = centerSize.Width * sizeRatio;
                    if (srcWidth > sceneThumbWidth)
                    {
                        srcWidth = sceneThumbWidth;
                    }
                    float destWidth = srcWidth / sizeRatio;
                    destRect = new RectangleF(destRect.Width / 2 + destRect.Left - destWidth / 2, destRect.Top, destWidth, destRect.Height);
                }

                RectangleF srcRect = new RectangleF(sceneThumbHalfWidth - srcWidth / 2, sceneThumbHalfHeight - srcHeight / 2, srcWidth, srcHeight);

                using (FreeImageBitmap resizedSceneThumb = sceneThumbInfo.SceneThumb.Copy((int)srcRect.X, (int)srcRect.Y, (int)srcRect.Right, (int)srcRect.Bottom))
                {
                    resizedSceneThumb.Rescale((int)destRect.Width, (int)destRect.Height, FREE_IMAGE_FILTER.FILTER_BILINEAR);
                    thumb.Paste(resizedSceneThumb, (int)destRect.X, (int)destRect.Y, int.MaxValue);
                }

                //Render all panels
                foreach (var editor in rmlEditors.Values)
                {
                    if (editor.Component != null)
                    {
                        LayoutContainer container;
                        if (layoutPositions.TryGetValue(editor, out container))
                        {
                            Rectangle panelThumbPos = new Rectangle(container.Location.x, container.Location.y, container.WorkingSize.Width, container.WorkingSize.Height);
                            editor.Component.writeToGraphics(thumb, panelThumbPos);
                        }
                    }
                }

                slideEditorController.SlideImageManager.thumbnailUpdated(slide);
            }
        }
Example #6
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);
        }