Ejemplo n.º 1
0
        public void initializeControllers(BackgroundScene background, LicenseManager licenseManager)
        {
            //Background
            this.background     = background;
            this.LicenseManager = licenseManager;
            atlasPluginManager  = new AtlasPluginManager(this);
            atlasPluginManager.PluginLoadError += new Medical.AtlasPluginManager.PluginMessageDelegate(atlasPluginManager_PluginLoadError);
            atlasPluginManager.manageInstalledPlugins();

            clipboard = new SaveableClipboard();

            //Documents
            DocumentController = new DocumentController();

            //MDI Layout
            mdiLayout = new MDILayoutManager();

            //SceneView
            MyGUIInterface myGUI = MyGUIInterface.Instance;

            sceneViewController = new SceneViewController(mdiLayout, medicalController.EventManager, medicalController.MainTimer, medicalController.PluginManager.RendererPlugin.PrimaryWindow, myGUI.OgrePlatform.RenderManager, background);
            sceneViewController.WindowCreated         += sceneViewController_WindowCreated;
            sceneViewController.WindowDestroyed       += sceneViewController_WindowDestroyed;
            sceneViewController.DefaultBackgroundColor = new Color(0.274f, 0.274f, 0.274f);
            sceneStatsDisplayManager = new SceneStatsDisplayManager(sceneViewController, OgreInterface.Instance.OgrePrimaryWindow.OgreRenderTarget);
            sceneStatsDisplayManager.StatsVisible        = MedicalConfig.EngineConfig.ShowStatistics;
            MedicalConfig.EngineConfig.ShowStatsToggled += engineConfig => sceneStatsDisplayManager.StatsVisible = engineConfig.ShowStatistics;
            lightManager = PluginManager.Instance.RendererPlugin.createSceneViewLightManager();

            //Measurement grid
            measurementGrid = new MeasurementGrid("MeasurementGrid", sceneViewController);
            SceneUnloading += measurementGrid.sceneUnloading;
            SceneLoaded    += measurementGrid.sceneLoaded;

            //Image Renderer
            imageRenderer                       = new ImageRenderer(medicalController, sceneViewController, idleHandler);
            imageRenderer.Background            = background;
            imageRenderer.ImageRenderStarted   += measurementGrid.ScreenshotRenderStarted;
            imageRenderer.ImageRenderCompleted += measurementGrid.ScreenshotRenderCompleted;

            //Anatomy Controller
            anatomyController = new AnatomyController();

            //Medical states
            medicalStateController = new MedicalStateController(imageRenderer, medicalController);
            SceneLoaded           += medicalStateController.sceneLoaded;
            SceneUnloading        += medicalStateController.sceneUnloading;

            //Movement sequences
            movementSequenceController = new MovementSequenceController(medicalController);
            this.SceneLoaded          += movementSequenceController.sceneLoaded;
            musclePositionController   = new MusclePositionController(medicalController.MainTimer, this);

            SceneLoaded    += SleepyActorRepository.SceneLoaded;
            SceneUnloading += SleepyActorRepository.SceneUnloading;

            //Props
            propFactory = new PropFactory(this);

            //Timeline
            timelineController = new TimelineController(this);

            viewHostFactory = new MyGUIViewHostFactory(mdiLayout);
            mvcCore         = new AnomalousMvcCore(this, viewHostFactory);

            //Patient data
            patientDataController = new PatientDataController(this);

            //Tasks
            taskController = new TaskController();

            anatomyTaskManager = new AnatomyTaskManager(taskController, guiManager);

            //Coroutine
            Coroutine.SetTimer(medicalController.MainTimer);

            //Notifications
            notificationManager = new NotificationGUIManager();

            layerController = new LayerController();

            //Create virtual texture manager
            virtualTextureSceneViewLink = new VirtualTextureSceneViewLink(this);
        }
Ejemplo n.º 2
0
        public static void checkForUpdate(Action <UpdateCheckResult> checkCompletedCallback, AtlasPluginManager pluginManager, LicenseManager licenseManager)
        {
            //Check for updates on a background thread
            ThreadPool.QueueUserWorkItem(state =>
            {
                UpdateCheckResult result = UpdateCheckResult.NoUpdates;
                try
                {
                    ServerUpdateInfo updateInfo = getUpdateInfo(licenseManager);
                    if (updateInfo.RemotePlatformVersion > CurrentVersion)
                    {
                        result |= UpdateCheckResult.PlatformUpdate;
                    }
                    else
                    {
                        foreach (var pluginUpdate in updateInfo.PluginUpdateInfo)
                        {
                            AtlasPlugin plugin = pluginManager.getPlugin(pluginUpdate.PluginId);
                            if (plugin != null && pluginUpdate.Version > plugin.Version)
                            {
                                result |= UpdateCheckResult.PluginUpdates;
                                break;
                            }
                        }
                        foreach (var dependencyUpdate in updateInfo.DependencyUpdateInfo)
                        {
                            AtlasPlugin plugin = pluginManager.getPlugin(dependencyUpdate.PluginId);
                            if (plugin != null && dependencyUpdate.Version > plugin.Version)
                            {
                                result |= UpdateCheckResult.PluginUpdates;
                                break;
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    Log.Error("Could not read update status from the server. Reason:\n{0}", e.Message);
                }

                ThreadManager.invoke(checkCompletedCallback, result);
            });
        }