public void openEditor(String file) { String extension = Path.GetExtension(file).ToLowerInvariant(); EditorTypeController typeController; if (typeControllers.TryGetValue(extension, out typeController)) { typeController.openEditor(file); } else { OtherProcessManager.openLocalURL(ResourceProvider.getFullFilePath(file)); } }
public CommonUICallback(StandaloneController standaloneController, EditorController editorController, PropEditController propEditController) { this.editorController = editorController; this.standaloneController = standaloneController; this.propEditController = propEditController; this.addOneWayCustomQuery(CameraPosition.CustomEditQueries.CaptureCameraPosition, delegate(CameraPosition camPos) { SceneViewWindow activeWindow = standaloneController.SceneViewController.ActiveWindow; if (activeWindow != null) { camPos.Translation = activeWindow.Translation; camPos.LookAt = activeWindow.LookAt; activeWindow.calculateIncludePoint(camPos); } }); this.addOneWayCustomQuery(CameraPosition.CustomEditQueries.PreviewCameraPosition, delegate(CameraPosition camPos) { SceneViewWindow activeWindow = standaloneController.SceneViewController.ActiveWindow; if (activeWindow != null) { CameraPosition undo = activeWindow.createCameraPosition(); activeWindow.setPosition(camPos, MedicalConfig.CameraTransitionTime); activeWindow.pushUndoState(undo); } }); this.addCustomQuery <PresetState>(ChangeMedicalStateCommand.CustomEditQueries.CapturePresetState, delegate(SendResult <PresetState> resultCallback) { PresetStateCaptureDialog stateCaptureDialog = new PresetStateCaptureDialog(resultCallback); stateCaptureDialog.SmoothShow = true; stateCaptureDialog.open(true); }); this.addOneWayCustomQuery(RmlView.CustomQueries.OpenFileInRmlViewer, delegate(String file) { editorController.openEditor(file); }); this.addCustomQuery <Browser>(ViewCollection.CustomQueries.CreateViewBrowser, delegate(SendResult <Browser> resultCallback) { Browser browser = new Browser("Views", "Choose View Type"); standaloneController.MvcCore.ViewHostFactory.createViewBrowser(browser); String errorPrompt = null; resultCallback(browser, ref errorPrompt); }); this.addCustomQuery <Browser>(ModelCollection.CustomQueries.CreateModelBrowser, delegate(SendResult <Browser> resultCallback) { Browser browser = new Browser("Models", "Choose Model Type"); browser.addNode(null, null, new BrowserNode("DataModel", typeof(DataModel), DataModel.DefaultName)); browser.addNode(null, null, new BrowserNode("Navigation", typeof(NavigationModel), NavigationModel.DefaultName)); browser.addNode(null, null, new BrowserNode("MedicalStateInfo", typeof(MedicalStateInfoModel), MedicalStateInfoModel.DefaultName)); browser.addNode(null, null, new BrowserNode("BackStack", typeof(BackStackModel), BackStackModel.DefaultName)); String error = null; resultCallback(browser, ref error); }); this.addCustomQuery <Type>(RunCommandsAction.CustomQueries.ShowCommandBrowser, delegate(SendResult <Type> resultCallback) { this.showBrowser(RunCommandsAction.CreateCommandBrowser(), resultCallback); }); this.addCustomQuery <Color>(ShowTextAction.CustomQueries.ChooseColor, queryDelegate => { ColorDialog colorDialog = new ColorDialog(); colorDialog.showModal((result, color) => { if (result == NativeDialogResult.OK) { String errorPrompt = null; queryDelegate.Invoke(color, ref errorPrompt); } }); }); this.addOneWayCustomQuery <ShowPropAction>(ShowPropAction.CustomQueries.KeepOpenToggle, showPropAction => { if (showPropAction.KeepOpen) { propEditController.removeOpenProp(showPropAction); } else { propEditController.addOpenProp(showPropAction); } }); this.addSyncCustomQuery <Browser, IEnumerable <String>, String>(FileBrowserEditableProperty.CustomQueries.BuildBrowser, (searchPattern, prompt) => { return(createFileBrowser(searchPattern, prompt)); }); this.addSyncCustomQuery <Browser>(AnatomyManager.CustomQueries.BuildBrowser, () => { return(AnatomyManager.buildBrowser()); }); this.addSyncCustomQuery <Browser>(PropBrowserEditableProperty.CustomQueries.BuildBrowser, () => { Browser browser = new Browser("Props", "Choose Prop"); foreach (var propDef in standaloneController.TimelineController.PropFactory.PropDefinitions) { if (standaloneController.LicenseManager.allowPropUse(propDef.PropLicenseId)) { browser.addNode(propDef.BrowserPath, new BrowserNode(propDef.PrettyName, propDef.Name)); } } return(browser); }); this.addSyncCustomQuery <Browser>(ElementNameEditableProperty.CustomQueries.BuildBrowser, () => { Browser browser = new Browser("Screen Location Name", "Choose Screen Location Name"); foreach (var elementName in standaloneController.GUIManager.NamedLinks) { browser.addNode(null, null, new BrowserNode(elementName.UniqueDerivedName, elementName)); } return(browser); }); addOneWayCustomQuery <String>(PlaySoundAction.CustomQueries.EditExternally, soundFile => { if (soundFile != null && editorController.ResourceProvider.exists(soundFile)) { String fullPath = editorController.ResourceProvider.getFullFilePath(soundFile); OtherProcessManager.openLocalURL(fullPath); } }); }