コード例 #1
0
ファイル: PLCCommand2.cs プロジェクト: Zhangoufei/CSharpTest
 public static PLCCommand2 GetInstance()
 {
     if (instance == null)
     {
         lock (syncLock)
         {
             if (instance == null)
             {
                 instance = new PLCCommand2();
             }
         }
     }
     return(instance);
 }
コード例 #2
0
ファイル: PLCCommand2.cs プロジェクト: Zhangoufei/CSharpTest
 public static void Dispose()
 {
     if (instance != null)
     {
         try
         {
             foreach (var item in instance.opcGrpsDic)
             {
                 item.Value.Remove(false);
             }
             instance.opcSrv.Disconnect();
             instance = null;
         }
         catch (Exception ex)
         {
             LogImpl.Error(string.Format("{0}{2}{1}", ex.StackTrace, ex.Message, System.Environment.NewLine));
         }
     }
 }