public partial class Form1 : Form
{
delegate void HandleInterfaceUpdateDelegate(int a);
HandleInterfaceUpdateDelegate updateDelegate;
public Form1()
{
updateDelegate = new HandleInterfaceUpdateDelegate(RX);
InitializeComponent();
}
public void RX(int a) {
MessageBox.Show(a.ToString());
}
private void button1_Click(object sender, EventArgs e)
{
BeginInvoke(updateDelegate,10);
}
}
public partial class Form1 : Form
{
public System.Timers.Timer tmr = new System.Timers.Timer(1);
public Form1()
{
InitializeComponent();
tmr.Interval = 20;
tmr.Elapsed += new System.Timers.ElapsedEventHandler(TmrCheckDataReadyElapsed);
tmr.Enabled = false;
}
public void RX(int a) {
MessageBox.Show(a.ToString());
}
public void TmrCheckDataReadyElapsed(object sender, System.Timers.ElapsedEventArgs e)
{
MessageBox.Show("168104910");
}
private void button1_Click(object sender, EventArgs e)
{
tmr.Enabled = true;
}
}