classe parcial pública Form1: Formulário
{
bgw confidencial = zero de System.ComponentModel.BackgroundWorker;
Class1 confidencial myObject1 = Class1 novo ();
público Form1 ()
{
InitializeComponent ();
}
vácuo confidencial textBox1_KeyPress (remetente do objeto, KeyPressEventArgs e)
{
se (zero do == do bgw)
{
bgw = BackgroundWorker novo ();
bgw.DoWork += DoWorkEventHandler novo (bgw_DoWork);
bgw.RunWorkerCompleted += RunWorkerCompletedEventHandler novo (bgw_RunWorkerCompleted);
}
se (&& do == 13 de e.KeyChar! bgw.IsBusy)
{
textBox1.Enabled = falso;
myObject1.myString = textBox1.Text;
bgw.RunWorkerAsync ();
}
}
bgw_DoWork vago (remetente do objeto, DoWorkEventArgs e)
{
myObject1.queryRecent ();
}
o vácuo bgw_RunWorkerCompleted (remetente do objeto, RunWorkerCompletedEventArgs e)
{
label1.Text = myObject1.recentString;
textBox1.Enabled = retificam;
}
}
|