public async Task searchForCommessaOrTarga() { stopwatch.Reset(); try { IsBusy = true; if (HasInternetConnection) { if (string.IsNullOrEmpty(commessa) && string.IsNullOrEmpty(targa)) { MessagingCenter.Send <string, string>(MessagingCenterEvents.Subscriber, MessagingCenterEvents.AlertError, Messages.Commessa.InvalidFieldsCommessaTarga); IsBusy = false; return; } if (!string.IsNullOrEmpty(commessa) || !string.IsNullOrEmpty(targa)) { stopwatch.Start(); lstCommessa = await _apiService.CheckCommessaAsync(App.UserID, commessa, targa, filterCommesse); stopwatch.Stop(); if (lstCommessa != null) { if (lstCommessa.Count > 0) { SetColorStatesInconvenienti(lstCommessa); listItemSource = new ObservableCollection <CommessaDTO>(lstCommessa); } } } } else { MessagingCenter.Send <string, string>(MessagingCenterEvents.Subscriber, MessagingCenterEvents.AlertError, Messages.NoInternetConnection); } IsBusy = false; } catch (Exception ecc) { Log.Error("AppOfficina", ecc.Message); IsBusy = false; MessagingCenter.Send <string, string>(MessagingCenterEvents.Subscriber, MessagingCenterEvents.AlertError, Messages.Commessa.UnknownApiCommessaCheck); return; } }