Windows phone 8 WPToolkit CustomMessageBox-在某些条件为真之前保持打开状态
我正在使用CustomMessageBox为WP8构建一个应用程序。customMessageBox的内容包括文本框和LeftButton。我希望customMessageBox保持打开状态,直到用户在文本框中写入内容并进行更改。下面是一些代码:Windows phone 8 WPToolkit CustomMessageBox-在某些条件为真之前保持打开状态,windows-phone-8,wptoolkit,Windows Phone 8,Wptoolkit,我正在使用CustomMessageBox为WP8构建一个应用程序。customMessageBox的内容包括文本框和LeftButton。我希望customMessageBox保持打开状态,直到用户在文本框中写入内容并进行更改。下面是一些代码: this.Dismissed += async (sender, dismissedEvent) => { switch (dismissedEvent.Result)
this.Dismissed += async (sender, dismissedEvent) =>
{
switch (dismissedEvent.Result)
{
case CustomMessageBoxResult.LeftButton:
this.isSaved = await CreateUser();
break;
case CustomMessageBoxResult.None:
break;
case CustomMessageBoxResult.RightButton:
break;
default:
break;
}
};
我为以下代码创建了布尔变量isSaved:
this.Dismissing += (sender, e) =>
{
if (!this.isSaved)
{
e.Cancel = false;
}
};
但它不起作用——也许e.Cancel是为了别的什么,尽管我找不到任何关于它的文档。
方法CreateUser()验证输入并将其保存到数据库
我在互联网上搜索了解决方案,但没有找到任何东西,如果您能帮助我或告诉我在哪里可以找到解决方案,我将不胜感激。
提前谢谢你 这个呢
private async void CmbDismissing(object sender, DismissingEventArgs e)
{
if (e.Result == CustomMessageBoxResult.LeftButton)
{
// still open
e.Cancel = true;
bool isSaved = await this.CreateUser();
// close
if (isSaved)
{
((CustomMessageBox)sender).Dismiss();
}
}
}