コード例 #1
0
 private void PrintReceipt()
 {
     if (CheckReceiptPrinterStatus())
     {
         PrintIO.PrintReceipt(Globals.receiptDir, taxinvoicenumber);
     }
 }
コード例 #2
0
 private void PrintPicsPDF()
 {
     if (CheckPhotoPrinterStatus())
     {
         PrintIO.PrintPDFs(Globals.PrintDir);
     }
 }
コード例 #3
0
 private void Btn_TestRcpt_Click(object sender, EventArgs e)
 {
     PrintIO.Generate_receipt(new List <string>()
     {
         "Test1", "Test2"
     }, "000.pdf", "000");
     PrintIO.PrintReceipt(PicsDirectoryDisplayWin.Globals.receiptDir, "000");
 }
コード例 #4
0
        private void PrintWatch_Tick(object sender, EventArgs e)
        {
            PrintState = PrintIO.CheckPrinterQueue(ConfigurationManager.AppSettings["PhotoPrinterName"]);

            if (PrintJobStatus.None != PrintState.status)
            {
                PrintStatusLbl.Visible = true;
                PrintStatusLbl.Text    = PrintState.status.ToString();
            }
            else
            {
                //status is None
                PrintStatusLbl.Visible = false;
            }
        }
コード例 #5
0
        private void PicsbgWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            PicsbgWorker.ReportProgress(25);

            PrintIO.Generate_receipt(SelectedImages, taxinvoicenumber + ".pdf", taxinvoicenumber);
            PrintReceipt();
            PicsbgWorker.ReportProgress(50);

            GeneratePicsPDF();

            PicsbgWorker.ReportProgress(75);
            PrintPicsPDF();
            //CheckPrinterQueue();
            PicsbgWorker.ReportProgress(100);
        }
コード例 #6
0
        private void DirectConnectButton_Click(object sender, EventArgs e)
        {
            //clear print queues.
            PrintIO.AbortPrinting();
            imageIO.DeleteAllFilesInDrectoryAndSubDirs(Globals.PrintDir);


            //PickDropGallery pickDropGallery = new PickDropGallery();
            //pickDropGallery.Show();

            //Set default value;
            //Globals.PrintSelection = Globals.PrintSize.A5;
            //Set user selected value.
            new PicSizeSeletion().ShowDialog();

            this.Visible = false;

            USBConnectHelp usbform = new USBConnectHelp();

            usbform.AnimationForm = this;
            usbform.TopMost       = true;
            usbform.ShowDialog();

            // Old implemetation of seacrhing images is commented.
            //AllImages = new List<ChitraKiAlbumAurVivaran>();
            //waiter = new Waiter();
            //waiter.Show();
            //var progressIndicator = new Progress<ChitraKiAlbumAurVivaran>(ReportProgressForImageSearch);
            //lib.ChitraKhoj imgSearch = new ChitraKhoj(Globals.USBSearchPath);

            //Task waitToComplete = new Task(async ()=>
            //{
            //    await imgSearch.Search(progressIndicator);
            //    if (InvokeRequired)
            //    {
            //        Invoke((Action<bool>)Done,false);
            //        return;
            //    }
            //});
            //waitToComplete.Start();
        }
コード例 #7
0
        private void PicsbgWorker_ProgressChanged(object sender, System.ComponentModel.ProgressChangedEventArgs e)
        {
            if (PrintState.alert && MessageBox.Show("Printing issue: " + ((PrinterState)e.UserState).status, "Print Error", MessageBoxButtons.RetryCancel) == DialogResult.Cancel)
            {
                PrintIO.AbortPrinting();
            }

            if (e.ProgressPercentage == 25)
            {
                PrintStatusLbl.Text = "Printing receipt";
            }

            if (e.ProgressPercentage == 50)
            {
                PrintStatusLbl.Text = "Printing pics";
            }
            if (e.ProgressPercentage == 75)
            {
                PrintStatusLbl.Text = "Checking print status";
            }
        }
コード例 #8
0
        private void WifiConnect_Click(object sender, EventArgs e)
        {
            //clear print queues.
            PrintIO.AbortPrinting();
            imageIO.DeleteAllFilesInDrectoryAndSubDirs(Globals.PrintDir);
            //Set default value;
            //Globals.PrintSelection = Globals.PrintSize.A5;
            //Set user selected value.
            new PicSizeSeletion().ShowDialog();

            this.Visible = false;
            if (whelp == null)
            {
                whelp = new WifiConnectHelp()
                {
                    AnimationForm = this
                };
                whelp.ShowDialog();
            }
            else
            {
                whelp.Visible = true;
            }
        }
コード例 #9
0
 private void Btn_PrntTest_Click(object sender, EventArgs e)
 {
     System.IO.File.Copy("Print99.pdf", PicsDirectoryDisplayWin.Globals.PrintDir + "\\Print99.pdf");
     PrintIO.PrintPDF(PicsDirectoryDisplayWin.Globals.PrintDir, 99);
 }
コード例 #10
0
 private void Button2_Click(object sender, EventArgs e)
 {
     //Cancel Print
     PrintIO.AbortPrinting();
 }
コード例 #11
0
        private void GeneratePicsPDF()
        {
            //Start();
            PdfImage    image1       = null;
            PdfImage    image2       = null;
            AspectRatio aspectRatio1 = AspectRatio.S4x3;
            AspectRatio aspectRatio2 = AspectRatio.S4x3;


            if (Globals.PrintSelection == Globals.PrintSize.A5)
            {
                for (int i = 0; i < SelectedImages.Count; i = i + 2)
                {
                    image1 = null; image2 = null;
                    //first image on page
                    image1       = PdfImage.FromFile(SelectedImages[i].Split('|')[0]); //Take Image name from image key
                    aspectRatio1 = PrintIO.DetectImageAspectRatio_A5(image1);
                    //second image on page
                    if (!(i + 1 >= SelectedImages.Count))
                    {
                        image2       = PdfImage.FromFile(SelectedImages[i + 1].Split('|')[0]);
                        aspectRatio2 = PrintIO.DetectImageAspectRatio_A5(image2);
                    }
                    PrintIO.SetPageMarginGeneratePDF_ImageRatio4x3_A5(Globals.PrintDir + "Print" + i + ".pdf", image1, image2, aspectRatio1, aspectRatio2);
                    if (ConfigurationManager.AppSettings["Mode"] == "Diagnostic")
                    {
                        logger.Log(NLog.LogLevel.Info, "Generating Image PDF..");
                    }
                }
            }
            else if (Globals.PrintSelection == Globals.PrintSize.A4)
            {
                for (int i = 0; i < SelectedImages.Count; i++)
                {
                    image1 = null; image2 = null;
                    //first image on page
                    image1       = PdfImage.FromFile(SelectedImages[i].Split('|')[0]); //Take Image name from image key
                    aspectRatio1 = PrintIO.DetectImageAspectRatio_A4(image1);
                    PrintIO.SetPageMarginGeneratePDF_ImageRatio4x3_A4(Globals.PrintDir + "Print" + i + ".pdf", image1, aspectRatio1);
                }
            }
            else if (Globals.PrintSelection == Globals.PrintSize.Passport)
            {
                image1 = PdfImage.FromFile(SelectedImages[0].Split('|')[0]); //Take Image name from image key
                PrintIO.SetPageMarginGeneratePDF_ImageRatio4x3_Passport(Globals.PrintDir + "Print" + 0 + ".pdf", image1);
            }
            else if (Globals.PrintSelection == Globals.PrintSize.Postcard)
            {
                for (int i = 0; i < SelectedImages.Count; i = i + 2)
                {
                    image1 = null; image2 = null;
                    //first image on page
                    image1       = PdfImage.FromFile(SelectedImages[i].Split('|')[0]); //Take Image name from image key
                    aspectRatio1 = PrintIO.DetectImageAspectRatio_Postcard(image1);
                    //second image on page
                    if (!(i + 1 >= SelectedImages.Count))
                    {
                        image2       = PdfImage.FromFile(SelectedImages[i + 1].Split('|')[0]);
                        aspectRatio2 = PrintIO.DetectImageAspectRatio_Postcard(image2);
                    }
                    PrintIO.SetPageMarginGeneratePDF_ImageRatio6x4_Postcard(Globals.PrintDir + "Print" + i + ".pdf", image1, image2, aspectRatio1, aspectRatio2);
                    if (ConfigurationManager.AppSettings["Mode"] == "Diagnostic")
                    {
                        logger.Log(NLog.LogLevel.Info, "Generating Image PDF..");
                    }
                }
            }
            else if (Globals.PrintSelection == Globals.PrintSize.pdf)
            {
                //TODO: If PDF file is large and have many page, a dialog to choose pages shud be displayed
                //Also, rejected files with more then 15 pages.
                for (int i = 0; i < SelectedImages.Count; i = i + 2)
                {
                    File.Copy(SelectedImages[i].Split('|')[0], Globals.PrintDir + "Print" + i + ".pdf");
                    if (ConfigurationManager.AppSettings["Mode"] == "Diagnostic")
                    {
                        PrintIO.PDFDocumentViewer(Globals.PrintDir + "Print" + i + ".pdf");
                    }
                }
            }
        }
コード例 #12
0
 private void button2_Click(object sender, EventArgs e)
 {
     PrintIO.Generate_receipt(SelectedImages, taxinvoicenumber + ".pdf", taxinvoicenumber);
     PrintReceipt();
 }