示例#1
0
        static ACSConfig()
        {
            try
            {
                if (IniFile == null)
                {
                    var pathIni = Path.GetDirectoryName(Application.ExecutablePath) + @"\Config.ypt";

                    if (!File.Exists(pathIni))
                    {
                        var msg = "Arquivo de configuração não encontrado. Avise o administrador do sistema!";
                        var e   = new Exception(msg, new Exception(pathIni));
                        ACSLog.InsertLog(MessageBoxIcon.Error, e, "ACS.Config.cs: line 28");
                        WFMessageBox.Show(msg, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Process.GetCurrentProcess().Kill();
                    }

                    IniFile = new IniParser(pathIni);
                }
            }
            catch (Exception ex)
            {
                ACSLog.InsertLog(MessageBoxIcon.Error, ex.ToString());
                WFMessageBox.Show(ex.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
        public new void Remove()
        {
            try
            {
                var Doc = (Document)this.Parent;

                if (BeforeRemovePageEvent != null)
                {
                    BeforeRemovePageEvent(this);
                }

                if (File.Exists(this.FileName))
                {
                    File.Delete(this.FileName);
                }

                if (!File.Exists(this.FileName))
                {
                    base.Remove();
                }

                if (Doc.Pages.Count() <= 0)
                {
                    Doc.Remove();
                }
            }
            catch (Exception e)
            {
                ACSLog.InsertLog(MessageBoxIcon.Error, e);
                WFMessageBox.Show(e.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
示例#3
0
 private void WFObservation_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (this.tbObservation.Text.Trim() == "")
     {
         WFMessageBox.Show("Observação obrigatória!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         e.Cancel = true;
     }
 }
示例#4
0
        public ImageBoxCapture LoadFromBitmap(Bitmap bmp, string FileName)
        {
            try
            {
                var             listImbAll = this.tlpImages.Controls.OfType <ImageBoxCapture>().ToList();
                var             listImb    = listImbAll.Where(imb => imb.Image == null);
                ImageBoxCapture result;
                if (listImb.Count() > 0)
                {
                    result = listImb.First();
                }
                else if (listImbAll.Count() > 0)
                {
                    ClearAllImages();
                    result = listImbAll.First();
                }
                else
                {
                    result = null;
                }

                if (result != null)
                {
                    result.Image    = bmp;
                    result.fileName = FileName;
                    if (this.ZoomFitOnLoadBitmap)
                    {
                        result.Zoom = 37;
                    }
                }

                if (AfterLoadFromFile != null)
                {
                    AfterLoadFromFile(this, result, FileName);
                }

                return(result);
            }
            catch (Exception e)
            {
                ACSLog.InsertLog(MessageBoxIcon.Error, e);
                WFMessageBox.Show(e.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }
        }
        private void btnOk_Click1(object sender, EventArgs e)
        {
            DateTime dt;
            bool     result = false;

            if (!DateTime.TryParse(tbStartDate.Text, out dt))
            {
                WFMessageBox.Show("Data inválida!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.DialogResult = DialogResult.None;
                return;
            }
            else
            {
                result = true;
            }

            if (tbDateValidity.Enabled)
            {
                if (!DateTime.TryParse(tbDateValidity.Text, out dt))
                {
                    WFMessageBox.Show("Data inválida!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.DialogResult = DialogResult.None;
                    return;
                }
                else
                {
                    result = true;
                }
            }

            if (result)
            {
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                this.DialogResult = DialogResult.None;
            }
        }
示例#6
0
        public virtual void Scan(short CountPages = 200, AxFiScnLib.AxFiScn _driverFujitsu = null, WFCapture wfCapture = null)
        {
            try
            {
                if (this.BeforeScanEvent != null)
                {
                    this.BeforeScanEvent(this);
                }

                if (!msgfilter)
                {
                    msgfilter = true;
                    Application.AddMessageFilter(this);
                }

                this.tw = new Twain(this.Handle);
                this.tw.TransferPictureEvent += TransferPictureEvent;
                this.tw.Brightness            = ACSConfig.GetImages().Brightness;
                this.tw.Contrast              = ACSConfig.GetImages().Contrast;
                this.tw.Resolution            = ACSConfig.GetImages().Resolution;
                this.tw.ScanAs = ACSConfig.GetScanner().ScanAs;
                this.tw.SetDevice(ACSConfig.GetScanner().Driver);

                var nameDriver = ACSConfig.GetScanner().Driver;

                if (nameDriver.ToUpper().Contains("SP-1120"))
                {
                    Fujitsu clsFujitsu = new Fujitsu(_driverFujitsu, wfCapture, ACSGlobal.LoteSelecionado.DIRLOTEINBOX);
                    if (clsFujitsu.AcquireFujitsu() == 1)
                    {
                        if (this.AfterScanEvent != null)
                        {
                            //  this.AfterScanEvent(true);
                            EndingScan(false);
                        }
                    }
                    else
                    {
                        EndingScan(false);
                        WFMessageBox.Show("Sem comunicação com scanner!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                if (nameDriver.ToUpper().Contains("LEXMARK"))
                {
                    //WFLoading.ShowLoad();
                    bool isDuplex = ACSGlobal.Duplex;

                    if (this.tw.AcquireLexmark(CountPages, 0, 0, isDuplex) == TwRC.Success)
                    {
                        if (this.AfterScanEvent != null)
                        {
                            this.AfterScanEvent(true);
                        }     //WFLoading.CloseLoad();
                    }
                    else
                    {
                        if (this.AfterScanEvent != null)
                        {
                            this.AfterScanEvent(false);
                        }
                        EndingScan(false);
                        WFMessageBox.Show("Sem comunicação com scanner!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    bool isDuplex = ACSGlobal.Duplex;

                    if (this.tw.Acquire(CountPages, 0, 0, isDuplex) == TwRC.Success)
                    {
                        if (this.AfterScanEvent != null)
                        {
                            this.AfterScanEvent(true);
                        }
                        WFLoading.CloseLoad();
                    }
                    else
                    {
                        if (this.AfterScanEvent != null)
                        {
                            this.AfterScanEvent(false);
                        }
                        EndingScan(false);
                        WFMessageBox.Show("Sem comunicação com scanner!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }



                if (!ACSConfig.GetScanner().Driver.ToUpper().Contains("FUJITSU") && !ACSConfig.GetScanner().Driver.ToUpper().Contains("SP-1120"))
                {
                    Application.DoEvents();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }