private void BckgBatch_DoWork(object sender, DoWorkEventArgs e)
        {
            int totalNumOfFiles = lstBatchHandbookFiles.Items.Count;
            for (int i = 1; i <= totalNumOfFiles; i++)
            {
                try
                {
                    AddToLog("Start Batch Handbook conversion. File "+i.ToString()+"/"+totalNumOfFiles.ToString());
                    this.Invoke(new MethodInvoker(delegate { UpdateBatchLabel("("+i.ToString() + "/" + totalNumOfFiles.ToString()+") Exporting slides (this may take a while)..."); }));
                    bckgBatch.ReportProgress(0);

                    HandbookPPT hbPPT = new HandbookPPT();
                    string pptFileName = lstBatchHandbookFiles.Items[i - 1].ToString();
                    AddToLog("Start exporting slides from: " + pptFileName);
                    string exportSlidesRetVal = hbPPT.ExportSlides(pptFileName, bckgBatch);
                    bckgBatch.ReportProgress(33);

                    this.Invoke(new MethodInvoker(delegate { UpdateBatchLabel("(" + i.ToString() + "/" + totalNumOfFiles.ToString() + ") Creating the handbook..."); }));
                    HandbookDoc hbDOC = new HandbookDoc();
                    string docFileName="";
                    docFileName = Path.GetDirectoryName(pptFileName) + "\\" + Path.GetFileNameWithoutExtension(pptFileName) + ".docx";
                    bool instructorGuide = chkHandbookInstructorGuide.Checked;
                    bool goSamePage = chkBatchHandbookGoalObjSamePage.Checked;
                    AddToLog("Start creating handbook document: " + docFileName);
                    hbDOC.CreateDocument(pptFileName, bckgBatch, docFileName, instructorGuide, goSamePage);
                    bckgBatch.ReportProgress(100);
                    AddToLog("Handbook conversion finished.");
                    if (chkHandbookDeletePictures.Checked)
                    {
                        string folderName = Path.GetDirectoryName(pptFileName) + "\\" + Path.GetFileNameWithoutExtension(pptFileName);
                        AddToLog("Deleting slide pictures folder: " + folderName);
                        Directory.Delete(folderName, true);
                    }
                }
                catch (Exception ex)
                {
                    AddToLog("Problem in handbook conversion: " + ex.Message);
                    MessageBox.Show("There was a problem with handbook conversion." + ex.Message);
                }
            }
        }
        private void BckgHandbook_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                AddToLog("Start Handbook conversion.");
                this.Invoke(new MethodInvoker(delegate { UpdateHandbookLabel("Exporting slides (this may take a while)..."); }));
                bckgHandbook.ReportProgress(0);

                HandbookPPT hbPPT = new HandbookPPT();
                string pptFileName = txtHandbookFile.Text;
                AddToLog("Start exporting slides from: " + pptFileName);
                string exportSlidesRetVal = hbPPT.ExportSlides(pptFileName, bckgHandbook);
                bckgHandbook.ReportProgress(33);

                this.Invoke(new MethodInvoker(delegate { UpdateHandbookLabel("Creating the handbook..."); }));
                HandbookDoc hbDOC = new HandbookDoc();
                string docFileName = txtHandbookSaveLocation.Text;
                bool instructorGuide = chkHandbookInstructorGuide.Checked;
                bool goSamePage = chkGoalObjSamePage.Checked;
                AddToLog("Start creating handbook document: " + docFileName);
                hbDOC.CreateDocument(pptFileName, bckgHandbook, docFileName, instructorGuide, goSamePage);
                bckgHandbook.ReportProgress(100);
                AddToLog("Handbook conversion finished.");
                if (chkHandbookDeletePictures.Checked)
                {
                    string folderName = Path.GetDirectoryName(pptFileName) + "\\" + Path.GetFileNameWithoutExtension(pptFileName);
                    AddToLog("Deleting slide pictures folder: " + folderName);
                    Directory.Delete(folderName, true);
                }
            }
            catch(Exception ex)
            {
                AddToLog("Problem in handbook conversion: " + ex.Message);
                MessageBox.Show("There was a problem with handbook conversion." + ex.Message);
            }
        }