Ejemplo n.º 1
0
        private void changeBackgroundColor()
        {
            ColorDialog colorDialog = new ColorDialog(controller.MainWindow);

            colorDialog.showModal((result, color) =>
            {
                if (result == NativeDialogResult.OK)
                {
                    controller.FrameClear.ClearColor = color;
                }
            });
        }
Ejemplo n.º 2
0
        void browseButton_MouseButtonClick(Widget source, EventArgs e)
        {
            ColorDialog colorDialog = new ColorDialog();

            colorDialog.showModal((result, color) =>
            {
                if (result == NativeDialogResult.OK)
                {
                    editWidget.OnlyText = color.ToString();
                    clearCellEdit();
                }
            });
        }
Ejemplo n.º 3
0
        void moreColorsButton_MouseButtonClick(Widget source, EventArgs e)
        {
            Color       selectedColor = SelectedColor;
            ColorDialog colorDialog   = new ColorDialog();

            colorDialog.Color = selectedColor;
            colorDialog.showModal((result, color) =>
            {
                if (result == NativeDialogResult.OK)
                {
                    colorGrid.SelectedItem = null;
                    customColor            = color;
                    colorGrid_SelectedValueChanged(this, EventArgs.Empty);
                }
            });
        }
Ejemplo n.º 4
0
        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);
                }
            });
        }