コード例 #1
0
        public ChangePasswordView()
        {
            InitializeComponent();

            Loaded += (sender, args) =>
            {
                Telegram.Api.Helpers.Execute.BeginOnUIThread(() => PasscodeBox.Focus());
            };
        }
コード例 #2
0
        public EnterPasscodeView()
        {
            InitializeComponent();

            _doneButton.Click   += (sender, args) => ViewModel.Done();
            _cancelButton.Click += (sender, args) => ViewModel.Cancel();

            Loaded += (sender, args) =>
            {
                Telegram.Api.Helpers.Execute.BeginOnUIThread(() => PasscodeBox.Focus());
            };

            BuildLocalizedAppBar();
        }
コード例 #3
0
 private void Passcode_OnKeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         ConfirmOrCompletePasscode();
     }
     else if (e.Key == Key.Back)
     {
         if (ConfirmPasscodeBox.IsFocused &&
             ConfirmPasscodeBox.Length == 0)
         {
             PasscodeBox.Focus();
         }
     }
 }
コード例 #4
0
        private void Passcode_OnKeyDown(object sender, KeyEventArgs e)
        {
            if (ViewModel.SelectedPasscodeType != null)
            {
                if (ViewModel.SelectedPasscodeType.Type == PasscodeType.Pin)
                {
                    if (e.Key >= Key.D0 && e.Key <= Key.D9 || e.Key == Key.Back || e.Key == Key.Enter)
                    {
                        if (e.Key >= Key.D0 && e.Key <= Key.D9)
                        {
                            if (PasscodeBox.IsFocused &&
                                PasscodeBox.Length == 4 &&
                                ConfirmPasscodeBox.Length < 4)
                            {
                                ConfirmPasscodeBox.Focus();
                            }
                        }
                    }
                    else
                    {
                        e.Handled = true;
                        return;
                    }
                }

                if (e.Key == Key.Enter)
                {
                    ConfirmOrCompletePasscode();
                }
                else if (e.Key == Key.Back)
                {
                    if (ConfirmPasscodeBox.IsFocused &&
                        ConfirmPasscodeBox.Length == 0)
                    {
                        PasscodeBox.Focus();
                    }
                }
            }
        }
コード例 #5
0
        public EnterPasswordView()
        {
            InitializeComponent();

            Loaded += (sender, args) => PasscodeBox.Focus();
        }