Esempio n. 1
0
        public ProfilePage(User user)
        {
            InitializeComponent();
            _user          = user;
            BindingContext = viewModel = new ProfilePageViewModel(_user);
            ChangePhonePopup.Body.BindingContext = viewModel;
            Init();

            ChangePasswordPopup.BackgroundColor = Color.FromRgba(0, 0, 0, 0.3);
            ChangeEmailPopup.BackgroundColor    = Color.FromRgba(0, 0, 0, 0.3);
            ChangePhonePopup.BackgroundColor    = Color.FromRgba(0, 0, 0, 0.3);
            OtpPopup.BackgroundColor            = Color.FromRgba(0, 0, 0, 0.3);

            MessagingCenter.Subscribe <ProfilePageViewModel, bool>(this, "OtpPopup", async(sender, arg) =>
            {
                OtpPopup.IsVisible = arg;
                entryOTP1.Focus();
                progressBar.Progress = 1;
                spReset.TextColor    = Color.Gray;
                Device.StartTimer(TimeSpan.FromMilliseconds(updateRate), () =>
                {
                    if (progressBar.Progress > 0)
                    {
                        Device.BeginInvokeOnMainThread(() => progressBar.Progress -= step);
                        return(true);
                    }
                    lblResetOtp.IsEnabled = true;
                    spReset.TextColor     = Color.FromHex("0089D1");
                    return(false);
                });
            });

            MessagingCenter.Subscribe <ProfilePageViewModel, User>(this, "UpdateProfile", async(sender, arg) =>
            {
                viewModel.User = arg;
                image.Source   = arg.AvatarFullUrl;
            });

            MessagingCenter.Subscribe <ProfilePageViewModel, bool>(this, "ClosePopup", async(sender, arg) =>
            {
                ChangePasswordPopup.IsVisible = ChangePhonePopup.IsVisible = ChangeEmailPopup.IsVisible = arg;
            });

            ChangePasswordPopup.CustomCloseButton(OnCloseChangePassword);
            ChangeEmailPopup.CustomCloseButton(OnCloseChangeEmail);
            ChangePhonePopup.CustomCloseButton(OnCloseChangePhone);
        }
Esempio n. 2
0
        private async void OnCloseChangePhone(object sender, EventArgs e)
        {
            await ChangePhonePopup.Hide();

            entryPhone.Text = null;
        }
Esempio n. 3
0
 //edit phone
 private async void OnEditPhoneClicked(object sender, EventArgs e)
 {
     await ChangePhonePopup.Show();
 }