Exemplo n.º 1
0
        private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
        {
            if (tim != null)
            {
                tim.Dispose();
            }

            importWorker = new ImportToDbWorker(openFileDialog1.FileName, this.stopTimeOfWorker);
            importThread = new Thread(importWorker.doWork);
            importThread.Name = importWorker.GetType().Name;
            importThread.Start();

            TimerCallback callback = this.updateStatus;
            tim = new System.Threading.Timer(callback, null, 500, 100);

        }
Exemplo n.º 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (importWorker != null)
     {
         importWorker.requestStop();
         importWorker = null;
         importThread.Interrupt();
         importThread = null;
     }
     if (tim != null)
     {
         tim.Dispose();
         tim = null;
     }
 }