/// <summary>
        ///
        /// head.resolution.in_dpi:203
        /// zpl.label_length:590
        /// odometer.label_dot_length:590
        /// media.width_sense.in_mm:104.1
        /// media.width_sense.in_cm:10.41
        /// media.width_sense.in_dots:832
        /// media.width_sense.in_inches:4.099
        /// sensor.width.cur:209
        /// sensor.width.in_dots:832
        ///
        /// </summary>
        /// <param name="c"></param>
        private static void DisplaySettings(Connection c)
        {
            ZebraPrinter       genericPrinter = ZebraPrinterFactory.GetInstance(c);
            ZebraPrinterLinkOs linkOsPrinter  = ZebraPrinterFactory.CreateLinkOsPrinter(genericPrinter);

            if (linkOsPrinter != null)
            {
                Console.WriteLine("Available Settings for myDevice");
                HashSet <string> availableSettings = linkOsPrinter.GetAvailableSettings();
                foreach (string setting in availableSettings)
                {
                    Console.WriteLine($"{setting}: Range = ({linkOsPrinter.GetSettingRange(setting)})");
                }

                Console.WriteLine("\nCurrent Setting Values for myDevice");
                Dictionary <string, string> allSettingValues = linkOsPrinter.GetAllSettingValues();
                foreach (string settingName in allSettingValues.Keys)
                {
                    Console.WriteLine($"{settingName}:{allSettingValues[settingName]}");
                }

                string darknessSettingId = "print.tone";
                string newDarknessValue  = "10.0";
                if (availableSettings.Contains(darknessSettingId) &&
                    linkOsPrinter.IsSettingValid(darknessSettingId, newDarknessValue) &&
                    linkOsPrinter.IsSettingReadOnly(darknessSettingId) == false)
                {
                    linkOsPrinter.SetSetting(darknessSettingId, newDarknessValue);
                }

                Console.WriteLine($"\nNew {darknessSettingId} Value = {linkOsPrinter.GetSettingValue(darknessSettingId)}");
            }
        }
Esempio n. 2
0
        public static void GetPrinterAllSetting()
        {
            if (printerHTTP != null && linkOsPrinter != null)
            {
                //HashSet<string> availableSettings = linkOsPrinter.GetAvailableSettings();
                Dictionary <string, string> allSettingValues = linkOsPrinter.GetAllSettingValues();

                /*foreach (string setting in availableSettings)
                 * {
                 *      MessageBox.Show($"{setting}: Range = ({linkOsPrinter.GetSettingRange(setting)})");
                 * }*/
                foreach (string settingName in allSettingValues.Keys)
                {
                    MessageBox.Show($"{settingName}:{allSettingValues[settingName]}");
                    //Console.WriteLine($"{settingName}:{allSettingValues[settingName]}");
                }
                //return allSettingValues;
            }
            else
            {
                MessageBox.Show("连接失败!");
            }
            //return null;
        }