Пример #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);
        }