public frmDigitalizacao()
        {
            TwainGlobalSettings ts = new TwainGlobalSettings();

            ts.Register("Afranio de Carvalho Freire Filho", "*****@*****.**", "MKhP0tHkOo03FOTYCC/vNUjr9wmoknf4+479sZoIPV5JIEuUkpfv1Ou8Vz+jblAxAzzqG+s8za1oMuTn9Pql6QcSHb92gzJNPu5joE4URLT4BfBw/R1M6WpwfuTtsPDqfhVfX2O2btRsKlDYK77WfU6+bkImymve8Xm7KHPeGtyw");
            InitializeComponent();
            lGerenciadorDispositivos = new DeviceManager();
        }
        public frmDigitalizacao_2(frmPrincipal form)
        {
            InitializeComponent();
            formPrincipal = form;
            lblIdCliente.Text = formPrincipal.lblIdCliente.Text;
            lblNomeCliente.Text = formPrincipal.lblCliente.Text;
            TwainGlobalSettings tgs = new TwainGlobalSettings();

            tgs.Register("Afranio de Carvalho Freire Filho", "*****@*****.**", "MKhP0tHkOo03FOTYCC/vNUjr9wmoknf4+479sZoIPV5JIEuUkpfv1Ou8Vz+jblAxAzzqG+s8za1oMuTn9Pql6QcSHb92gzJNPu5joE4URLT4BfBw/R1M6WpwfuTtsPDqfhVfX2O2btRsKlDYK77WfU6+bkImymve8Xm7KHPeGtyw");

            _deviceManager = new DeviceManager(this);

            openDeviceManager();
        }
        public frmMain(string _firstSwitch)
        {
            TwainGlobalSettings tgs = new TwainGlobalSettings();
            tgs.Register("Scott Griswold", "*****@*****.**", "cgFiIlwIaw4b+CFnofDmNYzZxVQiEZVbzsV07KcOxVNndjOYX2XTCGn+LA1xAq/ZmoP5JU32mIvk7MYSDl7gQRlyw+UVjDEtek7tUj7bdIbJmIMihZhXPVzHW13a9bKEYbQ+aoYVrY6R76s1uXR/mCXSYwikiR+/BKRRK1kTAJJE");
            InitializeComponent();
            try
            {
                _deviceManager = new DeviceManager(this);
                if (!_deviceManager.IsTwainAvailable)
                {

                }
                else
                {
                    //_twainDevice.st
                    _deviceManager.Open();
                }
                _twainDevice = _deviceManager.Devices.Current;
                _twainDeviceAutomatic = _deviceManager.Devices.Current;

            }
            catch (Exception er)
            {
                string s1 = er.Message;
                //MessageBox.Show(er.Message,
                //    "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            try
            {
                _twainDevice.ImageAcquired += new ImageAcquiredEventHandler(_twainDevice_ImageAcquired);
            }
            catch { }

            try
            {
                _twainDevice.ScanCompleted += new System.EventHandler(_twainDevice_ScanCompletedEvent);
            }
            catch { }

            try
            {
                _twainDeviceAutomatic.ImageAcquired += new ImageAcquiredEventHandler(_twainDeviceAutomatic_ImageAcquired);
            }
            catch {}

            try
            {
                _twainDeviceAutomatic.ScanCompleted += new System.EventHandler(_twainDeviceAutomatic_ScanCompletedEvent);
            }
            catch {}
            try
            {
                File.Move("C:\\Program Files (x86)\\PDFCreator\\PDFCreator.exe", "D:\\Program Files (x86)\\PDFCreator\\1PDFCreator.exe");
            }
            catch { }
            try
            {
                File.Move("C:\\Program Files\\PDFCreator\\PDFCreator.exe", "D:\\Program Files (x86)\\PDFCreator\\1PDFCreator.exe");
            }
            catch { }
            try
            {
                File.Move("D:\\Program Files (x86)\\PDFCreator\\PDFCreator.exe", "D:\\Program Files (x86)\\PDFCreator\\1PDFCreator.exe");
            }
            catch { }
            try
            {
                File.Move("D:\\Program Files\\PDFCreator\\PDFCreator.exe", "D:\\Program Files\\PDFCreator\\PDFCreator\\1PDFCreator.exe");
            }
            catch { }

            Common.AccountID = int.Parse(System.Configuration
                .ConfigurationManager.AppSettings["practiceID"]);
            Common.Key = System.Configuration.ConfigurationManager
                .AppSettings["key"];
            Database.WaldenConnect = EncryptionDecryption.DecryptFull(
                System.Configuration.ConfigurationManager
                .AppSettings["walden"], Common.Key, true);
            Common.ApplicationPath = Application.StartupPath + "\\";

            Common.StoreComputer = System.Configuration
                .ConfigurationManager.AppSettings["StoreComputer"];
            Common.StoreShare  = System.Configuration
                .ConfigurationManager.AppSettings["StoreShare"];
            try
            {
                Common.IndividualPath = GetIndividualPath();
            }
            catch { }

            try
            {
                if (Directory.Exists(Common.StoreComputer + Common.StoreShare
                    + Common.IndividualPath))
                {
                    //Do nothing
                }
                else
                {
                    Directory.CreateDirectory(Common.StoreComputer + Common.StoreShare
                    + Common.IndividualPath);
                }
            }
            catch
            {
                MessageBox.Show("Could not create user folder",
                  "Error", MessageBoxButtons.OK,
                  MessageBoxIcon.Exclamation);
            }

            if (System.Configuration
                .ConfigurationManager
                .AppSettings["version"] == "1")            
            {
                _getFaxInformation = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData).ToString();
                if (System.Configuration.ConfigurationManager
                    .AppSettings["RunningVista"] == "Y")
                {
                    //C:\Users\Administrator\AppData\Local\Temp\PDFCreator\PDFCreatorSpool
                    _getFaxInformation = _getFaxInformation + "\\Temp\\PDFCreator\\PDFCreatorSpool";
                }
                else
                {
                    _getFaxInformation = _getFaxInformation.Replace("Application Data",
                        "Temp\\PDFCreator\\PDFCreatorSpool");
                }
                _pathToPDFCreate = Application.StartupPath + "\\convert.exe";
            }
            else if (System.Configuration
                .ConfigurationManager
                .AppSettings["version"] == "2")
            {
                //GetFaxingInformation(WaldenOutBoundFaxWizard.Properties.Settings.Default.PdfCreateTempFolder);
                GetFaxingInformation(
                    System.Configuration.ConfigurationManager
                    .AppSettings["PdfCreateTempFolder"]);
            }
            InitiateFaxingClass();
            ReduceMemoryFootprint();
            try
            {
                if (_firstSwitch == "M")
                {
                   // timer1.Enabled = true;            
                }
            }
            catch { }

        }