Esempio n. 1
0
        // Methods for binding the corresponding ICommand property.
        #region Button Command Methods

        /// <summary>
        /// Async method that references the UserBookinghandler and calls the cancelBookingMethod and updates the view
        /// </summary>
        public async Task CancelBookingMethodAsync()
        {
            await UserBookingHandler.CancelBookingMethodAsync();

            OnPropertyChanged(nameof(ElementIsChosenVisibility));
            OnPropertyChanged(nameof(NoElementsChosenVisibility));
            OnPropertyChanged(nameof(SelectedBooking));
            UserBookingHandler.RefreshLists();
        }
Esempio n. 2
0
        /// <summary>
        /// The UserBookingsVM ViewModel, instantiates the ICommand properties, it also refreshes the view, and reloads the lists to use in the view.
        /// </summary>
        public UserBookingsVM()
        {
            // Initialize first
            UserBookingHandler = new UserBookingHandler(this);
            // Gets filled with the bookings from the selected user on the UserBookingsOnId Method.
            AllUserBookingsFromSingleton = new ObservableCollection <AllBookingsView>();
            Tavlebookings = new ObservableCollection <TavleBooking>();
            Tavlebookings = TavleBookingCatalogSingleton.Instance.TavleBookings;

            // Instantiates the ICommands properties with a relaycommand
            AflysBookingCommand    = new RelayCommand(async() => await CancelBookingMethodAsync(), null);
            AflysTavleCommand      = new RelayCommand(async() => await CancelTavleBookingMethodAsync(), null);
            BookTavleCommand       = new RelayCommand(async() => await UserBookingHandler.BookTavleMethodAsync(), null);
            BookIgenImorgenCommand = new RelayCommand(async() => await UserBookingHandler.BookAgainTomorrowMethodAsync(), null);
            GoBackCommand          = new RelayCommand(UserBookingHandler.GoBackMethod, null); // DEN ER NULL; FIX DEN xD
            // Loads default visibility states
            UserBookingHandler.OnPageLoadVisibilities();
            // Filters the bookings to only show bookings for the selected user. HARD CODED USER ID, for use on the page, as a logged in user.
            UserBookingHandler.RefreshLists();
        }