[]
插件命令数据编辑器。
public interface 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 ShowMessageBoxCommand: Command
{
public string Message { get; set; }
public override ICommandEditor GetCommandEditor() => new ShowMessageCommandEditor();
}
命令数据。
Command Command { get; set; }
类型 | 描述 |
---|---|
Command |
编辑器关闭前的数据校验。
bool Validate()
类型 | 描述 |
---|---|
bool |