예제 #1
0
        /// <summary>
        /// Prints the label.
        /// </summary>
        /// <param name="labelContents">The label contents.</param>
        /// <param name="labelPrinterIp">The label printer ip.</param>
        private void PrintLabel(string labelContents, string labelPrinterIp)
        {
            var rockConfig = RockConfig.Load();

            // if IP override
            if (!string.IsNullOrEmpty(rockConfig.PrinterOverrideIp))
            {
                PrintViaIp(labelContents, rockConfig.PrinterOverrideIp);
            }
            else if (!string.IsNullOrEmpty(rockConfig.PrinterOverrideLocal))   // if printer local
            {
                RawPrinterHelper.SendStringToPrinter(rockConfig.PrinterOverrideLocal, labelContents);
            }
            else // else print to given IP
            {
                PrintViaIp(labelContents, labelPrinterIp);
            }
        }
        /// <summary>
        /// Prints the label.
        /// </summary>
        /// <param name="labelContents">The label contents.</param>
        /// <param name="labelPrinterIp">The label printer ip.</param>
        private void PrintLabel(string labelContents, string labelPrinterIp)
        {
            var rockConfig = RockConfig.Load();

            // if IP override
            if (!string.IsNullOrEmpty(rockConfig.PrinterOverrideIp))
            {
                PrintViaIp(labelContents, rockConfig.PrinterOverrideIp);
            }
            else if (!string.IsNullOrEmpty(rockConfig.PrinterOverrideLocal))   // if printer local
            {
                RawPrinterHelper.SendStringToPrinter(rockConfig.PrinterOverrideLocal, labelContents);
            }
            else if (!string.IsNullOrWhiteSpace(labelPrinterIp)) // else print to given IP
            {
                PrintViaIp(labelContents, labelPrinterIp);
            }
            else
            {
                MessageBox.Show("No printer has been configured.", "Print Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }