Example #1
0
 private void btnRunAll_Click(object sender, EventArgs e)
 {
     try
     {
         if (GetNumberOfJobs(JobState.Ready) == 0)
         {
             throw new Exception("There are no available jobs to run!");
         }
         List <gMKVJobInfo> jobList = new List <gMKVJobInfo>();
         foreach (DataGridViewRow item in grdJobs.Rows)
         {
             gMKVJobInfo jobInfo = (gMKVJobInfo)item.DataBoundItem;
             if (jobInfo.State == JobState.Ready)
             {
                 jobInfo.State = JobState.Pending;
                 jobList.Add(jobInfo);
             }
         }
         grdJobs.Refresh();
         PrepareForRunJobs(jobList);
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex);
         ShowErrorMessage(ex.Message);
     }
 }
Example #2
0
        private Int32 GetNumberOfJobs(JobState argState)
        {
            Int32 counter = 0;

            foreach (DataGridViewRow drJobInfo in grdJobs.Rows)
            {
                gMKVJobInfo jobInfo = (gMKVJobInfo)drJobInfo.DataBoundItem;
                if (jobInfo.State == argState)
                {
                    counter++;
                }
            }
            return(counter);
        }
Example #3
0
 private void grdJobs_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         // Check if the row clicked is selected
         if (grdJobs.Rows[e.RowIndex].Selected)
         {
             gMKVJobInfo jobInfo = (gMKVJobInfo)grdJobs.Rows[e.RowIndex].DataBoundItem;
             if (jobInfo.State == JobState.Failed || jobInfo.State == JobState.Completed)
             {
                 jobInfo.Reset();
                 grdJobs.Refresh();
             }
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex);
     }
 }
Example #4
0
 public void AddJob(gMKVJobInfo argJobInfo)
 {
     _JobList.Add(argJobInfo);
 }
Example #5
0
        private void PrepareForRunJobs(List <gMKVJobInfo> argJobInfoList)
        {
            bool exceptionOccured = false;

            try
            {
                SetActionStatus(false);
                SetAbortStatus(true);
                _ExtractRunning = true;
                _MainForm.SetTableLayoutMainStatus(false);
                _TotalJobs         = argJobInfoList.Count;
                _CurrentJob        = 0;
                prgBrTotal.Maximum = _TotalJobs * 100;
                RunJobs(new List <gMKVJobInfo>(argJobInfoList));
                // Check exception builder for exceptions
                if (_ExceptionBuilder.Length > 0)
                {
                    // reset the status from pending to ready
                    foreach (DataGridViewRow item in grdJobs.Rows)
                    {
                        gMKVJobInfo jobInfo = (gMKVJobInfo)item.DataBoundItem;
                        if (jobInfo.State == JobState.Pending)
                        {
                            jobInfo.State = JobState.Ready;
                        }
                    }
                    throw new Exception(_ExceptionBuilder.ToString());
                }
                UpdateCurrentProgress(100);
                if (chkShowPopup.Checked)
                {
                    ShowSuccessMessage("The jobs completed successfully!");
                }
                else
                {
                    SystemSounds.Asterisk.Play();
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                ShowErrorMessage(ex.Message);
            }
            finally
            {
                if (chkShowPopup.Checked || exceptionOccured)
                {
                    UpdateCurrentProgress(0);
                    prgBrTotal.Value             = 0;
                    lblCurrentProgressValue.Text = string.Empty;
                    lblTotalProgressValue.Text   = string.Empty;
                }
                else
                {
                    lblCurrentProgressValue.Text = string.Empty;
                    lblTotalProgressValue.Text   = string.Empty;
                    txtCurrentTrack.Text         = "Extraction completed!";
                }
                gTaskbarProgress.SetState(this, gTaskbarProgress.TaskbarStates.NoProgress);
                gTaskbarProgress.SetOverlayIcon(this, null, null);
                _ExtractRunning = false;
                _AbortAll       = false;
                grdJobs.Refresh();
                SetActionStatus(true);
                SetAbortStatus(false);
                _MainForm.SetTableLayoutMainStatus(true);
            }
        }