Example #1
0
        protected async override void OnAppearing()
        {
            base.OnAppearing();
            // OnPropertyChanged();
            viewModel.IsBusy = true;
            var reservationsservices = new ReservationsServices();

            viewModel.ReservationsList = await reservationsservices.GetReservationsAsync();

            viewModel.IsBusy = false;
            // await DisplayAlert("Erorr!", "Check Your Connection !", "Ok");

            //if (CrossConnectivity.Current.IsConnected)
            //{
            //  //  viewModel.IsBusy = true;

            //    var reservationsservices = new ReservationsServices();
            //    viewModel.ReservationsList = await reservationsservices.GetReservationsAsync();
            //   // viewModel.IsBusy = false;
            //}
            //else
            //{
            //    await DisplayAlert("Erorr!", "Check Your Connection !", "Ok");
            //}
        }
        async void SaveButton_Clicked(object sender, EventArgs e)
        {
            viewModel.IsBusy = true;
            var reservationsservices = new ReservationsServices();

            if (!(String.IsNullOrEmpty(ClubEntry.Text) || String.IsNullOrEmpty(TimeFromEntry.Text) || String.IsNullOrEmpty(TimeToEntry.Text)))
            {
                if (!String.IsNullOrEmpty(viewModel.StatusMassage))
                {
                    viewModel.StatusMassage = "";
                }
                var isSuccess = await reservationsservices.AddReservationsAsync(viewModel.SelectReservations);

                if ((isSuccess == true))
                {
                    viewModel.StatusMassage = "Add Successfully !";
                }
                else
                {
                    viewModel.StatusMassage = "Operation Add Failed !";
                }
            }
            else
            {
                viewModel.StatusMassage = "Complate Chooses !";
            }
            viewModel.IsBusy = false;
        }
Example #3
0
        public async Task InitializeDataAsync()
        {
            IsBusy = true;
            var reservationsservices = new ReservationsServices();

            ReservationsList = await reservationsservices.GetReservationsAsync();

            IsBusy = false;
        }
Example #4
0
        private async void SearchBar_SearchButtonPressed(object sender, EventArgs e)
        {
            var reservationsViewModels = BindingContext as ReservationsViewModels;
            //reservationsViewModels.IsBusy = false;
            string keyword = SearchBar.Text;
            var    reservationsservices = new ReservationsServices();

            viewModel.ReservationsList = await reservationsservices.GetReservationsByKeywordAsync(keyword);

            //reservationsViewModels.IsBusy = true;
        }
Example #5
0
        private async void DoSearchCommand()
        {
            IsBusy = true;
            // Refresh the list, which will automatically apply the search text
            var reservationsservices = new ReservationsServices();
            await reservationsservices.GetReservationsByKeywordAsync(_keyword);

            OnPropertyChanged();
            IsBusy = false;
            // RaisePropertyChanged(() => YourList);
        }
Example #6
0
        private async void SearchBar_TextChanged(object sender, TextChangedEventArgs e)
        {
            var reservationsViewModels = BindingContext as ReservationsViewModels;
            var reservationsservices   = new ReservationsServices();

            viewModel.IsBusy  = true;
            viewModel.Keyword = SearchBar.Text;
            if (viewModel.Keyword != "")
            {
                viewModel.ReservationsList = await reservationsservices.GetReservationsByKeywordAsync(viewModel.Keyword);
            }
            else
            {
                // ReservaitionsList.ItemsSource = viewModel.ReservationsList;
                viewModel.ReservationsList = await reservationsservices.GetReservationsAsync();
            }
            viewModel.IsBusy = false;
        }