示例#1
0
文件: Form1.cs 项目: meoti/TBARP
        private async void ExecuteButton_ClickAsync(object sender, EventArgs e)
        {
            i = 0;
            animatepanel.Visible = true;
            labelf.Text          = "Processing PDFs ...";
            Thread.Sleep(1);
            circleProgressbar.Value = 1;

            // _files contains all the files.
            _files.Clear();
            foreach (string filePath in DropBox.Items)
            {
                if (!pdfData.Keys.Contains(System.IO.Path.GetFileNameWithoutExtension(filePath)))
                {
                    _files.Add(filePath);
                }
            }

            await WorkAsync();

            circleProgressbar.Value = 100;
            Thread.Sleep(1200);
            animatepanel.Visible = false;
            homePanel.Visible    = false;

            // add dynamically the custom buttons
            //dynaPdfListPanel.Controls.Clear();
            //dynaPdfBtns.Clear();
            System.Drawing.Point newLoc = new System.Drawing.Point(-2, 3);
            foreach (string pdfname in pdfData.Keys.Where(pdfname => !dynaPdfListPanel.Controls.ToString().Contains(pdfname)))
            {
                var b = new Listbutton(pdfname, pdfname);
                newLoc.Offset(0, b.Height + 2);
                b.Click += new EventHandler(DynaDataExtract);
                dynaPdfListPanel.Controls.Add(b);

                //dynaPdfBtns.Add(b);
                b.Location = newLoc;
            }
            //dynaPdfListPanel.Visible = true;
            //pdfFlatButton_Click(sender, e);
            settingPanel.Visible = true;
            homeTransition.ShowSync(dynaPdfListPanel);
            pdfFlatButton.selected      = true;
            homeButton.selected         = false;
            templateFlatButton.selected = false;
            bunifuFlatButton1.selected  = false;
            bunifuFlatButton3.selected  = false;
        }
示例#2
0
文件: Form1.cs 项目: meoti/TBARP
        // no need to thread this
        private void DynaDataExtract(object sender, EventArgs e)
        {
            Listbutton button = sender as Listbutton;

            foreach (Control c in dynaPdfListPanel.Controls)
            {
                Listbutton a = (Listbutton)c;
                a.Iconimage_right = null;
            }

            button.selected        = true;
            button.Iconimage_right = Resources.selected;
            bunifuCustomDataGrid2.Rows.Clear();
            // get contents and process
            string txt = pdfData[button.Name];

            //should be a better way to filter whitespace
            txt = txt.Replace("\n\r\n\t\n\n\r\n", "");
            txt = txt.Replace("\n\n\r\n", Environment.NewLine);
            txt = txt.Replace("\n\r\n", Environment.NewLine);
            //txt = return_regex.Replace(txt, Environment.NewLine);
            txt              = txt.Replace('|', 'I');
            contents         = txt.Split(new string[] { Environment.NewLine, "\n" }, StringSplitOptions.None);
            txt              = regex.Replace(txt, "\t");
            content_Box.Text = (txt.Replace(" ", "-"));

            //get from saved data
            Pdf    pdf      = new Pdf();
            string provider = pdf.GetProviderName(contents);

            pdf.ReadProviderSettings(provider);
            providerTextbox.Text = provider.ToUpper();
            pdf.ProcessContent(contents);

            //var info = pdf.info;
            //put info in UI
            var check = Print_To_Screen(pdf.info, pdf.headerKeyword);

            if (check)
            {
                button.Iconimage = Properties.Resources.tick;
            }
            else
            {
                button.Iconimage = Properties.Resources.exclamation;
            }
        }