private void SubjectTextBoxNewThread_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) { if (e.Key == Key.Enter) { CaptchaTextBox.Focus(); } }
private void CaptchaFocused(object sender, EventArgs e) { Focus(); // We have to dispatch to fix a SIP scrollviewer glitch Deployment.Current.Dispatcher.BeginInvoke(() => { CaptchaTextBox.Focus(); }); }
/// <summary> /// This function ensures the captcha box is correctly scrolled when it gets focus, /// since sometimes it can be off the screen. /// </summary> private void CaptchaTextBox_GotFocus(object sender, RoutedEventArgs e) { if (_isFixingCaptchaFocus) { return; } Focus(); _isFixingCaptchaFocus = true; Deployment.Current.Dispatcher.BeginInvoke(() => { CaptchaTextBox.Focus(); Deployment.Current.Dispatcher.BeginInvoke(() => { _isFixingCaptchaFocus = false; }); }); }
private void ElementFocused(object sender, NewThreadPageViewModel.NewThreadFocusResult e) { switch (e) { case NewThreadPageViewModel.NewThreadFocusResult.Captcha: Focus(); Deployment.Current.Dispatcher.BeginInvoke(() => { CaptchaTextBox.Focus(); }); break; case NewThreadPageViewModel.NewThreadFocusResult.Comment: CommentBox.Focus(); break; case NewThreadPageViewModel.NewThreadFocusResult.Page: Focus(); break; default: break; } }
private void CaptchaRequestView_OnLoaded(object sender, RoutedEventArgs e) { CaptchaTextBox.Focus(); }
private void InitializeApplicationBar() { _refresh = new ApplicationBarIconButton(new Uri("Assets/Appbar/appbar.refresh.png", UriKind.Relative)) { Text = AppResources.ApplicationBar_Refresh }; _refresh.Click += async(sender, e) => await _viewModel.Update(); _watch = new ApplicationBarIconButton(new Uri("Assets/Appbar/appbar.eye.png", UriKind.Relative)) { Text = AppResources.ApplicationBar_Watch }; _watch.Click += (sender, e) => { _viewModel.ToggleWatchlisted(); UpdateWatchButton(); }; _reply = new ApplicationBarIconButton(new Uri("Assets/Appbar/appbar.reply.png", UriKind.Relative)) { Text = AppResources.ApplicationBar_Reply }; _reply.Click += (sender, e) => _viewModel.OpenReplyRegion(); _send = new ApplicationBarIconButton(new Uri("Assets/Appbar/appbar.send.png", UriKind.Relative)) { Text = AppResources.ApplicationBar_Send }; _send.Click += async(sender, e) => { _send.IsEnabled = false; Focus(); ReplyPageViewModelBase.SubmitResultType result = await _viewModel.Submit(); _send.IsEnabled = true; switch (result) { case ReplyPageViewModelBase.SubmitResultType.Success: ScrollToBottom(); break; case ReplyPageViewModelBase.SubmitResultType.EmptyCaptchaError: case ReplyPageViewModelBase.SubmitResultType.WrongCatpchaError: Focus(); Deployment.Current.Dispatcher.BeginInvoke(() => { CaptchaTextBox.Focus(); }); break; case ReplyPageViewModelBase.SubmitResultType.EmptyCommentError: CommentBox.Focus(); break; case ReplyPageViewModelBase.SubmitResultType.KnownError: case ReplyPageViewModelBase.SubmitResultType.NoImageError: case ReplyPageViewModelBase.SubmitResultType.UnknownError: break; } }; _edit = new ApplicationBarIconButton(new Uri("Assets/Appbar/appbar.edit.png", UriKind.Relative)) { Text = AppResources.ApplicationBar_Edit }; _edit.Click += (sender, e) => _viewModel.EditReply(); ApplicationBarMenuItem bottom = new ApplicationBarMenuItem(AppResources.ApplicationBar_ScrollToBottom); bottom.Click += (sender, e) => ScrollToBottom(); ApplicationBar = new ApplicationBar(); if (CriticalSettingsManager.Current.EnableManualRefresh) { ApplicationBar.Buttons.Add(_refresh); } ApplicationBar.Buttons.Add(_reply); ApplicationBar.Buttons.Add(_watch); ApplicationBar.MenuItems.Add(bottom); ApplicationBar.MenuItems.Add(_orientLock); }
private void OnLoginNavigate(object sender, RequestNavigateEventArgs e) { CaptchaTextBox.Focus(); Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri)); e.Handled = true; }