private void UncheckSelectedCircuits() { try { using (var d = Dialogs.Loading("Progress")) { foreach (var circuit in Circuits) { circuit.IsSelected = TestedCircuits.Any(x => x.CircuitId == circuit.Circuit.CircuitId); } } } catch (Exception e) { Dialogs.Toast("Error occured"); } }
private async Task CheckSelectedCircuits() { try { var errorCheck = false; using (var d = Dialogs.Loading("Progress")) { foreach (var circuit in Circuits) { if (TestedCircuits.Any(x => x.CircuitId == circuit.Circuit.CircuitId)) { if (circuit.IsSelected) { continue; } var result = await _boardsService.RemoveTestedCircuit(circuit.Circuit.CircuitId, circuit.Circuit.BoardId, CertificateId); if (!result.Success) { errorCheck = true; } } if (circuit.IsSelected) { var result = await _boardsService.AddNewCircuitForTest(circuit.Circuit.CircuitId, circuit.Circuit.BoardId, CertificateId); if (!result.Success) { errorCheck = true; } } } } if (errorCheck) { Dialogs.Toast("Error occured"); } } catch (ServiceAuthenticationException e) { var result = await TryToLogin(); if (!result) { await NavigationService.NavigateToAsync <LoginViewModel>(); } else { await CheckSelectedCircuits(); } } catch (Exception e) { await ShowErrorAlert(e.Message); } }