public async Task Update() { //if (_semaphoreSlim.CurrentCount == 0) return; //await _semaphoreSlim.WaitAsync(); if (DeviceSelection.SelectedDevice == (byte)DeviceSelectionEnum.DEVICE_PICON2) { ushort[] ConnectionModuleId; { ConnectionModuleId = await RTUConnectionGlobal.GetDataByAddress(1, 0x3004, 1); } if ((byte)ConnectionModuleId[0] != 0xE0 && (byte)ConnectionModuleId[0] != 0xE1) { return; } byte[] value = await RTUConnectionGlobal.ExecuteFunction12Async((byte)ConnectionModuleId[0], "Get Picon SignalLevel", 0x60); if (value == null) { return; } Application.Current.Dispatcher.Invoke(() => { SetGsmPicon2(value); }); } else { ushort[] value = await RTUConnectionGlobal.GetDataByAddress(1, 0x001F, 8); Application.Current.Dispatcher.Invoke(() => { SetGsm(value); }); } //if (_semaphoreSlim.CurrentCount == 0) //{ // _semaphoreSlim.Release(); //} }