public void initialize(StandaloneController standaloneController) { RocketInterface.Instance.FileInterface.addExtension(new RocketAssemblyResourceLoader(this.GetType().Assembly)); if (VirtualFileSystem.Instance.exists("Watermark/AnomalousMedical.png")) { standaloneController.ImageRenderer.LoadLogo = () => { using (Stream stream = VirtualFileSystem.Instance.openStream("Watermark/AnomalousMedical.png", Engine.Resources.FileMode.Open)) { return(new FreeImageBitmap(stream)); } }; } this.guiManager = standaloneController.GUIManager; this.standaloneController = standaloneController; standaloneController.MovementSequenceController.GroupAdded += MovementSequenceController_GroupAdded; bool hasPremium = licenseManager.allowFeature(1); standaloneController.AnatomyController.ShowPremiumAnatomy = hasPremium; guiManager.SaveUIConfiguration += guiManager_SaveUIConfiguration; guiManager.LoadUIConfiguration += guiManager_LoadUIConfiguration; guiManager.MainGUIShown += guiManager_MainGUIShown; guiManager.MainGUIHidden += guiManager_MainGUIHidden; //Controllers imageLicenseServer = new ImageLicenseServer(licenseManager); bookmarksController = new BookmarksController(standaloneController, ScaleHelper.Scaled(100), ScaleHelper.Scaled(100), hasPremium); //Create Dialogs aboutDialog = new AboutDialog(licenseManager); chooseSceneDialog = new ChooseSceneDialog(guiManager); chooseSceneDialog.ChooseScene += new EventHandler(chooseSceneDialog_ChooseScene); standaloneController.AnatomyController.ShowPremiumAnatomyChanged += AnatomyController_ShowPremiumAnatomyChanged; anatomyFinder = new AnatomyFinder(standaloneController.AnatomyController, standaloneController.SceneViewController, standaloneController.LayerController, standaloneController.AnatomyTaskManager); guiManager.addManagedDialog(anatomyFinder); options = new OptionsDialog(guiManager); options.VideoOptionsChanged += new EventHandler(options_VideoOptionsChanged); options.RequestRestart += new EventHandler(options_RequestRestart); bookmarks = new BookmarksGUI(bookmarksController, standaloneController.GUIManager, standaloneController.SceneViewController); viewsGui = new ViewsGui(standaloneController.SceneViewController, standaloneController.AnatomyController); guiManager.addManagedDialog(viewsGui); //Taskbar taskbar = new AppButtonTaskbar(); taskbar.OpenTaskMenu += taskbar_OpenTaskMenu; taskbar.setAppIcon("AppButton/Hamburger", "AppButton/Hamburger"); taskbarLink = new SingleChildChainLink(GUILocationNames.Taskbar, taskbar); guiManager.addLinkToChain(taskbarLink); guiManager.pushRootContainer(GUILocationNames.Taskbar); //Task Menu taskMenu = new TaskMenu(standaloneController.DocumentController, standaloneController.TaskController, standaloneController.GUIManager, new LayoutElementName(GUILocationNames.FullscreenPopup)); taskMenu.GroupComparison = TaskMenuCategories.Sorter; guiTaskManager = new GUITaskManager(taskbar, taskMenu, standaloneController.TaskController); //Tasks Menu TaskController taskController = standaloneController.TaskController; standaloneController.AnatomyTaskManager.HighlightTasks += AnatomyTaskManager_HighlightTasks; //Tasks cameraMovementModeTask = new CameraMovementModeTask(standaloneController.SceneViewController); taskController.addTask(cameraMovementModeTask); Slideshow.AdditionalTasks.addTask(cameraMovementModeTask); selectionOperatorTask = new SelectionOperatorTask(standaloneController.AnatomyController); taskController.addTask(selectionOperatorTask); Slideshow.AdditionalTasks.addTask(selectionOperatorTask); var viewsTask = new PinableMDIDialogOpenTask(viewsGui, "Medical.Views", "Views", "AnomalousMedical/ViewIcon", TaskMenuCategories.Explore); taskController.addTask(viewsTask); //Patient Section taskController.addTask(new ShowPopupTask(chooseSceneDialog, "Medical.NewPatient", "New", "AnomalousMedical/ChangeScene", TaskMenuCategories.Explore, 0)); taskController.addTask(new DialogOpenTask(aboutDialog, "Medical.About", "About", "AnomalousMedical/About", TaskMenuCategories.System, int.MaxValue - 2)); taskController.addTask(new VolumeControlTask()); CallbackTask unhideAllAnatomy = new CallbackTask("Medical.UnhideAllAnatomy", "Unhide All", "AnatomyFinder.ShowAll", TaskMenuCategories.Explore, int.MaxValue - 2, false, (item) => { LayerState undo = LayerState.CreateAndCapture(); standaloneController.LayerController.unhideAll(); standaloneController.LayerController.pushUndoState(undo); }); taskController.addTask(unhideAllAnatomy); //Navigation Section PinableMDIDialogOpenTask anatomyFinderTask = new PinableMDIDialogOpenTask(anatomyFinder, "Medical.AnatomyFinder", "Anatomy Finder", "AnomalousMedical/SearchIcon", TaskMenuCategories.Explore); taskController.addTask(anatomyFinderTask); Slideshow.AdditionalTasks.addTask(anatomyFinderTask); ShowPopupTask bookmarkTask = null; standaloneController.AnatomyController.setCommandPermission(AnatomyCommandPermissions.Unrestricted, PlatformConfig.UnrestrictedEnvironment); standaloneController.AnatomyController.setCommandPermission(AnatomyCommandPermissions.PremiumActive, hasPremium); if (PlatformConfig.UnrestrictedEnvironment || hasPremium) { //Explore selectionModeTask = new SelectionModeTask(standaloneController.AnatomyController); taskController.addTask(selectionModeTask); Slideshow.AdditionalTasks.addTask(selectionModeTask); bookmarkTask = new ShowPopupTask(bookmarks, "Medical.Bookmarks", "Bookmarks", "AnomalousMedical/FavoritesIcon", TaskMenuCategories.Explore); taskController.addTask(bookmarkTask); Slideshow.AdditionalTasks.addTask(bookmarkTask); } if (PlatformConfig.UnrestrictedEnvironment) { //System CallbackTask helpTaskItem = new CallbackTask("Medical.Help", "Help", "AnomalousMedical/Help", TaskMenuCategories.System, int.MaxValue - 4, false); helpTaskItem.OnClicked += new CallbackTask.ClickedCallback(helpTaskItem_OnClicked); taskController.addTask(helpTaskItem); taskController.addTask(new ShowPopupTask(options, "Medical.Options", "Options", "AnomalousMedical/Options", TaskMenuCategories.System, int.MaxValue - 3)); CallbackTask exitTaskItem = new CallbackTask("Medical.Exit", "Exit", "AnomalousMedical/Exit", TaskMenuCategories.System, int.MaxValue, false); exitTaskItem.OnClicked += new CallbackTask.ClickedCallback(exitTaskItem_OnClicked); taskController.addTask(exitTaskItem); if (MedicalConfig.ShowDeveloperTools) { CallbackTask createOverrideTaskItem = new CallbackTask("Medical.CreateOverride", "CreateOverride", CommonResources.NoIcon, TaskMenuCategories.Developer, int.MaxValue, false); createOverrideTaskItem.OnClicked += CreateOverrideTaskItem_OnClicked; taskController.addTask(createOverrideTaskItem); } } if (PlatformConfig.AllowFullscreenToggle) { CallbackTask toggleFullscreen = new CallbackTask("Medical.ToggleFullscreen", "Toggle Fullscreen", "AnomalousMedical/ToggleFullscreen", TaskMenuCategories.System, int.MaxValue - 2, false, (item) => { MainWindow.Instance.toggleFullscreen(); }); taskController.addTask(toggleFullscreen); //Fullscreen Toggle Shortcut var toggleFullscreenMessageEvent = new ButtonEvent(EventLayers.Gui, frameUp: (evtMgr) => { MainWindow.Instance.toggleFullscreen(); }); toggleFullscreenMessageEvent.addButton(KeyboardButtonCode.KC_RETURN); toggleFullscreenMessageEvent.addButton(KeyboardButtonCode.KC_LMENU); standaloneController.MedicalController.EventManager.addEvent(toggleFullscreenMessageEvent); } //Premium / Non Premium if (!hasPremium) { if (PlatformConfig.UnrestrictedEnvironment) { buyScreens = new BuyScreenController(standaloneController); taskMenuAd = new PremiumFeaturesTaskMenuAd(taskMenu); selectionModeTask.SelectionModeChooser.ShowBuyMessage += SelectionModeChooser_ShowBuyMessage; anatomyFinder.ShowBuyMessage += anatomyFinder_ShowBuyMessage; bookmarks.ShowBuyMessage += bookmarks_ShowBuyMessage; } if (MedicalConfig.FirstRun) { guiTaskManager.addPinnedTask(anatomyFinderTask); guiTaskManager.addPinnedTask(viewsTask); guiTaskManager.addPinnedTask(cameraMovementModeTask); if (bookmarkTask != null) { guiTaskManager.addPinnedTask(bookmarkTask); } guiTaskManager.addPinnedTask(unhideAllAnatomy); } } standaloneController.AtlasPluginManager.RequestDependencyDownload += AtlasPluginManager_RequestDependencyDownload; //Teeth mover teethMover = new SimObjectMover("Teeth", standaloneController.MedicalController.PluginManager.RendererPlugin, standaloneController.MedicalController.EventManager, standaloneController.SceneViewController); TeethToolController teethToolController = new TeethToolController(teethMover); standaloneController.ImageRenderer.ImageRenderStarted += teethToolController.ScreenshotRenderStarted; standaloneController.ImageRenderer.ImageRenderCompleted += teethToolController.ScreenshotRenderCompleted; standaloneController.ViewHostFactory.addFactory(new WizardComponentFactory(teethToolController)); }
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); }); }