Exemplo n.º 1
0
        private void btnRefresh_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Bitmap bmp;
                if (!imageFromFile)
                {
                    bmp = blockOcr.GetOcrImage(false);
                }
                else
                {
                    bmp = (Bitmap)System.Drawing.Image.FromFile(path);
                }
                OrigImage.Image = bmp;

                //apply filter
                var proc = blockOcr.ApplyFilters(bmp.Clone() as Bitmap);
                ProcImage.Image = proc;
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message, "NOTICE",
                                                     System.Windows.Forms.MessageBoxButtons.OK,
                                                     System.Windows.Forms.MessageBoxIcon.Error);
            }
        }
        private void btnRefresh_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Bitmap bmp;
                CProxy proxy = null;
                if (!imageFromFile)
                {
                    if (chbProxy.IsChecked.GetValueOrDefault() && chbProxy.IsEnabled)
                    {
                        proxy = blockOcr.CreateProxy(proxyTextbox.Text, proxyTypeCombobox.SelectedItem.ToString().ToEnum(ProxyType.Http));
                    }
                    bmp = blockOcr.GetOcrImage(false, proxy);
                }
                else
                {
                    bmp = (Bitmap)System.Drawing.Image.FromFile(path);
                }
                OrigImage.Image = bmp;

                //apply filter
                var proc = blockOcr.ApplyFilters(bmp.Clone() as Bitmap);
                ProcImage.Image = proc;
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message, "NOTICE",
                                                     System.Windows.Forms.MessageBoxButtons.OK,
                                                     System.Windows.Forms.MessageBoxIcon.Error);
            }
        }