日期:2014-05-17 浏览次数:21248 次
// 这个interface 是SDK提供的,它的内部详细内容我不了解
interface Eventhandler
{
public void OnSomeEvent();
}
// 这个class 是SDK提供的,它的内部详细内容我不了解
public class FingerPrintCapturer
{
public EventHandler CapturerEventHandler;
}
// 我的自定义类
public class MyForm: Form, EventHandler
{
private FingerPrintCapturer FPCapturer;
private Label label1;
public Class1()
{
FPCapturer = new FingerPrintCapturer(); // 似乎这个对象运行在一个新线程中
FPCapturer.CapturerEventHandler = this; // 实际上这一行的接口赋值也一直没搞懂,相关帖子见下文
}
// 似乎是这个函数运行在一个新线程中
public void OnSomeEvent()
{
// method definition
}
private void ModifyStatusLabel()
{
// 下面这行报告跨线程操作的一个错误
// Cross-thread operation not valid: Control 'label1' accessed from a thread other than the thread it was created on.
this.label1.Text = "SOME TEXT";
}
}