private async void OnLogOut(object sender, EventArgs e)
        {
            await session.DeleteSession(EmailAddress);

            LoginFragment login = new LoginFragment();

            FragmentManager.PopBackStack();
            FragmentManager.BeginTransaction().Replace(Resource.Id.parent_fragment, login).Commit();
            alertWindow.Alert("", "Logout successful!", Activity);
        }
Exemplo n.º 2
0
        public async void UserToAdd <T, U>(T userType, U login, string email, string token)
        {
            //Adding user to firebase child by it's token value
            await firebaseHelper.AddToFirebase(userType, token);

            await firebaseHelper.AddToFirebase(login, "Login");

            alertWindow.Alert("Message", "Successful registration", Activity);
            Android.Support.V4.App.Fragment loginFragment = new LoginFragment();
            FragmentManager.BeginTransaction().Replace(Resource.Id.parent_fragment, loginFragment).Commit();
        }
        public async void DeleteAccount()
        {
            //TODO: Change popup
            switch (Token)
            {
            case "Admin":
                await firebaseHelper.DeleteAccount <Admin>("Admins", EmailAddress);

                break;

            case "Teacher":
                await firebaseHelper.DeleteAccount <Teacher>("Teachers", EmailAddress);

                break;

            case "UniversityStudent":
                await firebaseHelper.DeleteAccount <UniversityStudent>("UniversityStudents", EmailAddress);

                break;

            case "SchoolStudent":
                await firebaseHelper.DeleteAccount <SchoolStudent>("SchoolStudents", EmailAddress);

                break;

            case "User":
                await firebaseHelper.DeleteAccount <User>("Users", EmailAddress);

                break;
            }
            await session.DeleteSession(EmailAddress);

            await firebaseHelper.DeleteAccount <Login>("Login", EmailAddress);

            alertWindow.Alert("", "Account deleted!", Activity);
            Android.Support.V4.App.Fragment loginFragment = new LoginFragment();
            FragmentManager.BeginTransaction().Replace(Resource.Id.parent_fragment, loginFragment).Commit();
        }