Exemple #1
0
 /// <summary>
 /// Queues a background worker. If the 'ParseOneAtATime' setting is false, workers are run asynchronously
 /// </summary>
 /// <param name="row"></param>
 private void QueueOrRunWorker(GridRow row)
 {
     btnClear.Enabled  = false;
     btnParse.Enabled  = false;
     btnCancel.Enabled = true;
     if (Properties.Settings.Default.ParseOneAtATime)
     {
         if (_anyRunning)
         {
             _logQueue.Enqueue(row);
             row.Status         = "Queued";
             row.Metadata.State = RowState.Pending;
             dgvFiles.Invalidate();
         }
         else
         {
             _anyRunning = true;
             row.Run();
         }
     }
     else
     {
         row.Status         = "Waiting for a thread";
         row.Metadata.State = RowState.Pending;
         row.Run();
     }
 }
Exemple #2
0
        /// <summary>
        /// Adds log files to the bound data source for display in the interface
        /// </summary>
        /// <param name="filesArray"></param>
        private void AddLogFiles(string[] filesArray)
        {
            foreach (string file in filesArray)
            {
                if (_logsFiles.Contains(file))
                {
                    //Don't add doubles
                    continue;
                }

                _logsFiles.Add(file);

                GridRow gRow = new GridRow(file, " ")
                {
                    BgWorker = new BackgroundWorker {
                        WorkerReportsProgress = true, WorkerSupportsCancellation = true
                    }
                };
                gRow.BgWorker.DoWork             += BgWorkerDoWork;
                gRow.BgWorker.ProgressChanged    += BgWorkerProgressChanged;
                gRow.BgWorker.RunWorkerCompleted += BgWorkerCompleted;

                gridRowBindingSource.Add(gRow);

                if (Properties.Settings.Default.AutoParse)
                {
                    gRow.Run();
                }
            }

            btnParse.Enabled = true;
        }
Exemple #3
0
 /// <summary>
 /// Runs the next background worker, if one is available
 /// </summary>
 private void RunNextWorker()
 {
     if (_logQueue.Count > 0)
     {
         GridRow row = _logQueue.Dequeue();
         row.Run();
     }
 }
 /// <summary>
 /// Runs the next background worker, if one is available
 /// </summary>
 private void RunNextWorker()
 {
     if (_logQueue.Count > 0)
     {
         GridRow row = _logQueue.Dequeue();
         row.Run();
     }
     else
     {
         _anyRunning = false;
     }
 }
Exemple #5
0
 /// <summary>
 /// Queues a background worker. If the 'ParseOneAtATime' setting is false, workers are run asynchronously
 /// </summary>
 /// <param name="row"></param>
 private void QueueOrRunWorker(GridRow row)
 {
     if (Properties.Settings.Default.ParseOneAtATime)
     {
         if (_AnyRunning)
         {
             _logQueue.Enqueue(row);
             row.Status         = "Queued";
             row.Metadata.State = RowState.Pending;
             dgvFiles.Invalidate();
         }
         else
         {
             row.Run();
             _AnyRunning = true;
         }
     }
     else
     {
         row.Run();
     }
 }
Exemple #6
0
 /// <summary>
 /// Runs the next background worker, if one is available
 /// </summary>
 private void RunNextWorker()
 {
     if (Properties.Settings.Default.ParseOneAtATime)
     {
         _anyRunning = false;
     }
     if (_logQueue.Count > 0)
     {
         GridRow row = _logQueue.Dequeue();
         _anyRunning = true;
         row.Run();
     }
     else
     {
         if (_runningCount == 0)
         {
             _anyRunning       = false;
             btnParse.Enabled  = true;
             btnClear.Enabled  = true;
             btnCancel.Enabled = false;
         }
     }
 }