private void txbValorGeneral_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { ButtonAutomationPeer peer = new ButtonAutomationPeer(btnAceptar); IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; invokeProv.Invoke(); } }
private void Button071_Click(object sender, RoutedEventArgs e) { counterClickB01++; ButtonAutomationPeer bap = new ButtonAutomationPeer(button072); IInvokeProvider iip = bap.GetPattern(PatternInterface.Invoke) as IInvokeProvider; iip.Invoke(); // To powoduje kliknięcie przycisku label070.Content = "Kliknięcia lewego, a następnie uruchomienie prawego - " + counterClickB01; }
private void ImportWindow_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { var peer = new ButtonAutomationPeer(OkButton); var invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; invokeProv?.Invoke(); } }
private void Background_Tapped(object sender, TappedRoutedEventArgs e) { if (_backgroundTapInvokesCancel && !_keyboardVisible) { ButtonAutomationPeer peer = new ButtonAutomationPeer(CancelButton); IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; invokeProv.Invoke(); } }
private void SearchBox_KeyDown(object sender, KeyEventArgs e) { if (e.Key.Equals(Key.Enter)) { var auto = new ButtonAutomationPeer(SearchButton); var invokeProvider = auto.GetPattern(PatternInterface.Invoke) as IInvokeProvider; invokeProvider.Invoke(); } }
public void ClickTemplateButton() { base.ApplyTemplate(); Button btn = (GetTemplateChild("DateTimeButton") as Button); ButtonAutomationPeer peer = new ButtonAutomationPeer(btn); IInvokeProvider provider = (peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider); provider.Invoke(); }
private bool performAction(int bestAction, List <Button> buttonList) { ButtonAutomationPeer peer = new ButtonAutomationPeer(buttonList[bestAction]); IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; invokeProv.Invoke(); return(true); }
private void Pwd_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { ButtonAutomationPeer bam = new ButtonAutomationPeer(LoginBtn); IInvokeProvider iip = bam.GetPattern(PatternInterface.Invoke) as IInvokeProvider; iip.Invoke(); } }
private void textBox_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) { if (e.Key == System.Windows.Input.Key.Enter) { ButtonAutomationPeer peer = new ButtonAutomationPeer(button1); IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; invokeProv.Invoke(); } }
private void Options_Button_Click(object sender, RoutedEventArgs e) { //if options button is clicked, automatically closes authors window ButtonAutomationPeer peerSent = new ButtonAutomationPeer(AuthorsClose_Button); IInvokeProvider invokeProvSent = peerSent.GetPattern(PatternInterface.Invoke) as IInvokeProvider; invokeProvSent.Invoke(); OptionsBorder.Visibility = Visibility.Visible; }
private void ClickButton(Button target) { ButtonAutomationPeer peer = new ButtonAutomationPeer(target); IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; if (invokeProv != null) { invokeProv.Invoke(); } }
/// <summary> /// handle the double click in the list /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ListBoxItem_MouseDoubleClick(object sender, MouseButtonEventArgs e) { ButtonAutomationPeer peer = new ButtonAutomationPeer(btOpen); IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; invokeProv.Invoke(); }
/// <summary> /// 扩展方法:实现WPF中Button类的PerformClick功能 /// </summary> /// <param name="button">Button实例</param> /// <remarks> /// 需要添加对UIAutomationProvider.dll的引用 /// 参考网址:http://www.cnblogs.com/zhouyinhui/archive/2010/05/20/1740111.html /// </remarks> public static void PerformClick(this Button button) { ButtonAutomationPeer BAP = new ButtonAutomationPeer(button); IInvokeProvider IIP = BAP.GetPattern(PatternInterface.Invoke) as IInvokeProvider; if (IIP != null) { IIP.Invoke(); } }
private void passwordTextBox_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { //virtual click on login button ButtonAutomationPeer peer = new ButtonAutomationPeer(login); IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; invokeProv.Invoke(); } }
private void Window_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { if (this.grdMenu.Width > 100) { //https://joshsmithonwpf.wordpress.com/2007/03/09/how-to-programmatically-click-a-button/ ButtonAutomationPeer peer = new ButtonAutomationPeer(this.btnCloseMenu); IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; invokeProv.Invoke(); } }
/// <summary> /// Add shortcut for agent form to enter /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void login_prev_key_up(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { ButtonAutomationPeer peer = new ButtonAutomationPeer(login_btn); IInvokeProvider login_pattern = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; login_pattern.Invoke(); //connector_to_my_SQLBase(); } }
public static void ExecuteClick(this Button button) { var peer = new ButtonAutomationPeer(button); var invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; if (invokeProv != null) { invokeProv.Invoke(); } }
Task PerformClick(IButton button) { return(InvokeOnMainThreadAsync(() => { var platformButton = GetNativeButton(CreateHandler(button)); var ap = new ButtonAutomationPeer(platformButton); var ip = ap.GetPattern(PatternInterface.Invoke) as IInvokeProvider; ip?.Invoke(); })); }
private void SearchText_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Return && !logic.skip_enter) { ButtonAutomationPeer peer = new ButtonAutomationPeer(SearchButton); IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; invokeProv.Invoke(); } logic.skip_enter = false; }
public MainWindow() { InitializeComponent(); buttons = new List <Button>() { mm9Button, acp45Button, mm10Button, ae50Button, mag357Button, mag44Button, mag500Button, mm556Button, grendelButton, mm762Button, blackoutButton, winmagButton, lapmagButton, bmgButton, leadButton, steelButton, slugButton, dragonButton, birdshotButton }; blocks = new List <TextBlock>() { prcShort, prcMedium, prcLong, apShort, apMedium, apLong, dmgShort, dmgMedium, dmgLong }; blocks2 = new List <TextBlock>() { prcShort2, prcMedium2, prcLong2, apShort2, apMedium2, apLong2, dmgShort2, dmgMedium2, dmgLong2, numShort2, numMedium2, numLong2 }; stats = new List <List <int> >() { MM9.stats, ACP45.stats, MM10.stats, AE50.stats, MAG357.stats, MAG44.stats, MAG500.stats, MM556.stats, GRENDEL.stats, MM762.stats, BLACKOUT.stats, WINMAG.stats, LAPMAG.stats, BMG.stats, GAUGE12LEAD.stats, GAUGE12STEEL.stats, GAUGE12SLUG.stats, GAUGE12DRAGON.stats, GAUGE12BIRDSHOT.stats }; brush = new SolidColorBrush(Color.FromRgb(221, 221, 221)); CheckShort.IsChecked = true; CheckShort2.IsChecked = true; ButtonAutomationPeer peer = new ButtonAutomationPeer(mm9Button); ButtonAutomationPeer peer2 = new ButtonAutomationPeer(leadButton); IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; IInvokeProvider invokeProv2 = peer2.GetPattern(PatternInterface.Invoke) as IInvokeProvider; invokeProv2.Invoke(); invokeProv.Invoke(); }
private void SearchBox_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Tab) { e.Handled = true; SearchHelper helper = (SearchHelper)keywordHelper.SelectedItem; if (helper != null) { if (ignoreSearch != " ") { if (ignoreSearch == "/") { SearchBox.Text = $"{ignoreSearch}{helper.Helper}"; ignoreSearch = $"{ignoreSearch}{helper.Helper}"; } else { SearchBox.Text = $"{ignoreSearch} {helper.Helper}"; ignoreSearch = $"{ignoreSearch} {helper.Helper}"; } } else { SearchBox.Text = helper.Helper; ignoreSearch = $"{helper.Helper}"; } SearchBox.CaretIndex = SearchBox.Text.Length; } searchBoxSelectedIndex = 0; } if (e.Key == Key.Return) { e.Handled = true; ButtonAutomationPeer peer = new ButtonAutomationPeer(SearchBtn); IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; invokeProv.Invoke(); } if (e.Key == Key.Down) { if (searchBoxSelectedIndex != keywordHelper.Items.Count - 1) { searchBoxSelectedIndex++; keywordHelper.SelectedIndex = searchBoxSelectedIndex; } } if (e.Key == Key.Up) { if (searchBoxSelectedIndex > -1) { searchBoxSelectedIndex--; keywordHelper.SelectedIndex = searchBoxSelectedIndex; } } }
private void DealPromptCard_Click(object sender, RoutedEventArgs e) { var promptWindow = new PromptCard(this.cardDatabase); promptWindow.Show(); ButtonAutomationPeer peer = new ButtonAutomationPeer(promptWindow.btnNewCard); IInvokeProvider provider = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; provider.Invoke(); }
private void ExecCommandTextBox_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { ButtonAutomationPeer peer = new ButtonAutomationPeer(ExecCommandButton); IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; invokeProv.Invoke(); FocusManager.SetFocusedElement(this, ExecCommandTextBox); Keyboard.Focus(ExecCommandTextBox); } }
private void DoubleAnimation_Completed(object sender, EventArgs e) { //TypewriteTextblock("CARE Social Media Analyzer", productName, new TimeSpan(15000)); //TypeText("CARE Social Media Analyzer"); ButtonAutomationPeer peer = new ButtonAutomationPeer(myButton); IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; invokeProv.Invoke(); }//func...
private static void SimulateButtonClick(Button button) { if (button == null) { return; } ButtonAutomationPeer peer = new ButtonAutomationPeer(button); IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; invokeProv.Invoke(); }
private void SearchTextBox_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) { if (e.Key == Key.Enter) { SearchButton.Focus(); ButtonAutomationPeer automation = new ButtonAutomationPeer(this.SearchButton); IInvokeProvider invokeProv = automation.GetPattern(PatternInterface.Invoke) as IInvokeProvider; invokeProv.Invoke(); } }
public void TestRemoveFilterText1() { _control.FilterText = null; var peer = new ButtonAutomationPeer(_control.RemoveFilterTextButton); var invokeProv = (IInvokeProvider)peer.GetPattern(PatternInterface.Invoke); invokeProv.Invoke(); _control.FilterText.Should().BeNull(); }
private void edInput_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { ButtonAutomationPeer peer = new ButtonAutomationPeer(btEnterCommand); IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; invokeProv.Invoke(); } }
private void System_BackRequested(object sender, BackRequestedEventArgs e) { if (!e.Handled && BackButton.IsEnabled) { var buttonPeer = new ButtonAutomationPeer(BackButton); IInvokeProvider invokeProvider = buttonPeer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; invokeProvider.Invoke(); e.Handled = true; } }
private void NoButtonClick(List <Button> buttons) { foreach (Button button in buttons) { ButtonAutomationPeer peer = new ButtonAutomationPeer(button); IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; invokeProv.Invoke(); } }