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;
        }
예제 #3
0
 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();
     }
 }
예제 #4
0
 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();
     }
 }
예제 #6
0
    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();
    }
예제 #7
0
        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);
        }
예제 #8
0
 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();
     }
 }
예제 #9
0
 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();
     }
 }
예제 #10
0
        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;
        }
예제 #11
0
        private void ClickButton(Button target)
        {
            ButtonAutomationPeer peer       = new ButtonAutomationPeer(target);
            IInvokeProvider      invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider;

            if (invokeProv != null)
            {
                invokeProv.Invoke();
            }
        }
예제 #12
0
        /// <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();
        }
예제 #13
0
        /// <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();
            }
        }
예제 #14
0
 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();
     }
 }
예제 #15
0
 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();
     }
 }
예제 #16
0
 /// <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();
     }));
 }
예제 #19
0
 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;
 }
예제 #20
0
        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();
        }
예제 #21
0
        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;
                }
            }
        }
예제 #22
0
        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();
        }
예제 #26
0
        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();
            }
        }
예제 #27
0
        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();
        }
예제 #28
0
 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();
     }
 }
예제 #29
0
        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;
            }
        }
예제 #30
0
        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();
            }
        }