我根据 XNA GamerService 对话框询问我的应用程序用户,他是否真的想删除特定产品。
如果他按下是,这将采取行动:
private void OnMessageBoxAction(IAsyncResult ar)
{
int? selectedButton = Guide.EndShowMessageBox(ar);
switch (selectedButton)
{
case 0:
WebClient cweight = new WebClient();
cweight.Encoding = System.Text.Encoding.GetEncoding("ISO-8859-1");
cweight.Credentials = new NetworkCredential(op.username, op.userpass);
cweight.DownloadStringCompleted += new DownloadStringCompletedEventHandler(deleted);
cweight.DownloadStringAsync(new Uri("http://mydomain.com"));
break;
case 1:
Debug.WriteLine("1 pressed");
break;
default:
Debug.WriteLine("default pressed");
break;
}
}
下载完成后,我调用登录方法:
private void deleted(object sender, DownloadStringCompletedEventArgs e)
{
Debug.WriteLine("\n[#] deleted");
if (e.Error != null)
{
Debug.WriteLine("Delete problem");
}
Debug.WriteLine("Delete successful");
login(null, null);
}
后来在login
我得到了无效的跨线程访问,globalprogress.Visibility = System.Windows.Visibility.Visible;
我很确定,这个错误会通过整个登录方法发生。