Ejemplo n.º 1
0
 private void _currentWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     if (this._currentWorkerData != null)
     {
         IDisposable id = this._currentWorkerData as IDisposable;
         if (id != null)
             id.Dispose();
         this._currentWorkerData = null;
     }
     if (e.Cancelled)
         return;
     this.Status = Statuses.Expanded_Idle;
     Exception x;
     if (e.Error != null)
         x = e.Error;
     else
         x = e.Result as Exception;
     if (x != null)
     {
         this.sslSearch.BackColor = SystemColors.Highlight;
         this.sslSearch.ForeColor = SystemColors.HighlightText;
         this.sslSearch.Text = x.Message;
     }
     else
     {
         this.sslSearch.BackColor = SystemColors.Control;
         this.sslSearch.ForeColor = SystemColors.WindowText;
         this.sslSearch.Text = (this.lbxFound.Items.Count == 1) ? "1 item found." : string.Format("{0:N0} items found.", this.lbxFound.Items.Count);
     }
     this.sslSearch.ToolTipText = this.sslSearch.Text;
 }
Ejemplo n.º 2
0
 private void StartSearch(WorgData dta)
 {
     this.StopSearch(Statuses.Expanded_Working, true);
     this.sslSearch.ToolTipText = "";
     this.sslSearch.BackColor = SystemColors.Control;
     this.sslSearch.ForeColor = SystemColors.WindowText;
     this.sslSearch.Text = "Searching...";
     this.sspSearch.Minimum = 0;
     this.sspSearch.Value = 0;
     this.sspSearch.Maximum = dta.Entries.Count;
     this.ssSarch.Visible = true;
     this.sslStop.Visible = true;
     this._currentWorkerData = dta;
     try
     {
         this._currentWorker = new BackgroundWorker();
         this._currentWorker.WorkerReportsProgress = true;
         this._currentWorker.WorkerSupportsCancellation = true;
         this._currentWorker.DoWork += this._currentWorker_DoWork;
         this._currentWorker.ProgressChanged += this._currentWorker_ProgressChanged;
         this._currentWorker.RunWorkerCompleted += this._currentWorker_RunWorkerCompleted;
         this._currentWorker.RunWorkerAsync(dta);
     }
     catch (Exception x)
     {
         this._currentWorker = null;
         this._currentWorker_RunWorkerCompleted(null, new RunWorkerCompletedEventArgs(null, x, false));
     }
 }