Click or drag to resize

JobControlProvider Interface

Interface that provides access to job related settings.

Namespace:  Zebra.Sdk.Card.Job
Assembly:  SdkApi_Card_Core (in SdkApi_Card_Core.dll) Version: 2.14.1989
Syntax
public interface JobControlProvider

The JobControlProvider type exposes the following members.

Methods
  NameDescription
Public methodGetAllJobSettings
Retrieve all settings and their attributes.
Public methodGetAllJobSettingValues
Retrieves all of the device's setting values.
Public methodGetJobSettingRange
Retrieves the allowable range for a setting.
Public methodGetJobSettings
Retrieve all of the setting identifiers for a device.
Public methodGetJobSettingsValues
Retrieves the device's setting values for a list of setting IDs.
Public methodGetJobSettingType
Returns the data type of the setting.
Public methodGetJobSettingValue
Retrieves the device's setting value for a setting ID.
Public methodIsJobSettingReadOnly
Returns true if the setting is read only.
Public methodIsJobSettingValid
Returns true if value is valid for the given setting.
Public methodIsJobSettingWriteOnly
Returns true if the setting is write only.
Public methodSetJobSetting
Sets the setting to the given value.
Public methodSetJobSettings
Set more than one setting.
Top
Remarks
Job settings are not persistent and must be set prior to each job.
Examples
using System;
using System.Collections.Generic;
using Zebra.Sdk.Card.Printer;
using Zebra.Sdk.Card.Printer.Discovery;
using Zebra.Sdk.Comm;
using Zebra.Sdk.Printer.Discovery;

public class JobControlProviderExample {

    public static void Main(string[] args) {
        Connection connection = null;
        ZebraCardPrinter zebraCardPrinter = null;

        try {
            foreach (DiscoveredUsbPrinter usbPrinter in UsbDiscoverer.GetZebraUsbPrinters(new ZebraCardPrinterFilter())) {
                connection = usbPrinter.GetConnection();
                connection.Open();

                zebraCardPrinter = ZebraCardPrinterFactory.GetInstance(connection);
                DisplayJobSettings(zebraCardPrinter);

                CloseQuietly(connection, zebraCardPrinter);
            }
        } catch (Exception e) {
            Console.WriteLine($"Error retrieving job settings: {e.Message}");
        } finally {
            CloseQuietly(connection, zebraCardPrinter);
        }
    }

-    #region JobSettings
     /// <exception cref="ArgumentException"></exception>
     /// <exception cref="ConnectionException"></exception>
     /// <exception cref="System.IO.IOException"></exception>
     /// <exception cref="Zebra.Sdk.Settings.SettingsException"></exception>
     /// <exception cref="Zebra.Sdk.Card.Exceptions.ZebraCardException"></exception>
     private static void DisplayJobSettings(ZebraCardPrinter zebraCardPrinter) {
         if (zebraCardPrinter != null) {
             Console.WriteLine("Available Job Settings for myDevice:");
             HashSet<string> availableJobSettings = zebraCardPrinter.GetJobSettings();
             foreach (string setting in availableJobSettings) {
                 Console.WriteLine($"{setting}: Range = ({zebraCardPrinter.GetJobSettingRange(setting)})");
             }
 
             Console.WriteLine("\nCurrent Job Setting Values for myDevice:");
             Dictionary<string, string> allJobSettingValues = zebraCardPrinter.GetAllJobSettingValues();
             foreach (string settingName in allJobSettingValues.Keys) {
                 Console.WriteLine($"{settingName}:{allJobSettingValues[settingName]}");
             }
         }
     }
     #endregion JobSettings

-    #region CleanUp
     private static void CloseQuietly(Connection connection, ZebraCardPrinter zebraCardPrinter) {
         try {
             if (zebraCardPrinter != null) {
                 zebraCardPrinter.Destroy();
             }
 
             if (connection != null) {
                 connection.Close();
             }
         } catch { }
     }
     #endregion CleanUp
}
See Also