Пример #1
0
        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;
        }
Пример #2
0
 /// <summary>
 /// Очистка данных.
 /// </summary>
 public void Clear()
 {
     Trucks.Clear();
     Semitrailers.Clear();
     Drivers.Clear();
     Staff.Clear();
     Routes.Clear();
 }
Пример #3
0
        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);
        }