public LectureUICallback(StandaloneController standaloneController, EditorController editorController, PropEditController propEditController)
     : base(standaloneController, editorController, propEditController)
 {
     addCustomQuery <String, String>(PlaySoundAction.CustomQueries.Record, (queryResult, soundFile) =>
     {
         String finalSoundFile = Path.Combine(CurrentDirectory, Guid.NewGuid().ToString("D") + ".ogg");
         String error          = null;
         QuickSoundRecorder.ShowDialog(standaloneController.MedicalController, finalSoundFile, editorController.ResourceProvider.openWriteStream,
                                       newSoundFile =>
         {
             queryResult.Invoke(newSoundFile, ref error);
         });
     });
 }
        public EditorUICallback(StandaloneController standaloneController, EditorController editorController, PropEditController propEditController)
            : base(standaloneController, editorController, propEditController)
        {
            this.addOneWayCustomQuery(AnomalousMvcContext.CustomQueries.Preview, delegate(AnomalousMvcContext context)
            {
                previewMvcContext(context);
            });

            this.addSyncCustomQuery<Browser>(ViewBrowserEditableProperty.CustomQueries.BuildBrowser, () =>
            {
                Browser browser = new Browser("Views", "Choose View");
                if (CurrentEditingMvcContext != null)
                {
                    foreach (View view in CurrentEditingMvcContext.Views)
                    {
                        browser.addNode(null, null, new BrowserNode(view.Name, view.Name));
                    }
                }
                return browser;
            });

            this.addSyncCustomQuery<Browser, Type>(ModelBrowserEditableProperty.CustomQueries.BuildBrowser, (assignableFromType) =>
            {
                Browser browser = new Browser("Models", "Choose Model");
                if (CurrentEditingMvcContext != null)
                {
                    foreach (MvcModel model in CurrentEditingMvcContext.Models)
                    {
                        if (assignableFromType.IsAssignableFrom(model.GetType()))
                        {
                            browser.addNode(null, null, new BrowserNode(model.Name, model.Name));
                        }
                    }
                }
                return browser;
            });

            this.addOneWayCustomQuery(View.CustomQueries.AddControllerForView, delegate(View view)
            {
                AnomalousMvcContext context = CurrentEditingMvcContext;
                String controllerName = view.Name;
                if (context.Controllers.hasItem(controllerName))
                {
                    MessageBox.show(String.Format("There is already a controller named {0}. Cannot create a new one.", controllerName), "Error", MessageBoxStyle.IconError | MessageBoxStyle.Ok);
                }
                else
                {
                    MvcController controller = new MvcController(controllerName);
                    RunCommandsAction showCommand = new RunCommandsAction("Show");
                    showCommand.addCommand(new ShowViewCommand(view.Name));
                    controller.Actions.add(showCommand);

                    RunCommandsAction closeCommand = new RunCommandsAction("Close");
                    closeCommand.addCommand(new CloseViewCommand());
                    controller.Actions.add(closeCommand);
                    context.Controllers.add(controller);
                }
            });

            this.addSyncCustomQuery<Browser>(ActionBrowserEditableProperty.CustomQueries.BuildBrowser, () =>
            {
                return createActionBrowser();
            });

            this.addSyncCustomQuery<Browser>(ElementAttributeEditor.CustomQueries.BuildActionBrowser, () =>
            {
                return createActionBrowser();
            });

            this.addSyncCustomQuery<Browser, IEnumerable<String>, String, String>(ElementAttributeEditor.CustomQueries.BuildFileBrowser, (searchPatterns, prompt, leadingPath) =>
            {
                return createFileBrowser(searchPatterns, prompt, leadingPath);
            });

            this.addCustomQuery<String, String>(PlaySoundAction.CustomQueries.Record, (queryResult, soundFile) =>
            {
                this.getInputString("Enter a name for the sound file.", delegate(String result, ref String errorMessage)
                {
                    String finalSoundFile = Path.ChangeExtension(result, ".ogg");
                    String error = null;
                    QuickSoundRecorder.ShowDialog(standaloneController.MedicalController, finalSoundFile, editorController.ResourceProvider.openWriteStream,
                    newSoundFile =>
                    {
                        queryResult.Invoke(newSoundFile, ref error);
                    });
                    return true;
                });
            });

            this.addSyncCustomQuery<Browser>(TimelinePreActionEditInterface.CustomQueries.BuildActionBrowser, () =>
            {
                var browser = new Browser("Pre Actions", "Choose Pre Action");
                browser.addNode(null, null, new BrowserNode("Change Scene", typeof(OpenNewSceneAction)));
                browser.addNode(null, null, new BrowserNode("Show Skip To Post Actions Prompt", typeof(SkipToPostActions)));
                browser.addNode(null, null, new BrowserNode("Run Mvc Action", typeof(RunMvcAction)));
                return browser;
            });

            this.addSyncCustomQuery<Browser>(TimelinePostActionEditInterface.CustomQueries.BuildActionBrowser, () =>
            {
                var browser = new Browser("Post Actions", "Choose Post Action");
                browser.addNode(null, null, new BrowserNode("Load Another Timeline", typeof(LoadAnotherTimeline)));
                browser.addNode(null, null, new BrowserNode("Repeat Previous", typeof(RepeatPreviousPostActions)));
                browser.addNode(null, null, new BrowserNode("Run Mvc Action", typeof(RunMvcAction)));
                return browser;
            });
        }