public void unload(StandaloneController standaloneController, bool willReload, bool shuttingDown) { //Unload sequences if (loadedSequences != null) { MovementSequenceController movementSequenceController = standaloneController.MovementSequenceController; foreach (var info in loadedSequences) { movementSequenceController.removeMovementSequence(info.GroupName, info); } } //Also need to unload icon resources, this isn't the best way, but unload by removing the branding image key and all task icons manually (done in task unload). ResourceManager.Instance.destroyAllTexturesForResource(BrandingImageKey); ResourceManager.Instance.removeByName(BrandingImageKey); if (!shuttingDown) { AnatomyTaskManager anatomyTasks = standaloneController.AnatomyTaskManager; foreach (DDPluginTask task in tasks) { anatomyTasks.removeTask(task, willReload, task.TaggedAnatomy); ResourceManager.Instance.destroyAllTexturesForResource(task.IconName); ResourceManager.Instance.removeByName(task.IconName); } } }
public void initialize(StandaloneController standaloneController) { TimelineController = standaloneController.TimelineController; AtlasPluginManager = standaloneController.AtlasPluginManager; MvcCore = standaloneController.MvcCore; GuiManager = standaloneController.GUIManager; AnatomyTaskManager anatomyTasks = standaloneController.AnatomyTaskManager; foreach (DDPluginTask task in tasks) { task._setPlugin(this); anatomyTasks.addTask(task, task.TaggedAnatomy); } //Load sequences if (!String.IsNullOrEmpty(SequencesDirectory)) { String fullSequencesDirectory = Path.Combine(PluginRootFolder, SequencesDirectory); VirtualFileSystem archive = VirtualFileSystem.Instance; if (archive.exists(fullSequencesDirectory)) { loadedSequences = new List <VirtualFSMovementSequenceInfo>(); MovementSequenceController movementSequenceController = standaloneController.MovementSequenceController; foreach (String directory in archive.listDirectories(fullSequencesDirectory, false, false)) { String groupName = archive.getFileInfo(directory).Name; foreach (String file in archive.listFiles(directory, false)) { VirtualFileInfo fileInfo = archive.getFileInfo(file); String fileName = fileInfo.Name; if (fileName.EndsWith(".seq")) { VirtualFSMovementSequenceInfo info = new VirtualFSMovementSequenceInfo(); info.GroupName = groupName; info.Name = fileName.Substring(0, fileName.Length - 4); info.FileName = fileInfo.FullName; movementSequenceController.addMovementSequence(info.GroupName, info); loadedSequences.Add(info); } } } } } }
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); }
public void initialize(StandaloneController standaloneController) { standaloneController.DocumentController.addDocumentHandler(new PatientDocumentHandler(standaloneController)); this.standaloneController = standaloneController; standaloneController.PatientDataController.PatientDataChanged += new Action <PatientDataFile>(PatientDataController_PatientDataChanged); GUIManager guiManager = standaloneController.GUIManager; //Dialogs mandibleMovementDialog = new MandibleMovementDialog(standaloneController.MovementSequenceController, standaloneController.MusclePositionController); guiManager.addManagedDialog(mandibleMovementDialog); notesDialog = new NotesDialog(standaloneController.MedicalStateController); guiManager.addManagedDialog(notesDialog); stateList = new StateListDialog(standaloneController.MedicalStateController); guiManager.addManagedDialog(stateList); savePatientDialog = new SavePatientDialog(guiManager); savePatientDialog.SaveFile += new EventHandler(savePatientDialog_SaveFile); openPatientDialog = new OpenPatientDialog(guiManager); openPatientDialog.OpenFile += new EventHandler(openPatientDialog_OpenFile); //Tasks Menu TaskController taskController = standaloneController.TaskController; AnatomyTaskManager anatomyTasks = standaloneController.AnatomyTaskManager; taskController.addTask(new ShowToothContactsTask(0)); PinableMDIDialogOpenTask mandibleMovementTask = new PinableMDIDialogOpenTask(mandibleMovementDialog, "Medical.ManualMovement", "Manual Movement", "DentalSimIcons/ManualMovement", "Dental Simulation", 2); taskController.addTask(mandibleMovementTask); anatomyTasks.addTask(new StartEmbeddedMvcTask("DentalSim.Eminence", "Eminence", "DentalSimIcons/Eminence", "Dental Simulation", GetType(), "DentalSim.Wizards.", "Eminence.mvc", standaloneController.TimelineController, standaloneController.MvcCore), new String[] { "Outer Skull", "Inner Skull" }); anatomyTasks.addTask(new StartEmbeddedMvcTask("DentalSim.Dentition", "Dentition", "DentalSimIcons/Dentition", "Dental Simulation", GetType(), "DentalSim.Wizards.", "Dentition.mvc", standaloneController.TimelineController, standaloneController.MvcCore), TeethNames); anatomyTasks.addTask(new StartEmbeddedMvcTask("DentalSim.DiscClockFace", "Disc Clock Face", "DentalSimIcons/DiscClockFace", "Dental Simulation", GetType(), "DentalSim.Wizards.DiscClock.", "DiscClockFace.mvc", standaloneController.TimelineController, standaloneController.MvcCore, true), new String[] { "Left TMJ Disc", "Right TMJ Disc" }); anatomyTasks.addTask(new StartEmbeddedMvcTask("DentalSim.Mandible", "Mandible", "DentalSimIcons/Mandible", "Dental Simulation", GetType(), "DentalSim.Wizards.", "Mandible.mvc", standaloneController.TimelineController, standaloneController.MvcCore), new String[] { "Mandible" }); anatomyTasks.addTask(new StartEmbeddedMvcTask("DentalSim.ClinicalDoppler", "Doppler", "DentalSimIcons/ClinicalDoppler", "Dental Simulation", GetType(), "DentalSim.Wizards.ClinicalDoppler.", "ClinicalDoppler.mvc", standaloneController.TimelineController, standaloneController.MvcCore), new String[] { "Left TMJ Disc", "Right TMJ Disc", "Mandible" }); anatomyTasks.addTask(new StartEmbeddedMvcTask("DentalSim.ClinicalCT", "CT", "DentalSimIcons/ClinicalCT", "Dental Simulation", GetType(), "DentalSim.Wizards.ClinicalCT.", "ClinicalCT.mvc", standaloneController.TimelineController, standaloneController.MvcCore), new String[] { "Left TMJ Disc", "Right TMJ Disc", "Mandible" }); anatomyTasks.addTask(new StartEmbeddedMvcTask("DentalSim.ClinicalMRI", "MRI", "DentalSimIcons/ClinicalMRI", "Dental Simulation", GetType(), "DentalSim.Wizards.ClinicalMRI.", "ClinicalMRI.mvc", standaloneController.TimelineController, standaloneController.MvcCore), new String[] { "Left TMJ Disc", "Right TMJ Disc", "Mandible" }); anatomyTasks.addTask(new StartEmbeddedMvcTask("DentalSim.ClinicalOrthoAndSkeletal", "Orthodontic and Skeletal", "DentalSimIcons/ClinicalOrthodonticAndSkeletal", "Dental Simulation", GetType(), "DentalSim.Wizards.", "ClinicalOrthoAndSkeletal.mvc", standaloneController.TimelineController, standaloneController.MvcCore), new String[] { "Left TMJ Disc", "Right TMJ Disc", "Mandible" }); taskController.addTask(new ShowPopupTask(openPatientDialog, "Medical.OpenPatient", "Open", "DentalSimIcons/Open", TaskMenuCategories.Scene, 1)); PinableMDIDialogOpenTask statesTask = new PinableMDIDialogOpenTask(stateList, "Medical.StateList", "States", "DentalSimIcons/StatesIcon", TaskMenuCategories.Scene); taskController.addTask(statesTask); PinableMDIDialogOpenTask notesTask = new PinableMDIDialogOpenTask(notesDialog, "Medical.Notes", "Notes", "DentalSimIcons/NotesIcon", TaskMenuCategories.Scene); taskController.addTask(notesTask); CallbackTask saveTaskItem = new CallbackTask("Medical.SavePatient", "Save", "CommonToolstrip/Save", TaskMenuCategories.Scene, 2, false); saveTaskItem.OnClicked += new CallbackTask.ClickedCallback(saveTaskItem_OnClicked); taskController.addTask(saveTaskItem); CallbackTask saveAsTaskItem = new CallbackTask("Medical.SavePatientAs", "Save As", "CommonToolstrip/SaveAs", TaskMenuCategories.Scene, 3, false); saveAsTaskItem.OnClicked += new CallbackTask.ClickedCallback(saveAsTaskItem_OnClicked); taskController.addTask(saveAsTaskItem); //Movement Sequences MovementSequenceController movementSequenceController = standaloneController.MovementSequenceController; Assembly assembly = GetType().Assembly; //Border Movements movementSequenceController.addMovementSequence("Border Movements", new EmbeddedMovementSequenceInfo(assembly, "Posselt Sagittal", "DentalSim.Sequences.BorderMovements.Posselt Sagittal.seq")); //Excursion movementSequenceController.addMovementSequence("Excursion", new EmbeddedMovementSequenceInfo(assembly, "Left Tooth Contact Bruxism", "DentalSim.Sequences.Excursion.Left Tooth Contact Bruxism.seq")); movementSequenceController.addMovementSequence("Excursion", new EmbeddedMovementSequenceInfo(assembly, "Left Tooth Contact Maximal", "DentalSim.Sequences.Excursion.Left Tooth Contact Maximal.seq")); movementSequenceController.addMovementSequence("Excursion", new EmbeddedMovementSequenceInfo(assembly, "Left Tooth Contact", "DentalSim.Sequences.Excursion.Left Tooth Contact.seq")); movementSequenceController.addMovementSequence("Excursion", new EmbeddedMovementSequenceInfo(assembly, "Open Bilateral", "DentalSim.Sequences.Excursion.Open Bilateral.seq")); movementSequenceController.addMovementSequence("Excursion", new EmbeddedMovementSequenceInfo(assembly, "Open Left", "DentalSim.Sequences.Excursion.Open Left.seq")); movementSequenceController.addMovementSequence("Excursion", new EmbeddedMovementSequenceInfo(assembly, "Open Right", "DentalSim.Sequences.Excursion.Open Right.seq")); movementSequenceController.addMovementSequence("Excursion", new EmbeddedMovementSequenceInfo(assembly, "Right Tooth Contact Bruxism", "DentalSim.Sequences.Excursion.Right Tooth Contact Bruxism.seq")); movementSequenceController.addMovementSequence("Excursion", new EmbeddedMovementSequenceInfo(assembly, "Right Tooth Contact Maximal", "DentalSim.Sequences.Excursion.Right Tooth Contact Maximal.seq")); movementSequenceController.addMovementSequence("Excursion", new EmbeddedMovementSequenceInfo(assembly, "Right Tooth Contact", "DentalSim.Sequences.Excursion.Right Tooth Contact.seq")); //Normal Chewing movementSequenceController.addMovementSequence("Normal Chewing", new EmbeddedMovementSequenceInfo(assembly, "Chewing Left Side", "DentalSim.Sequences.NormalChewing.Chewing Left Side.seq")); movementSequenceController.addMovementSequence("Normal Chewing", new EmbeddedMovementSequenceInfo(assembly, "Chewing Right Side", "DentalSim.Sequences.NormalChewing.Chewing Right Side.seq")); //Protrusion movementSequenceController.addMovementSequence("Protrusion", new EmbeddedMovementSequenceInfo(assembly, "Open Protrusion", "DentalSim.Sequences.Protrusion.Open Protrusion.seq")); movementSequenceController.addMovementSequence("Protrusion", new EmbeddedMovementSequenceInfo(assembly, "Protrusion Maximal", "DentalSim.Sequences.Protrusion.Protrusion Maximal.seq")); movementSequenceController.addMovementSequence("Protrusion", new EmbeddedMovementSequenceInfo(assembly, "Protrusion Tooth Contact Edge to Edge", "DentalSim.Sequences.Protrusion.Protrusion Tooth Contact Edge to Edge.seq")); //Vertical Opening movementSequenceController.addMovementSequence("Vertical Opening", new EmbeddedMovementSequenceInfo(assembly, "Hinge Opening", "DentalSim.Sequences.VerticalOpening.Hinge Opening.seq")); movementSequenceController.addMovementSequence("Vertical Opening", new EmbeddedMovementSequenceInfo(assembly, "Maximal Opening", "DentalSim.Sequences.VerticalOpening.Maximal Opening.seq")); movementSequenceController.addMovementSequence("Vertical Opening", new EmbeddedMovementSequenceInfo(assembly, "Tapping Teeth", "DentalSim.Sequences.VerticalOpening.Tapping Teeth.seq")); }