Exemple #1
0
        public async Task SearchByStopCodeAsync()
        {
            IsLoading = true;

            try
            {
                StopInfo info = await new ArrivalsService().GetByStopCodeAsync(stopCode);

                IsLoading = false;

                StopInfo  = info;
                Direction = stopInfo.Lines.FirstOrDefault(l => !String.IsNullOrEmpty(l.Direction))?.Direction;

                MessengerInstance.Send(new ShowMapMessage(true, StopInfo.Lines.Count));
                await HistoryDomain.AddAsync(stopCode, stopInfo.Name);
            }
            catch (StopNotFoundException)
            {
                await ApplicationService.DisplayAlertAsync("Няма данни", $"Няма данни за спирка {stopCode}.", "OK");
            }
            catch (Exception e)
            {
                await ApplicationService.DisplayAlertAsync("Грешка", e.Message, "OK");
            }
        }
Exemple #2
0
        private async void HistoryCommandAction(object obj)
        {
            var domain = new HistoryDomain();
            var list   = await domain.GetPTIHistory(SelectedPTI);

            if (list != null)
            {
                var form = new Views.HistoryView(list, "PTI HISTORIES");
                form.ShowDialog();
            }
        }
        private async Task CleanHistoryAsync()
        {
            IsLoading = true;

            await HistoryDomain.CleanHistoryAsync();

            IsLoading = false;

            MessengerInstance.Send(new HistoryClearedMessage());
            ApplicationService.DisplayToast("Историята е изчистена");
        }
        public async Task LoadHistoryAsync()
        {
            IsLoading = true;

            History = new ObservableCollection <HistoryDomain>(await HistoryDomain.TakeAsync());
            RaisePropertyChanged("History");
            RaisePropertyChanged("HasHistory");

            IsLoading = false;

            HistoryDomain.HistoryAdded += OnHistoryAdded;
        }