ActionBuilderStartEditingAction Method |
Namespace: Kjs.AppLife.Update.Engine.Core.Design
A service provider is provided so that the builder can obtain any services needed to start editing.
Currently, the only service provided to edit actions is the IWindowsFormsActionEditorService. This service can be used to display a Control. To create a custom editor, create a class that inherits from Control or UserControl to be used as the editor, then in StartEditingAction(IServiceProvider), obtain a IWindowsFormsActionEditorService and use it to display an instance of your editing control. The control will remain shown until it is destroyed by the service, and should update Action itself as changes are made.
Whenever a change is made to action, the editor should call SetActionDirty to ensure that the UI is notified that the action has changed. It should also call ValidateAction whenever a change is made to the action that might change its validation state.
public override void StartEditingAction(System.IServiceProvider provider) { IWindowsFormsActionEditorService editorService = (IWindowsFormsActionEditorService)provider.GetService(typeof(IWindowsFormsActionEditorService)); if(editorService != null) { // MyActionEditorControl has an ActionBuilder property that it uses to call // SetActionDirty() and ValidateAction() and to connect to the action that it // edits. MyActionEditorControl myControl = new MyActionEditorControl(); myControl.ActionBuilder = this; editorService.ShowControl(myControl); } }