[]
命令设计器。
public class CommandDesigner
命令设计器。
public CommandDesigner()
编辑器对应的命令。
public Command Command { get; set; }
类型 | 描述 |
---|---|
Command |
返回命令插件对应的编辑器。
public virtual ICommandEditor GetCommandEditor()
类型 | 描述 |
---|---|
ICommandEditor | 返回命令对应的编辑器。 |
UserControl和自定义插件弹出消息框命令定义如下:
public partial class ShowMessageCommandEditor : UserControl, ICommandEditor
{
public ShowMessageCommandEditor()
{
InitializeComponent();
}
public Command Command
{
get
{
return new ShowMessageBoxCommand() { Message = messageTextBox.Text };
//messageTextBox is the name of TextBox in UserControl.
}
set
{
ShowMessageBoxCommand command = value as ShowMessageBoxCommand;
if (command != null)
{
messageTextBox.Text = command.Message;
}
}
}
public bool Validate()
{
return true;
}
}
public class ShowMessageCommandDesigner : CommandDesigner<ShowMessageBoxCommand>, ICommandChecker
{
public override ICommandEditor GetCommandEditor()
{
return new ShowMessageCommandEditor();
}
}
[Designer("ShowMessageBoxCommand.ShowMessageCommandDesigner, ShowMessageBoxCommand")]
public class ShowMessageBoxCommand : Command
{
public string Message { get; set; }
}
返回命令插件对应的编辑器。
public virtual ICommandEditor GetCommandEditor(IBuilderCommandContext context)
类型 | 名称 | 描述 |
---|---|---|
IBuilderCommandContext | context |
类型 | 描述 |
---|---|
ICommandEditor | 返回命令对应的编辑器。 |
UserControl和自定义插件弹出消息框命令定义如下:
public partial class ShowMessageCommandEditor : UserControl, ICommandEditor
{
public ShowMessageCommandEditor()
{
InitializeComponent();
}
public Command Command
{
get
{
return new ShowMessageBoxCommand() { Message = messageTextBox.Text };
//messageTextBox is the name of TextBox in UserControl.
}
set
{
ShowMessageBoxCommand command = value as ShowMessageBoxCommand;
if (command != null)
{
messageTextBox.Text = command.Message;
}
}
}
public bool Validate()
{
return true;
}
}
public class ShowMessageCommandDesigner : CommandDesigner<ShowMessageBoxCommand>, ICommandChecker
{
public override ICommandEditor GetCommandEditor(IBuilderCommandContext context)
{
return new ShowMessageCommandEditor();
}
}
[Designer("ShowMessageBoxCommand.ShowMessageCommandDesigner, ShowMessageBoxCommand")]
public class ShowMessageBoxCommand : Command
{
public string Message { get; set; }
}
返回插件命令内部属性对应的编辑器。
public virtual EditorSetting GetEditorSetting(PropertyDescriptor property, IBuilderCommandContext builderContext)
类型 | 名称 | 描述 |
---|---|---|
System.ComponentModel.PropertyDescriptor | property | 命令内部属性 |
IBuilderCommandContext | builderContext | 命令编辑上下文信息。 |
类型 | 描述 |
---|---|
EditorSetting | 返回插件命令内部属性对应的编辑器。 |
public class WorkflowCommandDesigner : CommandDesigner<WorkflowCommand>;
{
public string TableName { get; set; }
public override EditorSetting GetEditorSetting(PropertyDescriptor property, IBuilderCommandContext builderContext)
{
if (property.Name == "TableName")
{
return new ComboEditorSetting(builderContext.EnumAllTableInfos().Where(t => t.WorkflowInfo != null && t.WorkflowInfo.IsEnabled).Select(t => t.TableName));
}
}
}
搜索关键字
public virtual IEnumerable<string> GetSearchTags()
类型 | 描述 |
---|---|
System.Collections.Generic.IEnumerable<T><string> |
属性值被编辑时会被调用的回调函数
public virtual void OnPropertyEditorChanged(string propertyName, object propertyValue, Dictionary<string, EditorSetting> properties)
类型 | 名称 | 描述 |
---|---|---|
string | propertyName | 属性名 |
object | propertyValue | 属性值 |
System.Collections.Generic.Dictionary<TKey, TValue><string, EditorSetting> | properties | 全部属性 |
属性值被编辑时会被调用的回调函数
public virtual void OnPropertyEditorChanged(string propertyName, object propertyValue, Dictionary<string, IEditorSettingsDataContext> properties)
类型 | 名称 | 描述 |
---|---|---|
string | propertyName | 属性名 |
object | propertyValue | 属性值 |
System.Collections.Generic.Dictionary<TKey, TValue><string, IEditorSettingsDataContext> | properties | 全部属性 |
自定义校验逻辑
public virtual string Validate()
类型 | 描述 |
---|---|
string | 返回空表示校验成功,否则表示校验失败,返回错误信息 |