Пример #1
0
 public void EnqueueTask(WorkerTask task)
 {
     tasks.Enqueue(task);
     if (!worker.IsBusy)
     {
         nextTask();
     }
     else
     {
         if (AllWorkDone != null)
             AllWorkDone(this, new EventArgs());
     }
 }
Пример #2
0
 private void ValidateLogin(WorkerTask.WorkFinishedHandler handler, string login, string password)
 {
     worker.EnqueueTask(new WorkerTask(
         (args) =>
         {
             var log = args[0] as string;
             var pass = args[1] as string;
             try
             {
                 using (var proxy = new WorkChannel())
                 {
                     var result = proxy.GetUser(new EmptyRequest() { Login = log, Password = pass });
                     if (result == null) return null;
                     return result.Data;
                 }
             }
             catch(Exception exc)
             {
                 Console.WriteLine(exc.Message);
                 return exc;
             }
         },handler, login, password));
 }
Пример #3
0
 public void EnqueueTask(WorkerTask task)
 {
     this.Show();
     worker.EnqueueTask(task);
     worker.AllWorkDone += worker_AllWorkDone;
 }