Ejemplo n.º 1
0
        private async Task Validate()
        {
            if (this.hasPackage)
            {
#if __ANDROID__
                if (!string.IsNullOrWhiteSpace(androidNameEntry.Text) || !string.IsNullOrWhiteSpace(androidEmailAddressEntry.Text) || !string.IsNullOrWhiteSpace(androidPassWordEntry.Text) ||
                    !string.IsNullOrWhiteSpace(androidSecretQuestionEntry.Text))
#endif
#if __IOS__
                if (!string.IsNullOrWhiteSpace(nameEntry.Text) || !string.IsNullOrWhiteSpace(emailAddressEntry.Text) || !string.IsNullOrWhiteSpace(passWordEntry.Text) ||
                    !string.IsNullOrWhiteSpace(secretQuestionEntry.Text))
#endif
                {
                    CreateUser();
                    await Navigation.PushModalAsync(new SummaryPage(user));
                }
                else
                {
                    await DisplayAlert("Sign Up Error", "Make sure all fields are filled in!", "Okay, got it.");
                }
            }
            else
            {
                _account = _baseViewModel.GetAccountInformation();
                if (_account.Properties["Package"] == "Gi")
                {
                    this.package = Package.Gi;
                }
                else if (_account.Properties["Package"] == "NoGi")
                {
                    this.package = Package.NoGi;
                }
                else
                {
                    this.package = Package.GiAndNoGi;
                }

#if __ANDROID__
                if (androidNameEntry.Text != null || androidEmailAddressEntry.Text != null || androidPassWordEntry.Text != null ||
                    androidSecretQuestionEntry.Text != null)
#endif
#if __IOS__
                if (nameEntry.Text != null || emailAddressEntry.Text != null || passWordEntry.Text != null ||
                    secretQuestionEntry.Text != null)
#endif
                {
                    CreateUser();
                    await _summaryPageViewModel.CreateUser(user);

                    _baseViewModel.DeleteCredentials();
                    _baseViewModel.SaveCredentials(_summaryPageViewModel.User);
                    Application.Current.MainPage = new MainTabbedPage(true);
                }
                else
                {
                    await DisplayAlert("Sign Up Error", "Make sure all fields are filled in!", "Okay, got it.");
                }
            }
        }
Ejemplo n.º 2
0
        private void LogOut()
        {
            _baseViewModel.DeleteCredentials();
            var entryPage = new NavigationPage(new EntryPage());

            NavigationPage.SetHasNavigationBar(entryPage.CurrentPage, false);
            Application.Current.MainPage = entryPage;
        }