/// <summary> /// Async method that references the UserBookinghandler and calls the CancelTavleBookingAsync method and updates the view /// </summary> public async Task CancelTavleBookingMethodAsync() { await UserBookingHandler.CancelTavleBookingMethodAsync(); OnPropertyChanged(nameof(AflysTavleBtnVisibility)); OnPropertyChanged(nameof(BookTavleBtnVisibility)); OnPropertyChanged(nameof(SelectedBooking)); OnPropertyChanged(nameof(SelectedTavleBooking)); }
// 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(); }
// Methods for refreshing lists and visibility properties based on userId, the bookfilter method checks if its possible to book a tavle #region Refresh and filter methods /// <summary> /// Method that calls the UserBookingHandler and calls the corresponding methodname, and updates the view after the call /// </summary> public void CheckIfTavleBookingExists() { UserBookingHandler.CheckIfTavleBookingExists(); // Refreshes the visibility properties OnPropertyChanged(nameof(AflysTavleBtnVisibility)); OnPropertyChanged(nameof(BookTavleBtnVisibility)); OnPropertyChanged(nameof(TavleInkluderetVisibility)); OnPropertyChanged(nameof(TavleCanBeBookedVisibility)); OnPropertyChanged(nameof(TavleButtonsEnabled)); OnPropertyChanged(nameof(SelectedTavleBooking)); }
/// <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(); }
/// <summary> /// Resets the comboxes, and timepicker for tavle booking and updates the viewbound properties /// </summary> public void ResetSelectedTavleProperties() { UserBookingHandler.ResetSelectedTavleProperties(); OnPropertyChanged(nameof(SelectedTavleStartTime)); OnPropertyChanged(nameof(SelectedDuration)); }