Exemple #1
0
 /// <summary>
 /// 获取DriverKitchenPrint单例
 /// </summary>
 /// <returns></returns>
 public static DriverKitchenPrint GetInstance(string printerName, string paperName, string paperType)
 {
     if (string.IsNullOrEmpty(printerName))
     {
         throw new ArgumentNullException("Printer name is null.");
     }
     if (string.IsNullOrEmpty(paperName))
     {
         throw new ArgumentNullException("Paper name is null.");
     }
     if (string.IsNullOrEmpty(paperType))
     {
         throw new ArgumentNullException("Paper type is null.");
     }
     lock (Obj)
     {
         string             key = printerName + "_" + paperName + "_" + paperType;
         DriverKitchenPrint instance;
         if (DicInstance.ContainsKey(key))
         {
             instance = DicInstance[key];
         }
         else
         {
             instance = new DriverKitchenPrint(printerName, paperName, paperType);
             DicInstance.Add(key, instance);
         }
         return(instance);
     }
 }
 /// <summary>
 /// 获取DriverKitchenPrint单例
 /// </summary>
 /// <returns></returns>
 public static DriverKitchenPrint GetInstance(string printerName, string paperName, string paperType)
 {
     if (string.IsNullOrEmpty(printerName))
     {
         throw new ArgumentNullException("Printer name is null.");
     }
     if (string.IsNullOrEmpty(paperName))
     {
         throw new ArgumentNullException("Paper name is null.");
     }
     if (string.IsNullOrEmpty(paperType))
     {
         throw new ArgumentNullException("Paper type is null.");
     }
     lock (Obj)
     {
         string key = printerName + "_" + paperName + "_" + paperType;
         DriverKitchenPrint instance;
         if (DicInstance.ContainsKey(key))
         {
             instance = DicInstance[key];
         }
         else
         {
             instance = new DriverKitchenPrint(printerName, paperName, paperType);
             DicInstance.Add(key, instance);
         }
         return instance;
     }
 }