如果他真的想删除特定产品,我会根据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;
获得了无效的跨线程访问权限,我很确定,通过整个登录方法会发生该错误。
答案 0 :(得分:0)
方便的课程:
public class SmartDispatcher
{
public static void BeginInvoke(Action action)
{
if (Deployment.Current.Dispatcher.CheckAccess()
|| DesignerProperties.IsInDesignTool)
{
action();
}
else
{
Deployment.Current.Dispatcher.BeginInvoke(action);
}
}
}