public static void PrintLocalizeReceipt(ReceiptInformationManager receiptInfo)
        {
            byte[] commands = CreateLocalizeReceiptCommands(receiptInfo);


            Print(commands);
        }
        public static void PrintLocalizeReceiptWithAllReceipts(ReceiptInformationManager receiptInfo)
        {
            CommunicationResult result = new CommunicationResult();

            ProgressBarWindow progressBarWindow = new ProgressBarWindow("Communicating...", () =>
            {
                // Create print receipt with AllReceipts commands.
                byte[] commands = CreateLocalizeReceiptWithAllReceiptsCommands(receiptInfo);

                if (commands == null) // All print settings (Receipt, Information, QR Code) are OFF.
                {
                    result.Result = Communication.Result.Success;
                    result.Code   = StarResultCode.Succeeded;

                    return;
                }

                // Your printer PortName and PortSettings.
                string portName     = SharedInformationManager.SelectedPortName;
                string portSettings = SharedInformationManager.SelectedPortSettings;

                // Send commands to printer
                result = Communication.SendCommands(commands, portName, portSettings, 30000);
            });

            progressBarWindow.ShowDialog();

            Communication.ShowCommunicationResultMessage(result);
        }
Esempio n. 3
0
        private void PrintReceipt()
        {
            lock (lockObject)
            {
                CommunicationResult result = new CommunicationResult();

                ReceiptInformationManager receiptInfo = SharedInformationManager.ReceiptInformationManager;

                ProgressBarWindow progressBarWindow = new ProgressBarWindow("Communicating...", () =>
                {
                    byte[] commands = AllReceiptsSampleManager.CreateLocalizeReceiptWithAllReceiptsCommands(receiptInfo);

                    if (commands == null) // All print settings (Receipt, Information, QR Code) are OFF.
                    {
                        result.Result = Communication.Result.Success;
                        result.Code   = StarResultCode.Succeeded;

                        return;
                    }

                    result = Communication.SendCommands(commands, port);
                });

                progressBarWindow.ShowDialog();

                Communication.ShowCommunicationResultMessage(result);
            }
        }
Esempio n. 4
0
        private void PrintReceiptAndOpenCashDrawer()
        {
            lock (lockObject)
            {
                ReceiptInformationManager receiptInfo = SharedInformationManager.ReceiptInformationManager;

                byte[] commands = CreateLocalizeReceiptAndOpenCashDrawerCommands(receiptInfo);

                Communication.SendCommandsWithProgressBar(commands, port);
            }
        }
Esempio n. 5
0
        private void PrintReceipt()
        {
            lock (lockObject)
            {
                ReceiptInformationManager receiptInfo = SharedInformationManager.ReceiptInformationManager;

                byte[] commands = PrinterSampleManager.CreateLocalizeReceiptCommands(receiptInfo);

                Communication.SendCommandsWithProgressBar(commands, port);
            }
        }
        public static LocalizeReceipt CreateLocalizeReceipt(ReceiptInformationManager receiptInformationManager)
        {
            LocalizeReceipt localizeReceipts = null;

            switch (receiptInformationManager.LanguageType)
            {
            case LanguageType.English:
                localizeReceipts = new EnglishReceipt();
                break;

            case LanguageType.Japanese:
                localizeReceipts = new JapaneseReceipt();
                break;

            case LanguageType.French:
                localizeReceipts = new FrenchReceipt();
                break;

            case LanguageType.Portuguese:
                localizeReceipts = new PortugueseReceipt();
                break;

            case LanguageType.Spanish:
                localizeReceipts = new SpanishReceipt();
                break;

            case LanguageType.German:
                localizeReceipts = new GermanReceipt();
                break;

            case LanguageType.Russian:
                localizeReceipts = new RussianReceipt();
                break;

            case LanguageType.SimplifiedChinese:
                localizeReceipts = new SimplifiedChineseReceipt();
                break;

            case LanguageType.TraditionalChinese:
                localizeReceipts = new TraditionalChineseReceipt();
                break;

            case LanguageType.Utf8MultiLanguage:
                localizeReceipts = new Utf8MultiLanguageReceipt();
                break;
            }

            localizeReceipts.ReceiptInformationManager = receiptInformationManager;

            return(localizeReceipts);
        }
Esempio n. 7
0
        /// <summary>
        /// Sample : Creating printing receipt and open cash drawer commands.
        /// </summary>
        private byte[] CreateLocalizeReceiptAndOpenCashDrawerCommands(ReceiptInformationManager receiptInfo)
        {
            // Your printer emulation.
            Emulation emulation = SharedInformationManager.GetSelectedEmulation();

            // print paper size
            int paperSize = SharedInformationManager.GetSelectedActualPaperSize();

            // Creating localize receipt commands sample is in "LocalizeReceipts/'Language'Receipt.cs"
            ReceiptInformationManager.ReceiptType type = receiptInfo.Type;
            LocalizeReceipt localizeReceipt            = receiptInfo.LocalizeReceipt;

            byte[] commands;

            switch (type)
            {
            default:
            case ReceiptInformationManager.ReceiptType.Text:
                commands = CombinationFunctions.CreateTextReceiptData(emulation, localizeReceipt, false);
                break;

            case ReceiptInformationManager.ReceiptType.TextUTF8:
                commands = CombinationFunctions.CreateTextReceiptData(emulation, localizeReceipt, true);
                break;

            case ReceiptInformationManager.ReceiptType.Raster:
                commands = CombinationFunctions.CreateRasterReceiptData(emulation, localizeReceipt);
                break;

            case ReceiptInformationManager.ReceiptType.RasterBothScale:
                commands = CombinationFunctions.CreateScaleRasterReceiptData(emulation, localizeReceipt, paperSize, true);
                break;

            case ReceiptInformationManager.ReceiptType.RasterScale:
                commands = CombinationFunctions.CreateScaleRasterReceiptData(emulation, localizeReceipt, paperSize, false);
                break;

            case ReceiptInformationManager.ReceiptType.RasterCoupon:
                commands = CombinationFunctions.CreateCouponData(emulation, localizeReceipt, paperSize, BitmapConverterRotation.Normal);
                break;

            case ReceiptInformationManager.ReceiptType.RasterCouponRotation90:
                commands = CombinationFunctions.CreateCouponData(emulation, localizeReceipt, paperSize, BitmapConverterRotation.Right90);
                break;
            }

            return(commands);
        }
        /// <summary>
        /// Sample : Creating printing receipt with AllReceipts commands.
        /// </summary>
        public static byte[] CreateLocalizeReceiptWithAllReceiptsCommands(ReceiptInformationManager receiptInfo)
        {
            byte[] commands;

            // Your printer emulation.
            Emulation emulation = SharedInformationManager.SelectedEmulation;

            // print paper size
            int paperSize = receiptInfo.ActualPaperSize;

            // Creating localize receipt commands sample is in "LocalizeReceipts/'Language'Receipt.cs"
            ReceiptInformationManager.ReceiptType type = receiptInfo.Type;
            LocalizeReceipt localizeReceipt            = receiptInfo.LocalizeReceipt;

            // Select printing contents.
            bool printReceipt     = SharedInformationManager.AllReceiptsPrintReceipt;
            bool printInformation = SharedInformationManager.AllReceiptsPrintInformation;
            bool printQrCode      = SharedInformationManager.AllReceiptsPrintQrCode;

            switch (type)
            {
            default:
            case ReceiptInformationManager.ReceiptType.Text:
                commands = AllReceiptsFunctions.CreateTextReceiptData(emulation, localizeReceipt, paperSize, false, printReceipt, printInformation, printQrCode);
                break;

            case ReceiptInformationManager.ReceiptType.TextUTF8:
                commands = AllReceiptsFunctions.CreateTextReceiptData(emulation, localizeReceipt, paperSize, true, printReceipt, printInformation, printQrCode);
                break;

            case ReceiptInformationManager.ReceiptType.Raster:
                commands = AllReceiptsFunctions.CreateRasterReceiptData(emulation, localizeReceipt, paperSize, printReceipt, printInformation, printQrCode);
                break;

            case ReceiptInformationManager.ReceiptType.RasterBothScale:
                commands = AllReceiptsFunctions.CreateScaleRasterReceiptData(emulation, localizeReceipt, paperSize, true, printReceipt, printInformation, printQrCode);
                break;

            case ReceiptInformationManager.ReceiptType.RasterScale:
                commands = AllReceiptsFunctions.CreateScaleRasterReceiptData(emulation, localizeReceipt, paperSize, false, printReceipt, printInformation, printQrCode);
                break;
            }

            return(commands);
        }
Esempio n. 9
0
        /// <summary>
        /// Sample : Creating printing receipt with page mode commands.
        /// </summary>
        public static byte[] CreateLocalizeReceiptWithPageModeCommands(ReceiptInformationManager receiptInfo)
        {
            // Your printer emulation.
            Emulation emulation = SharedInformationManager.SelectedEmulation;

            // Creating localize receipt commands sample is in "LocalizeReceipts/'Language'Receipt.cs"
            LocalizeReceipt localizeReceipt = receiptInfo.LocalizeReceipt;

            // Image height.
            int height = 30 * 8;

            // Image width.
            int width = SharedInformationManager.SelectedActualPaperSize;

            // Image rotation.
            BitmapConverterRotation rotation = receiptInfo.Rotation;

            // Print region.
            Rectangle printRegion;

            switch (rotation)
            {
            default:
            case BitmapConverterRotation.Normal:
                printRegion = new Rectangle(0, 0, width, height);
                break;

            case BitmapConverterRotation.Right90:
                printRegion = new Rectangle(0, 0, width, width);
                break;

            case BitmapConverterRotation.Rotate180:
                printRegion = new Rectangle(0, 0, width, height);
                rotation    = BitmapConverterRotation.Rotate180;
                break;

            case BitmapConverterRotation.Left90:
                printRegion = new Rectangle(0, 0, height, width);
                break;
            }

            byte[] commands = PrinterFunctions.CreateTextPageModeData(emulation, localizeReceipt, printRegion, rotation, false);

            return(commands);
        }
Esempio n. 10
0
        /// <summary>
        /// Sample : Creating printing receipt with black mark commands.
        /// </summary>
        public static byte[] CreateLocalizeReceiptWithBlackMarkCommands(ReceiptInformationManager receiptInfo)
        {
            // Your printer emulation.
            Emulation emulation = SharedInformationManager.GetSelectedEmulation();

            // Select black mark type.
            BlackMarkType blackMarkType = SharedInformationManager.GetSelectedBlackMarkType();

            // Creating localize receipt commands sample is in "LocalizeReceipts/'Language'Receipt.cs"
            ReceiptInformationManager.ReceiptType type = receiptInfo.Type;
            LocalizeReceipt localizeReceipt            = receiptInfo.LocalizeReceipt;

            byte[] commands;

            switch (receiptInfo.Type)
            {
            default:
            case ReceiptInformationManager.ReceiptType.Text:
                commands = PrinterFunctions.CreateTextBlackMarkData(emulation, localizeReceipt, blackMarkType, false);
                break;
            }

            return(commands);
        }
        public static void PrintLocalizeReceiptUsingRedirection(ReceiptInformationManager receiptInfo)
        {
            byte[] commands = PrinterSampleManager.CreateLocalizeReceiptCommands(receiptInfo);

            PrintRedirection(commands);
        }
        private void CopyProperty(ReceiptInformationManager source)
        {
            Language = new Language(source.Language.Type);

            AllPaperSizes = source.AllPaperSizes;
        }
        private void CopyProperty(ReceiptInformationManager source)
        {
            Language = new Language(source.Language.Type);

            PaperSize = new PaperSize(source.PaperSize.Type);
        }