public static void dispose() { if (bgSrv1 != null) { bgSrv1.Dispose(); bgSrv1 = null; } }
public static BGServer GetBGOPCServer(Window owner) { if (bgSrv1 == null) { bgSrv1 = new BGServer(owner); } lock (opcConLock) { try { bgSrv1.GetStatus(null, onBGSrvGetStatus); if (!connectStatus) { if (opcMachineHost == null) { opcMachineHost = ConfigurationManager.AppSettings["OPCSHostMachine"]; } if (opcServerName == null) { opcServerName = ConfigurationManager.AppSettings["OPCServer"]; } Host opcHost = new Host(); opcHost.HostName = opcMachineHost; bgSrv1.Connect(opcHost, opcServerName, null, onConnectComplete); } } catch (Exception errMsg) { Console.WriteLine("" + errMsg.Message); } finally { } } return(bgSrv1); }