コード例 #1
0
 public LoginPage()
 {
     InitializeComponent();
     auth           = DependencyService.Get <IFirebaseAuthentication>();
     BindingContext = new User();
     userRepository = new UserRepository();
 }
コード例 #2
0
 public ProfileTabPage()
 {
     InitializeComponent();
     userRepository         = new UserRepository();
     firebaseStorageService = new FirebaseStorageService();
     auth       = DependencyService.Get <IFirebaseAuthentication>();
     Appearing += OnAppearing;
 }
コード例 #3
0
        public App()
        {
            InitializeComponent();

            userRepository = new UserRepository();
            auth           = DependencyService.Get <IFirebaseAuthentication>();
            MainPage       = new LoadingPage();
        }
コード例 #4
0
 public LogInPage()
 {
     InitializeComponent();
     BindingContext             = viewModel = new LoginViewModel();
     auth                       = DependencyService.Get <IFirebaseAuthentication>();
     this.BackgroundImage       = "background.png";
     loginStack.BackgroundColor = System.Drawing.Color.FromArgb(140, 0, 0, 0);
     showPass.Toggled          += (sender, e) =>
     {
         _ = e.Value ? PassEntry.IsPassword = false : PassEntry.IsPassword = true;
     };
 }
コード例 #5
0
        public LoginPageViewModel(INavigationService navigationService, IPageDialogService pageDialogService)
        {
            _navigationService = navigationService;
            _pageDialogService = pageDialogService;

            _firebaseAuth = DependencyService.Get<IFirebaseAuthentication>();

            if (!string.IsNullOrEmpty(Settings.UserEmail))
            {
                Email = Settings.UserEmail;
            }
            
        }
コード例 #6
0
        public App()
        {
            InitializeComponent();

            auth = DependencyService.Get <IFirebaseAuthentication>();
            if (auth.IsSignIn())
            {
                MainPage = new MainPage();
            }
            else
            {
                MainPage = new LoginPage();
            }
        }
コード例 #7
0
        private async void OnLoginButtonClicked(object sender, EventArgs e)
        {
            IsBusy = true;

            _email    = this.FindByName <Entry>("email").Text;
            _password = this.FindByName <Entry>("password").Text;

            if (String.IsNullOrWhiteSpace(_email))
            {
                await Application.Current.MainPage.DisplayAlert("Błąd walidacji", "Pole z adresem email nie może być puste", "OK");

                return;
            }

            if (String.IsNullOrWhiteSpace(_password))
            {
                await Application.Current.MainPage.DisplayAlert("Błąd walidacji", "Pole z hasłem nie może być puste", "OK");

                return;
            }

            try
            {
                IFirebaseAuthentication auth = DependencyService.Get <IFirebaseAuthentication>();
                string token = await auth.Login(_email, _password);

                await Application.Current.MainPage.DisplayAlert("Sukces logowania", $"Adres email: {_email}\nHasło: {_password}", "Noice");

                _isLoggedIn = auth.IsUserLoggedIn();
                if (_isLoggedIn)
                {
                    this.FindByName <Button>("logoutButton").IsVisible = true;
                }
            } catch (Exception ex)
            {
                await Application.Current.MainPage.DisplayAlert("Błąd logowania", $"Wystąpił problem podczas logowania: {ex.Message}", "OK");
            }

            ChangeButtonVisibility();

            IsBusy = false;
        }
コード例 #8
0
        private void OnLogoutButtonClicked(object sender, EventArgs e)
        {
            IsBusy = true;

            try
            {
                IFirebaseAuthentication auth = DependencyService.Get <IFirebaseAuthentication>();
                auth.Logout();
                _isLoggedIn = false;
                this.FindByName <Entry>("email").Text    = "";
                this.FindByName <Entry>("password").Text = "";
                _email = _password = "";
            } catch (Exception ex)
            {
                Application.Current.MainPage.DisplayAlert("Błąd wylogowania", $"Wystąpił problem podczas wylogowania: {ex.Message}", "OK");
            }

            ChangeButtonVisibility();

            IsBusy = false;
        }
コード例 #9
0
 public LoginPage()
 {
     InitializeComponent();
     auth           = DependencyService.Get <IFirebaseAuthentication>();
     BindingContext = viewModel = new LoginViewModel();
 }
コード例 #10
0
 public MainPage()
 {
     InitializeComponent();
     auth = DependencyService.Get <IFirebaseAuthentication>();
 }
コード例 #11
0
 public Register()
 {
     InitializeComponent();
     auth = DependencyService.Get <IFirebaseAuthentication>();
 }
コード例 #12
0
        public LoginViewModel()
        {
            authentication = DependencyService.Get <IFirebaseAuthentication>();

            SubmitCommand = new Command(OnSubmit);
        }