async void ExecuteLoadTrucksCommand() { if (IsBusy) { return; } IsBusy = true; try { Trucks.Clear(); var trucks = await TruckStore.GetTrucksAsync(true); Trucks.ReplaceRange(trucks); } catch (Exception ex) { Debug.WriteLine(ex); MessagingCenter.Send(new MessagingCenterAlert { Title = "Error", Message = "Unable to load Trucks.", Cancel = "OK" }, "message"); } IsBusy = false; }
/// <summary> /// Очистка данных. /// </summary> public void Clear() { Trucks.Clear(); Semitrailers.Clear(); Drivers.Clear(); Staff.Clear(); Routes.Clear(); }
public async Task LoadAsync() { var trucks = TruckInfoSampleData.GetSampleData(); Trucks.Clear(); await Task.Delay(2000); foreach (var truck in trucks) { Trucks.Add(new TruckVM() { ID = truck.ID, Name = truck.Name, Style = truck.Style }); } await Repository .GetObject <IDialogService>() .ShowDialogAsync("Initialization", "Data loaded", "OK", null); }