public FestivalListViewModel(IFrameNavigationService navigationService, IFestivalService festivalService)
        {
            _navigationService = navigationService;

            OpenFestivalCommand = new RelayCommand <int>(OpenFestival);
            Festivals           = (CollectionView)CollectionViewSource.GetDefaultView(festivalService.GetFestivals());
            Festivals.Filter    = Filter;

            festivalService.Sync();
        }
예제 #2
0
        public async void UpdateFestival()
        {
            try
            {
                await _festivalService.UpdateFestival(Festival);

                _festivalService.Sync();
                _navigationService.NavigateTo("FestivalInfo", Festival.Id);
            }
            catch (InvalidDataException)
            {
                OpenValidationPopup($"Ingevoerde data incorrect.");
            }
            catch (InvalidAddressException)
            {
                OpenValidationPopup("Er is een ongeldig adres ingevoerd, controleer of je minimaal een straat, postcode en plaats hebt.");
            }
            catch (EndDateEarlierThanStartDateException)
            {
                OpenValidationPopup("De einddatum moet later zijn dan de startdatum");
            }
        }
예제 #3
0
        private async void CreateFestival()
        {
            try
            {
                await _festivalService.CreateFestival(Festival, _customerId);

                _festivalService.Sync();
                _navigationService.NavigateTo("FestivalInfo", Festival.Id);
            }
            catch (InvalidAddressException)
            {
                OpenValidationPopup("Er is een ongeldig adres ingevoerd, controleer of je minimaal een straat, postcode en plaats hebt.");
            }
            catch (EndDateEarlierThanStartDateException)
            {
                OpenValidationPopup("De einddatum moet later zijn dan de startdatum");
            }
            catch (Exception e)
            {
                OpenValidationPopup($"Er is een fout opgetreden bij het toevoegen van het festival, de fout is: {e.GetType()}");
            }
        }