public void Initialize() { _setting = new SettingHook(); _plcIpAddress = _setting.GetPlcIpAdress(); _plcScanStartAddress = _setting.GetPlcStartAddress(); _loadingStartAddress = _setting.GetPlcLoadingDataMatrixStartAddress(); _unloadingStartAddress = _setting.GetPlcUnloadingDataMatrixStartAddress(); _activeReferenceStartAddress = _setting.GetPlcActiveReferenceStartAddress(); _plcMaster = new PlcMaster(_plcIpAddress, 502) { ScanStartAddress = (ushort)_plcScanStartAddress, LoadingDataMatrixStartAddress = (ushort)_loadingStartAddress, UnloadingDataMatrixStartAddress = (ushort)_unloadingStartAddress, ActiveReferenceStartAddress = (ushort)_activeReferenceStartAddress }; _plcMaster.OnException += ModbusOnException; }