public void LoadportAlarmReset() { MacHalContext halContext = null; MacHalLoadPort loportAssembly = null; MacHalLoadPortGudeng TestLoadport = null; try { halContext = new MacHalContext("GenCfg/Manifest/Manifest.xml.real"); halContext.MvaCfLoad(); loportAssembly = halContext.HalDevices[EnumMacDeviceId.loadportA_assembly.ToString()] as MacHalLoadPort; TestLoadport = loportAssembly.Hals[EnumMacDeviceId.loadport_1.ToString()] as MacHalLoadPortGudeng; TestLoadport.HalConnect(); BindLoadPortEvent(TestLoadport); TestLoadport.CommandAlarmReset(); Repeat(); } catch (Exception ex) { MvaLog.WarnNs(this, ex); } finally { if (halContext != null) { halContext.Dispose(); } } }