Esempio n. 1
0
        public async Task refreshApartment()
        {
            //public static ApartmentObject findApartment(List<ApartmentObject> apt, int apartmentID)        //finds the apartment specified
            List <ApartmentObject> l = await(ServerHandeler.getApartments());

            currentApartment = PrevApartmentPage.findApartment(l, CurrentUser.ApartmentID);
        }
Esempio n. 2
0
        async void OnSubmit(object sender, EventArgs e)                 //when submit button is pressed
        {
            int apartmentID = int.Parse(apartment.Text);
            List <ApartmentObject> aptLs  = await(ServerHandeler.getApartments()); //gets the apartment with the associated userid
            ApartmentObject        aptObj = findApartment(aptLs, apartmentID);

            if (aptObj != null)                                                      //if apartmentid is not null
            {
                await ServerHandeler.addUserToApartment(_gd.CurrentUser.UserID, apartmentID);

                _gd.CurrentApartment         = aptObj;
                Application.Current.MainPage = new NavigationPage(new groupProject01.HomePage(_gd));                            //direct to home page
            }
            else                                                                                                                //if apartmentid is null
            {
                await DisplayAlert("Invalid Apartment ID", "The apartment ID you input is not valid. Please try again.", "OK"); //shows error message
            }
        }