Exemple #1
0
 /// <summary>
 /// 获取DriverOrderPrint单例
 /// </summary>
 /// <returns></returns>
 public static DriverCardPrint 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;
         DriverCardPrint instance;
         if (DicInstance.ContainsKey(key))
         {
             instance = DicInstance[key];
         }
         else
         {
             instance = new DriverCardPrint(printerName, paperName, paperType);
             DicInstance.Add(key, instance);
         }
         return(instance);
     }
 }
 /// <summary>
 /// 获取DriverOrderPrint单例
 /// </summary>
 /// <returns></returns>
 public static DriverCardPrint 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;
         DriverCardPrint instance;
         if (DicInstance.ContainsKey(key))
         {
             instance = DicInstance[key];
         }
         else
         {
             instance = new DriverCardPrint(printerName, paperName, paperType);
             DicInstance.Add(key, instance);
         }
         return instance;
     }
 }