我有这样的代码(问题线的上方都有注释):组件并不在当前的背景下存在 - C#
private async void btn_loginAdmin_Click(object sender, RoutedEventArgs e)
{
// 'txt_adminId' does not exist in the current context.
if (txt_adminId.Text = "root")
{
// 'txt_adminPw' does not exist in the current context.
if (txt_adminPw.Password = "password")
{
var msg_login = new MessageDialog("Logged in!");
await msg_login.ShowAsync();
}
else
{
var msg_login = new MessageDialog("Wrong password!");
await msg_login.ShowAsync();
}
}
else
{
var msg_login = new MessageDialog("Wrong combo!");
await msg_login.ShowAsync();
}
}
我一直用C#这个问题。我不知道这意味着什么。但我确信在这个文件的.xaml中存在这两个文本框。
- 这是一个Windows应用商店的C#程序。
编辑:
下面是输出:
1>C:\Database\GH3_WSE\GH3_WSE\login_admin.xaml.cs(119,17,119,42): error CS0029: Cannot implicitly convert type 'string' to 'bool'
1>C:\Database\GH3_WSE\GH3_WSE\login_admin.xaml.cs(121,21,121,54): error CS0029: Cannot implicitly convert type 'string' to 'bool'
为什么您的Click处理器标记为异步? – 2014-10-11 09:24:00
使MessageDialog工作。我尝试删除它们,但它不能解决问题。 – Wix 2014-10-11 09:26:09
我明白了。没有WP的经验,但在我看来与异步和线程有关。也许使用MVVM可以帮助你。 – 2014-10-11 09:39:45