Ejemplo n.º 1
0
        private void InputNumbers()
        {
            using (var automation = new UIA2Automation())
            {
                var window       = app.GetMainWindow(automation);
                var submitButton = window.FindFirstDescendant(cf => cf.ByName("Ввод")).AsButton();
                var textBox      = window.FindFirstDescendant(cf => cf.ByControlType(FlaUI.Core.Definitions.ControlType.Edit)).AsTextBox();

                foreach (int number in testData)
                {
                    textBox.Text = number.ToString();
                    Thread.Sleep(50);
                    submitButton.Invoke();
                }
            }
        }
Ejemplo n.º 2
0
        public void AutoClickStart()
        {
            try
            {
                Application app = FlaUI.Core.Application.Attach(Process.GetProcessById(RemotePlayProcess.Id));

                using (var automation = new UIA2Automation())
                {
                    while (true)
                    {
                        Window window  = app.GetMainWindow(automation);
                        Button button1 = window.FindFirstDescendant(cf => cf.ByText("Start"))?.AsButton();
                        if (button1 == null)
                        {
                            Thread.Sleep(1000);
                        }

                        else
                        {
                            button1?.Invoke();
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Logger.Error("Problem with auto-clicker: " + ex.Message);
            }
        }
Ejemplo n.º 3
0
        public void StartThis(string appName, string appPath)
        {
            var     aUI3 = new UIA3Automation();
            Process apps = Process.Start(appPath);

            System.Threading.Thread.Sleep(30000);
            Process[] SC = Process.GetProcesses();

            foreach (Process proc in SC)
            {
                System.Diagnostics.Debug.Write(" proc :: " + proc.ProcessName.ToLower() + " " + appName.ToLower() + "\n");
                if (proc.ProcessName.ToLower().Contains(appName.ToLower()))
                {
                    appProcess = proc;

                    break;
                }
            }
            app       = FlaUI.Core.Application.Attach(appProcess);
            appWindow = app.GetMainWindow(aUI3, TimeSpan.FromMilliseconds(5000));

            System.Diagnostics.Debug.Write(" WIDTH " + appWindow.Properties.BoundingRectangle.Value.Width);
            this.WIDTH  = appWindow.Properties.BoundingRectangle.Value.Width;
            this.HEIGHT = appWindow.Properties.BoundingRectangle.Value.Height;
        }
Ejemplo n.º 4
0
        public void Setup()
        {
            app        = FlaUI.Core.Application.Launch("SalesTax.exe");
            Automation = new UIA3Automation();
            window     = app.GetMainWindow(Automation);

            txtAmount       = window.FindFirstDescendant(cf => cf.ByAutomationId("txtAmount"))?.AsTextBox();
            chkCountyTax    = window.FindFirstDescendant(cf => cf.ByAutomationId("chkCountyTax"))?.AsCheckBox();
            btnCalculate    = window.FindFirstDescendant(cf => cf.ByAutomationId("btnCalculate"))?.AsButton();
            lstTotal        = window.FindFirstDescendant(cf => cf.ByAutomationId("lstTotal"))?.AsListBox();
            lstInitialItems = lstTotal.Items;
        }
Ejemplo n.º 5
0
        private void RegisterEvents()
        {
            _automation.UnregisterAllEvents();
            var mainWindow = _app.GetMainWindow(_automation);
            //mainWindow.RegisterEvent(InvokePattern.InvokedEvent, TreeScope.Descendants, InvokeAction);
            //mainWindow.RegisterEvent(SelectionItemPattern.ElementSelectedEvent, TreeScope.Descendants, SelectionAction);
            //mainWindow.RegisterEvent(TextPattern.TextChangedEvent, TreeScope.Descendants, TextChangedAction);
            //mainWindow.RegisterStructureChangedEvent(TreeScope.Descendants, StructureAction);
            //mainWindow.RegisterPropertyChangedEvent(TreeScope.Descendants, PropertyAction, TogglePattern.ToggleStateProperty);
            //mainWindow.RegisterPropertyChangedEvent(TreeScope.Descendants, PropertyAction, ValuePattern.ValueProperty);

            // Legacy
            //mainWindow.GetUIA2().RegisterPropertyChangedEvent(TreeScope.Descendants, PropertyAction, TogglePattern.ToggleStateProperty);
        }