Пример #1
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();
        }
Пример #2
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();
 }
Пример #3
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();
 }
Пример #4
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();
        }
Пример #5
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();
        }
Пример #6
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();
        }