如何按顺序显示两个Sheer UI对话框?我想要做的是在Input
对话框成功完成后显示Confirm
对话框,然后显示Input
对话框。
目前,我只使用Command.Run()
方法:
if (!args.IsPostBack) {
SheerResponse.Input(
"Enter the new event date (ISO format YYYY-MM-DD):",
"",
@"\d{4}\-\d{2}\-\d{2}",
"'$Input' is not a valid date.",
100
);
args.WaitForPostBack();
} else {
...do stuff...
}
答案 0 :(得分:2)
在示例代码中,我们首先显示一个对话框而不是确认对话框。希望这个帮助
public void Run(ClientPipelineArgs args)
{
try
{
if (!args.IsPostBack)
{
Context.ClientPage.ClientResponse.ShowModalDialog(url.ToString(), true);
args.WaitForPostBack();
}
else if (args.HasResult)
{
// Small job confirmation. User decide 'no'
if (args.Result == "no")
{
return;
}
if(args.Result == "result")
{
SheerResponse.Confirm("message");
args.WaitForPostBack();
}
}
}
catch (EndpointNotFoundException ex)
{
//something
}
}
答案 1 :(得分:0)
似乎我需要为我要调用的命令获取Command
的实例,然后在此调用Execute()
,例如:
private void CreateEvent(ClientPipelineArgs args)
{
var org_lang = Language.Current;
Language lang = Language.Parse("en-gb");
Language.Current = lang;
Database db = Configuration.Factory.GetDatabase(args.Parameters["database"]);
Item parent = db.GetItem(args.Parameters["id"], lang);
try {
// Create command context
CommandContext command_context = new CommandContext(parent);
// Get command
Command command = CommandManager.GetCommand("fairsite:createcampaign");
// Execute command
command.Execute(command_context);
} finally {
Language.Current = org_lang;
}
}