我有一个父表单protected override void OnActivityResult(int iRequestCode, Android.App.Result oResultCode, Intent oIntent)
{
base.OnActivityResult (iRequestCode, oResultCode, oIntent);
iValue = oIntent.Extras.GetInt("MYVALUE", -1); //=> 1234567890
}
,它会调用一个类AddEmployee
,而类会打开另一个(子)表单Worker
。我想将InformationFetching
设置为AddEmployee
的父格式,但我收到了跨线程错误。
InformationFetching
有人可以建议我在这里缺少什么吗?
答案 0 :(得分:1)
根据评论,我建议这样:
private void brnContinue_Click(object sender, EventArgs e)
{
Worker workerObject = new Worker(this);
Thread thrd = new Thread(() =>
{
Invoke(new MethodInvoker(delegate
{
addNewAccount(); // Do something heavy for 30s
workerObject.DoWork();
}));
});
thrd.Start();
}
private void addNewAccount()
{
validatorClass objClass = new validatorClass();
bool isSuccess = false;
isSuccess = objClass.verifyDetails(parameters);
}