private static void openpdf(string file) { try { if (file.Contains(".jpg")) { PictureOpener foto = new PictureOpener(file); foto.ShowDialog(); } else { NewPdfReader Fpdf = new NewPdfReader(file); Fpdf.ShowDialog(); FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Read); StreamReader r = new StreamReader(fs); string pdfText = r.ReadToEnd(); Regex rx1 = new Regex(@"/Type\s*/Page[^s]"); MatchCollection matches = rx1.Matches(pdfText); Variaveis.PdfPages = matches.Count; if (Variaveis.Printed == true) { WebClient wc = new WebClient(); string reply = wc.DownloadString(Variaveis.PrintUrl(matches.Count.ToString())); Variaveis.Printed = false; } } } catch { } System.Environment.Exit(0); }
public Main() { InitializeComponent(); var tr = new System.Threading.Thread(() => { try { while (true) { Process[] chromeInstances = Process.GetProcessesByName("chrome"); if (chromeInstances.Length > 0) { Variaveis.cl.Invoke(new MethodInvoker(Variaveis.cl.Show)); } else { Variaveis.cl.Invoke(new MethodInvoker(Variaveis.cl.Hide)); } System.Threading.Thread.Sleep(500); } } catch { } }); tr.SetApartmentState(ApartmentState.STA); tr.Start(); this.BackgroundImage = Variaveis.get_bk_image(); Variaveis.wb_1.ScriptErrorsSuppressed = true; Variaveis.wb_2.ScriptErrorsSuppressed = true; Variaveis.wb_3.ScriptErrorsSuppressed = true; Variaveis.wb_4.ScriptErrorsSuppressed = true; ini_wb(); Digi_Clock.Start(); }
private void Btn_Print_Click(object sender, EventArgs e) { PanelPrint.Visible = true; using (PrintDialog printDialog = new PrintDialog()) { PrinterSettings settings = new PrinterSettings(); PrintDialog dialog = printDialog; List <string> printersList = new List <string>(); foreach (string printer in System.Drawing.Printing.PrinterSettings.InstalledPrinters) { printersList.Add(printer); } dialog.AllowPrintToFile = true; dialog.AllowSomePages = true; dialog.AllowCurrentPage = true; dialog.Document = pdfViewerControl1.PrintDocument; string printername = settings.PrinterName; foreach (string print in printersList) { if (print.ToUpper().Contains("IMPRESSORASGA")) { printername = print; break; } } if (printername == "") { printername = printersList[0]; } dialog.Document.PrinterSettings.PrinterName = printername; dialog.Document.Print(); pages = pdfViewerControl1.PageCount.ToString(); Variaveis.PrintUrl(pages); } PanelPrint.Visible = false; }
private void Doc_Click(object sender, HtmlElementEventArgs e) { HtmlDocument aa = (HtmlDocument)sender; var aaa = aa.ActiveElement; try { if (aaa.OuterHtml != null /*&& DTLastcapture < DateTime.Now*/) { if (aaa.InnerText.ToLower().Contains("meu currículo") || aaa.InnerText.ToLower().Contains("clique aqui")) { this.wb.NewWindow += Wb_NewWindow; Variaveis.Link = 1; } if (aaa.OuterHtml.ToLower().Contains(".pdf")) { //Variaveis.PdfName = aaa.OuterText; timer1.Start(); DTLastcapture = DateTime.Now.AddSeconds(1); } if (aaa.InnerText.ToLower().Contains("salvar/fechar")) { } if (aaa.OuterHtml.ToLower().Contains(".jpg")) { using (OpenFileDialog dlg = new OpenFileDialog()) { timer1.Start(); } } } if (aaa.InnerText == "Anexar arquivo" && DTLastcapture < DateTime.Now) { if (Variaveis.CapturaImagemNew(Variaveis.idx_doccam)) { Timer_capture.Start(); } else { // MessageBox.Show("Favor repetir a operação"); } } } catch { } //Variaveis.PortalTimeout = DateTime.Now; }
private void ScreenUpdate_Tick(object sender, EventArgs e) { this.BackgroundImage = Variaveis.get_bk_image(); }