Example #1
0
 /// <summary>
 /// Release singleton object
 /// </summary>
 public static void ReleaseInstance()
 {
     if (s_OPCServerProxy == null)
     {
         return;
     }
     lock (s_Singleton)
     {
         try
         {
             if (s_OPCServerProxy != null)
             {
                 s_OPCServerProxy.RemoveAllOPCItem();
                 s_OPCServerProxy.ReleaseOPC();
                 s_OPCServerProxy.m_observers.Clear();
                 s_OPCServerProxy.m_TotryQuene.Clear();
                 //s_OPCServerProxy.m_observers = null;
                 //s_OPCServerProxy.m_TotryQuene = null;
                 //s_OPCServerProxy = null;
             }
         }
         catch (Exception ex)
         {
             LogHelper.Error(ex.ToString());
         }
         finally
         {
             s_OPCServerProxy.m_observers  = null;
             s_OPCServerProxy.m_TotryQuene = null;
             s_OPCServerProxy = null;
         }
     }
 }
Example #2
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public static OPCServerProxy GetInstance()
 {
     if (s_OPCServerProxy != null)
     {
         return(s_OPCServerProxy);
     }
     lock (s_Singleton)
     {
         if (s_OPCServerProxy == null)
         {
             LogHelper.Debug("OPCServerProxy Singleton instance created!");
             s_OPCServerProxy = new OPCServerProxy();
         }
     }
     return(s_OPCServerProxy);
 }