//--------------------------------------------------------------------------------
 /// <summary>
 /// Fired when the user clicks the Cancel button
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void buttonCancel_Click(object sender, EventArgs e)
 {
     clsGlobalVariables.Browsed = false;
     WizardPageCamera.DisconnectUSBCamera();
     WizardPageCamera.DeleteAllSnapshots();
     CleanFolders();
     this.Close();
 }
        //--------------------------------------------------------------------------------
        /// <summary>
        /// Fired when the user clicks the Start button (to return to the first wizard
        /// page).
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonStart_Click(object sender, EventArgs e)
        {
            WizardPageCamera.DisconnectUSBCamera();
            WizardPage currentPage = PageChain.GoFirst();

            // raise the page change event - this currently does nothing but lets the
            // base class know when the active page has changed
            Raise_WizardPageChangeEvent(new WizardPageChangeArgs(currentPage, WizardStepType.Previous));
        }
        //--------------------------------------------------------------------------------
        /// <summary>
        /// Fired when the Next button is clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonNext_Click(object sender, EventArgs e)
        {
            // if the current page (before changing) is the last page in the wizard,
            // take steps to close the wizard
            //WizardPage a = PageChain.GetCurrentPage();
            clsGlobalVariables.WizardPagePrevious = PageChain.GetCurrentPage().Name;

            if (PageChain.GetCurrentPage().WizardPageType == WizardPageType.Stop)
            {
                // call the central SaveData method (which calls the SaveData
                // method in each page in the chain
                if (PageChain.SaveData() == null)
                {
                    // and if everything is okay, close the wizard form
                    clsGlobalVariables.Browsed = false;
                    this.Close();
                }
            }
            // otherwise, move to the next page in the chain, and let the base class know
            else
            {
                WizardPage currentPage = PageChain.GoNext(PageChain.GetCurrentPage().GetNextPage());
                clsGlobalVariables.WizardPageCurrent = currentPage.Name;


                if (currentPage.Name == "WizardPageCamera")
                {
                    WizardPageCamera.ConnectUSBCamera();
                }

                if (currentPage.Name == "WizardPageEditor")
                {
                    WizardPageCamera.DisconnectUSBCamera();
                }

                if (currentPage.Name == "WizardPageUSBBrowser")
                {
                    clsGlobalVariables.USBBrowserShow = true;
                }

                if (currentPage.Name == "WizardPagePrintSummary")
                {
                    //WizardPagePrintSummary a = new WizardPagePrintSummary();

                    //a.loadFilesToPrint();
                    clsGlobalVariables.SummaryPageAccess = true;
                }

                Raise_WizardPageChangeEvent(new WizardPageChangeArgs(currentPage, WizardStepType.Next));
            }
        }
        //--------------------------------------------------------------------------------
        /// <summary>
        /// Fired when the back button is clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonBack_Click(object sender, EventArgs e)
        {
            // tell the page chain to go to the previous page
            clsGlobalVariables.WizardPagePrevious = PageChain.GetCurrentPage().Name;
            if (clsGlobalVariables.WizardPagePrevious == "WizardPageCamera")
            {
                WizardPageCamera.DisconnectUSBCamera();
            }

            WizardPage currentPage = PageChain.GoBack();

            clsGlobalVariables.WizardPageCurrent = currentPage.Name;

            if (clsGlobalVariables.WizardPageCurrent == "WizardPageCamera")//WizardPage3
            {
                WizardPageCamera.ConnectUSBCamera();
            }

            // raise the page change event (this currently does nothing but lets the
            // base class know when the active page has changed
            Raise_WizardPageChangeEvent(new WizardPageChangeArgs(currentPage, WizardStepType.Previous));
        }
 private void WizardPagesLoader_FormClosed(object sender, FormClosedEventArgs e)
 {
     WizardPageCamera.DisconnectUSBCamera();
     clsGlobalVariables.Browsed = false;
 }