示例#1
0
 public void GetCasesAsync(string search, OnCasesFetched OnDone)
 {
     BackgroundWorker bw = new CultureAwareBackgroundWorker();
     bw.DoWork += new DoWorkEventHandler(delegate(object sender, DoWorkEventArgs args)
     {
         args.Result = _fb.GetCases(search);
     });
     bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(delegate(object sender, RunWorkerCompletedEventArgs args)
     {
         if (args.Error != null)
             OnDone(null, args.Error);
         else
             OnDone((Case[])args.Result, null);
     });
     bw.RunWorkerAsync();
 }
示例#2
0
 public void LoginAsync(string username, string password, OnLogin OnDone)
 {
     Utils.Log.DebugFormat("Logging in as {0}", username);
     BackgroundWorker bw = new CultureAwareBackgroundWorker();
     bw.DoWork += new DoWorkEventHandler(delegate(object sender, DoWorkEventArgs args)
     {
         args.Result = _fb.LogOn(username, password);
     });
     bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(delegate(object sender, RunWorkerCompletedEventArgs args)
     {
         if (args.Error != null)
         {
             Utils.Log.ErrorFormat("Error during login: {0}", args.Error.ToString());
             OnDone(false);
         }
         else
             OnDone((bool)args.Result);
     });
     bw.RunWorkerAsync();
 }
示例#3
0
        private void testSearchAsync(RunWorkerCompletedEventHandler OnTestSearchComplete)
        {
            CultureAwareBackgroundWorker bw = new CultureAwareBackgroundWorker();

            String search = _model.FormatSearchQuery();
            bw.DoWork += new DoWorkEventHandler(delegate(object sender, DoWorkEventArgs args)
            {
                args.Result = _fb.GetCases(search);
            });
            bw.RunWorkerCompleted += OnTestSearchComplete;
            bw.RunWorkerAsync();
        }