Ejemplo n.º 1
0
 ///<summary>Inserts one Automation into the database.  Returns the new priKey.</summary>
 internal static long Insert(Automation automation)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         automation.AutomationNum=DbHelper.GetNextOracleKey("automation","AutomationNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(automation,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     automation.AutomationNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(automation,false);
     }
 }
Ejemplo n.º 2
0
 ///<summary>Inserts one Automation into the database.  Provides option to use the existing priKey.</summary>
 internal static long Insert(Automation automation,bool useExistingPK)
 {
     if(!useExistingPK && PrefC.RandomKeys) {
         automation.AutomationNum=ReplicationServers.GetKey("automation","AutomationNum");
     }
     string command="INSERT INTO automation (";
     if(useExistingPK || PrefC.RandomKeys) {
         command+="AutomationNum,";
     }
     command+="Description,Autotrigger,ProcCodes,AutoAction,SheetDefNum,CommType,MessageContent) VALUES(";
     if(useExistingPK || PrefC.RandomKeys) {
         command+=POut.Long(automation.AutomationNum)+",";
     }
     command+=
          "'"+POut.String(automation.Description)+"',"
         +    POut.Int   ((int)automation.Autotrigger)+","
         +"'"+POut.String(automation.ProcCodes)+"',"
         +    POut.Int   ((int)automation.AutoAction)+","
         +    POut.Long  (automation.SheetDefNum)+","
         +    POut.Long  (automation.CommType)+","
         +"'"+POut.String(automation.MessageContent)+"')";
     if(useExistingPK || PrefC.RandomKeys) {
         Db.NonQ(command);
     }
     else {
         automation.AutomationNum=Db.NonQ(command,true);
     }
     return automation.AutomationNum;
 }
Ejemplo n.º 3
0
 public static void CopyTo(Automation src, Automation dst)
 {
     dst.IsLinear = src.IsLinear;
     dst.RatioPosition = src.RatioPosition;
     dst.Text = src.Text;
     dst.Type = src.Type;
     dst.Value = src.Value;
 }
 public GraphicPanelController( Parameters parameters,Automation.BDaq.InstantAiCtrl instantAiCtrl )
 {
     //Initialize the basic elements
     this.parameters = parameters;
     instantAiCtrl1 = instantAiCtrl;
     defineTimer();
     prepareScope();
 }
Ejemplo n.º 5
0
        /// <summary>
        /// construct an ActionManager with an Automation engine
        /// </summary>
        /// <param name="automation">the Automation engine</param>
        public UIAActionManager(Automation automation)
            : base(automation)
        {
            RegisterAction(new ActionClick());
            RegisterAction(new ActionStartProgram());
            RegisterAction(new ActionCloseWindow());

            WaitTime = new TimeSpan(0, 0, 30);
        }
Ejemplo n.º 6
0
        public static Automation BuildTempoAutomation(bool isLinear, float ratioPosition, float value, int reference)
        {
            if (reference < 1 || reference > 5) reference = 2;

            var references = new[] {1f, 0.5f, 1.0f, 1.5f, 2.0f, 3.0f};
            var automation = new Automation();
            automation.Type = AutomationType.Tempo;
            automation.IsLinear = isLinear;
            automation.RatioPosition = ratioPosition;
            automation.Value = value*references[reference];
            return automation;
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            //Zipper z = new Zipper("D:\\c#\\7za920\\7za.exe");

            //z.compress("-t7z", "D:\\c#\\readme", "D:\\c#\\readme.txt");

            Automation aut = new Automation();
            aut.CreateFileTCs();
            aut.CreateFolderTCs();

            //var tc = TCSerializer.Deserialize(@".\TestCase.xml");
        }
        public static void CreateAutomation(SoapClient soapClient,
            string iEmailSendDefinitionName,
            string iEmailSendDefinitionCustomerKey,
            string iEmailSendDefinitionObjectID)
        {
            Automation automation = new Automation();
            automation.Name = "SOAPAPI Test2_" + Guid.NewGuid().ToString();
            // CustomerKey can be any string value, GUID is only used for example purposes
            automation.CustomerKey = Guid.NewGuid().ToString();
            automation.Description = "SOAP API Created Example";
            automation.AutomationType = "scheduled";

            AutomationActivity activityOne = new AutomationActivity();
            activityOne = new AutomationActivity();
            // This is the ObjectID of the Definition Object
            activityOne.ObjectID = iEmailSendDefinitionObjectID;
            // This is the Name of the Definition Object
            activityOne.Name = iEmailSendDefinitionName;
            activityOne.Definition = new APIObject();
            EmailSendDefinition activityOneDefinition = new EmailSendDefinition();

            // Again this is the ObjectID of the Definition Object
            activityOneDefinition.ObjectID = iEmailSendDefinitionObjectID;
            // Again this is the Name of the Definition Object
            activityOneDefinition.Name = iEmailSendDefinitionName;
            activityOneDefinition.CustomerKey = iEmailSendDefinitionCustomerKey;

            activityOne.ActivityObject = activityOneDefinition;
            AutomationTask taskOne = new AutomationTask();
            taskOne.Name = "Task 1";
            taskOne.Activities = new AutomationActivity[] { activityOne };
            automation.AutomationTasks = new AutomationTask[] { taskOne };

            string RequestID = String.Empty;
            string OverallStatus = String.Empty;

            CreateResult[] createResults = soapClient.Create(new CreateOptions(), new APIObject[] { automation }, out RequestID, out OverallStatus);

            Console.WriteLine("Status: " + OverallStatus);
            foreach (CreateResult cr in createResults)
            {
                Console.WriteLine("NewObjectID: " + cr.NewObjectID);
                Console.WriteLine("StatusCode: " + cr.StatusCode);
                Console.WriteLine("ErrorCode: " + cr.ErrorCode);
                Console.WriteLine("StatusMessage: " + cr.StatusMessage);
            }
        }
Ejemplo n.º 9
0
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<Automation> TableToList(DataTable table){
			List<Automation> retVal=new List<Automation>();
			Automation automation;
			for(int i=0;i<table.Rows.Count;i++) {
				automation=new Automation();
				automation.AutomationNum = PIn.Long  (table.Rows[i]["AutomationNum"].ToString());
				automation.Description   = PIn.String(table.Rows[i]["Description"].ToString());
				automation.Autotrigger   = (AutomationTrigger)PIn.Int(table.Rows[i]["Autotrigger"].ToString());
				automation.ProcCodes     = PIn.String(table.Rows[i]["ProcCodes"].ToString());
				automation.AutoAction    = (AutomationAction)PIn.Int(table.Rows[i]["AutoAction"].ToString());
				automation.SheetDefNum   = PIn.Long  (table.Rows[i]["SheetDefNum"].ToString());
				automation.CommType      = PIn.Long  (table.Rows[i]["CommType"].ToString());
				automation.MessageContent= PIn.String(table.Rows[i]["MessageContent"].ToString());
				retVal.Add(automation);
			}
			return retVal;
		}
Ejemplo n.º 10
0
        /// <summary>
        /// Program entry method
        /// </summary>
        private static void Main(string[] args)
        {
            //check if the program is already running
            Process[] _procRunning = Process.GetProcessesByName("AltF4");

            if (_procRunning.Length > 1)
            {
                Environment.Exit(0);
            }

            //Add event handlers
            AutomationFocusChangedEventHandler focusHandler = OnFocusChanged;

            Automation.AddAutomationFocusChangedEventHandler(focusHandler);

            AltF4Handler.Get().OnAltF4 += OnAltF4;

            //Start program loop
            Application.Run();
        }
Ejemplo n.º 11
0
 ///--------------------------------------------------------------------
 /// <summary>
 /// Unsubscribe from the selection events.
 /// </summary>
 /// <remarks>
 /// The events are raised by the SelectionItem elements,
 /// not the Selection container.
 /// </remarks>
 ///--------------------------------------------------------------------
 internal void RemoveTargetSelectionEventHandlers()
 {
     foreach (AutomationElement control in targetControls)
     {
         AutomationEventHandler selectionHandler =
             new AutomationEventHandler(TargetSelectionHandler);
         Automation.RemoveAutomationEventHandler(
             SelectionItemPattern.ElementSelectedEvent,
             control,
             selectionHandler);
         Automation.RemoveAutomationEventHandler(
             SelectionItemPattern.ElementAddedToSelectionEvent,
             control,
             selectionHandler);
         Automation.RemoveAutomationEventHandler(
             SelectionItemPattern.ElementRemovedFromSelectionEvent,
             control,
             selectionHandler);
     }
 }
        public async Task AutomationScenario6TestAsync()
        {
            var stopwatch  = new Stopwatch();
            var automation = new Automation();

            automation.IsActive         = true;
            automation.ExecutionTimeout = TimeSpan.FromSeconds(10);
            automation.Actions.Add(new DelayAction(automation.AutomationId, TimeSpan.FromSeconds(2)));
            automation.Actions.Add(new DelayAction(automation.AutomationId, TimeSpan.FromSeconds(2)));
            automation.Actions.Add(new DelayAction(automation.AutomationId, TimeSpan.FromSeconds(2)));

            stopwatch.Start();
            var result = await _automationService.ExecuteAsync(automation, null);

            stopwatch.Stop();

            Assert.IsTrue(result.Succeeded);
            // Assert should succeed because condition is met and delay is applied.
            Assert.IsTrue(stopwatch.Elapsed > TimeSpan.FromSeconds(3 * 2));
        }
        public void Update(IGroupCallService service)
        {
#if ENABLE_CALLS
            if (_service?.Manager != null)
            {
                _service.MutedChanged -= OnMutedChanged;
                _service.Manager.AudioLevelsUpdated -= OnAudioLevelsUpdated;
            }

            if (service?.Manager != null)
            {
                _service = service;
                _service.MutedChanged += OnMutedChanged;
                _service.Manager.AudioLevelsUpdated += OnAudioLevelsUpdated;

                TitleInfo.Text  = service.Call.Title.Length > 0 ? service.Call.Title : service.CacheService.GetTitle(_service.Chat);
                Audio.IsChecked = !_service.IsMuted;
                Automation.SetToolTip(Audio, _service.IsMuted ? Strings.Resources.VoipGroupUnmute : Strings.Resources.VoipGroupMute);
            }
        }
Ejemplo n.º 14
0
        static ProgramWindow()
        {
            Automation.AddAutomationEventHandler(
                WindowPattern.WindowOpenedEvent,
                AutomationElement.RootElement,
                TreeScope.Children,
                (sender, e) =>
            {
                WindowOpened?.Invoke(new WindowEventArgs(new ProgramWindow(new IntPtr((sender as AutomationElement).Current.NativeWindowHandle))));
            });

            /*Automation.AddAutomationEventHandler(
             *  WindowPattern.WindowClosedEvent,
             *  AutomationElement.RootElement,
             *  TreeScope.Subtree,
             *  (sender, e) =>
             *  {
             *      WindowClosed?.Invoke(new WindowEventArgs(new ProgramWindow(new IntPtr((sender as AutomationElement).Current.NativeWindowHandle))));
             *  });*/
        }
Ejemplo n.º 15
0
        public MainWindow()
        {
            Cameras           = new List <CameraSetup>();
            OpenLightFields   = new List <OpenLightField>();
            IncrementFileName = 0;

            // Open one invisible instance of LightField
            var openLightField = new OpenLightField(this, visibleLightField: false);

            // return its automation object
            automation_ = openLightField.Auto;

            // return its experiment object
            experiment_ = openLightField.Experiment;

            // return its application object
            application_ = openLightField.Application;

            IsVisibleChanged += MainWindow_IsVisibleChanged;
        }
Ejemplo n.º 16
0
        void Callback(IAsyncResult ar)
        {
            int x = 1;

            try
            {
                Automation _Automation = LyncClient.GetAutomation();


                SearchResults sr = _lc.ContactManager.EndSearch(ar);
                Contact       c  = sr.Contacts.First();
                _cList.Add(c);
                c.ContactInformationChanged += c_ContactInformationChanged;
                ContactAvailability availEnum = (ContactAvailability)c.GetContactInformation(ContactInformationType.Availability);
                _cn.SendStatusChange((string)((List <object>)c.GetContactInformation(ContactInformationType.EmailAddresses)).First(), availEnum);
            }
            catch
            {
            }
        }
Ejemplo n.º 17
0
 public IActionResult Post(Automation auto)
 {
     try
     {
         if (SystemStatus.RsvSvc == false)
         {
             if (auto.Command == "start")
             {
                 reserve.DayChecker(auto.Command);
                 SystemStatus.RsvSvc = true;
                 return(Ok("Starting service..."));
             }
             return(BadRequest("Service can not start"));
         }
         return(Conflict("Service already started"));
     } catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Ejemplo n.º 18
0
        public static void ListenForWindowClose()
        {
            var desktopElement = AutomationElement.FromHandle(DesktopWindowHandle);

            Automation.AddAutomationEventHandler(WindowPattern.WindowClosedEvent, desktopElement,
                                                 TreeScope.Subtree, (s1, e1) =>
            {
                WindowClosedEventArgs windowEventArgs = (WindowClosedEventArgs)e1;
                int[] runtimeIdentifiers = windowEventArgs.GetRuntimeId();
                IntPtr handle            = WindowListed(runtimeIdentifiers);

                if (handle != IntPtr.Zero)
                {
                    mainWindow.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
                    {
                        RemoveAWindow(handle);
                    }));
                }
            });
        }
Ejemplo n.º 19
0
        //updates the automation averages for the specified job's automation
        public void UpdateAutomationAverages(Guid?updatedJobId)
        {
            Job        updatedJob = repo.GetOne(updatedJobId ?? Guid.Empty);
            Automation automation = automationRepo.Find(null, a => a.Id == updatedJob.AutomationId).Items.FirstOrDefault();
            List <Job> sameAutomationJobs;


            if (updatedJob.IsSuccessful ?? false)
            {
                sameAutomationJobs = repo.Find(null, j => j.AutomationId == automation.Id && j.IsSuccessful == true).Items;
                automation.AverageSuccessfulExecutionInMinutes = GetAverageExecutionTime(sameAutomationJobs);
            }
            else
            {
                sameAutomationJobs = repo.Find(null, j => j.AutomationId == automation.Id && j.IsSuccessful == false).Items;
                automation.AverageUnSuccessfulExecutionInMinutes = GetAverageExecutionTime(sameAutomationJobs);
            }

            automationRepo.Update(automation);
        }
Ejemplo n.º 20
0
 private void ParseDirection(XmlElement element, MasterBar masterBar)
 {
     element.IterateChildren(c =>
     {
         if (c.NodeType == XmlNodeType.Element)
         {
             var e = (XmlElement)c;
             switch (c.LocalName)
             {
                 case "sound":
                     var tempoAutomation = new Automation();
                     tempoAutomation.IsLinear = true;
                     tempoAutomation.Type = AutomationType.Tempo;
                     tempoAutomation.Value = Std.ParseInt(e.GetAttribute("tempo"));
                     masterBar.TempoAutomation = tempoAutomation;
                     break;
             }
         }
     });
 }
Ejemplo n.º 21
0
        /// <summary>
        /// Called when visual studio is closed.
        /// </summary>
        public void HandleVisualStudioShutdown()
        {
            try
            {
                System.Threading.Tasks.Task.Run(() =>
                {
                    Automation.RemoveAutomationFocusChangedEventHandler(OnFocusChangedHandler);
                });

                m_packageDTEEvents.OnBeginShutdown -= ShutdownHandler;
                ShutdownHandler = null;
                currentPackage  = null;
            }
            catch (Exception expk)  //We have to catch the exception here, or the IDE can crash
            {
                Debug.WriteLine(expk.StackTrace);
            }
            try { keyboardManager.Dispose(); } catch (Exception expk) { Debug.WriteLine(expk); }    //We have to catch the exception here, or the IDE can crash
            try { vsOperations.Dispose(); } catch (Exception expv) { Debug.WriteLine(expv); }       //We have to catch the exception here, or the IDE can crash
        }
Ejemplo n.º 22
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <Automation> TableToList(DataTable table)
        {
            List <Automation> retVal = new List <Automation>();
            Automation        automation;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                automation = new Automation();
                automation.AutomationNum  = PIn.Long(table.Rows[i]["AutomationNum"].ToString());
                automation.Description    = PIn.String(table.Rows[i]["Description"].ToString());
                automation.Autotrigger    = (AutomationTrigger)PIn.Int(table.Rows[i]["Autotrigger"].ToString());
                automation.ProcCodes      = PIn.String(table.Rows[i]["ProcCodes"].ToString());
                automation.AutoAction     = (AutomationAction)PIn.Int(table.Rows[i]["AutoAction"].ToString());
                automation.SheetDefNum    = PIn.Long(table.Rows[i]["SheetDefNum"].ToString());
                automation.CommType       = PIn.Long(table.Rows[i]["CommType"].ToString());
                automation.MessageContent = PIn.String(table.Rows[i]["MessageContent"].ToString());
                retVal.Add(automation);
            }
            return(retVal);
        }
Ejemplo n.º 23
0
        public Automation AddAutomation(AutomationViewModel request)
        {
            if (request.DriveName != "Files" && !string.IsNullOrEmpty(request.DriveName))
            {
                throw new EntityOperationException("Component files can only be saved in the Files drive");
            }
            else if (string.IsNullOrEmpty(request.DriveName))
            {
                request.DriveName = "Files";
            }

            IFormFile[] fileArray = { request.File };
            string      path      = Path.Combine(request.DriveName, "Automations", request.Id.ToString());

            var fileView = new FileFolderViewModel()
            {
                Files           = fileArray,
                StoragePath     = path,
                FullStoragePath = path,
                ContentType     = fileArray[0].ContentType,
                IsFile          = true
            };

            CheckStoragePathExists(fileView, request);
            fileView = _fileManager.AddFileFolder(fileView, request.DriveName)[0];

            var automationEngine = GetAutomationEngine(request.AutomationEngine);

            var automation = new Automation()
            {
                Name             = request.Name,
                AutomationEngine = automationEngine,
                Id     = request.Id,
                FileId = fileView.Id,
                OriginalPackageName = request.File.FileName
            };

            AddAutomationVersion(request);

            return(automation);
        }
Ejemplo n.º 24
0
        private void Start()
        {
            OrCondition  condition    = new OrCondition(new PropertyCondition(AutomationElement.ClassNameProperty, Shell_TrayWnd), new PropertyCondition(AutomationElement.ClassNameProperty, Shell_SecondaryTrayWnd));
            CacheRequest cacheRequest = new CacheRequest();

            cacheRequest.Add(AutomationElement.NameProperty);
            cacheRequest.Add(AutomationElement.BoundingRectangleProperty);

            bars.Clear();
            children.Clear();
            lasts.Clear();

            using (cacheRequest.Activate())
            {
                AutomationElementCollection lists = desktop.FindAll(TreeScope.Children, condition);
                if (lists == null)
                {
                    Debug.WriteLine("Null values found, aborting");
                    return;
                }
                Debug.WriteLine(lists.Count + " bar(s) detected");
                lasts.Clear();
                foreach (AutomationElement trayWnd in lists)
                {
                    AutomationElement tasklist = trayWnd.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.ClassNameProperty, MSTaskListWClass));
                    if (tasklist == null)
                    {
                        Debug.WriteLine("Null values found, aborting");
                        continue;
                    }
                    Automation.AddAutomationPropertyChangedEventHandler(tasklist, TreeScope.Element, OnUIAutomationEvent, AutomationElement.BoundingRectangleProperty);

                    bars.Add(trayWnd);
                    children.Add(trayWnd, tasklist);
                }
            }

            Automation.AddAutomationEventHandler(WindowPattern.WindowOpenedEvent, desktop, TreeScope.Subtree, OnUIAutomationEvent);
            Automation.AddAutomationEventHandler(WindowPattern.WindowClosedEvent, desktop, TreeScope.Subtree, OnUIAutomationEvent);
            loop();
        }
Ejemplo n.º 25
0
        /// <inheritdoc />
        public async Task Initialized(CancellationToken ct, Automation automation)
        {
            if (!_enableHomeAssistantDiscovery)
            {
                return;
            }

            var id     = "automation_" + GetId(automation);
            var config = new HomeAssistantConfig
            {
                Id                = id,
                Name              = id,    // cf. comment below
                StateTopic        = GetStateTopic(automation),
                StateOn           = "enabled",
                StateOff          = "disabled",
                IsOptimistic      = true,            // TODO: Add ability for automation to confirm state, then add control channel and set it pessimistic
                CommandTopic      = GetStateTopic(automation),
                PayloadOn         = "enabled",
                PayloadOff        = "disabled",
                IsRetained        = true,
                AvailabilityTopic = _mqtt.AvailabilityTopic,
                Icon              = "mdi:clipboard-text-play"    // "mdi:script-text-outline"
            };

            // With first publish the automation using the "id" as "name" so Home assistant
            // will use it as "entity_id" (which cannot be configured from discovery component)
            // Then we publish it a second time using the right name.
            // Note: HA will not generate 2 different devices as we are providing de vice "unique_id" which stays the same.
            // Note: This is a patch which works only if HA is up when this config is published, if not, you can still change the entity_id from the UI

            await _mqtt.Publish(ct, $"homeassistant/switch/{id}/config", JsonConvert.SerializeObject(config), retain : !_mqtt.IsTestEnvironment);

            config.Name = automation.Name;
            await _mqtt.Publish(ct, $"homeassistant/switch/{id}/config", JsonConvert.SerializeObject(config), retain : !_mqtt.IsTestEnvironment);

            // When we publish devices, Home assistant assume them as enabled.
            // Here we only republish the current state if any.
            var currentState = await IsAutomationEnabled(automation).FirstAsync().ToTask(ct);

            await _mqtt.Publish(ct, GetStateTopic(automation), currentState? "enabled" : "disabled", QualityOfService.AtLeastOnce, retain : !_mqtt.IsTestEnvironment);
        }
Ejemplo n.º 26
0
        public static bool AddOrderFields(NameValueCollection fields, ref List <string> log, bool dryRun = false)
        {
            fields.Add("NotificationEmailAddresses", dryRun ? "*****@*****.**" : "[email protected], [email protected]");
            var automation = new Automation(dryRun);

            try
            {
                var result         = automation.ProcessOrderFromFields(fields, fields["Channel"], out var OrderData, out var orderTracking);
                var operatorString = string.IsNullOrEmpty(orderTracking?.PrintOperator) ? "" : "(" + orderTracking.PrintOperator.Split(' ')[0] + ")";
                fields.Add("NotificationEmailSubject", (dryRun ? "(TEST)" : "") + "[" + (OrderData.OrderTotal - OrderData.ShippingCharge).ToString("C") + "]" + operatorString + " " + OrderData.OneLineDescription);
                log = automation.Log;
                return(result);
            }
            catch (Exception e)
            {
                log = automation.Log;
                log.Add(e.Message);
                log.Add(e.StackTrace);
            }
            return(false);
        }
Ejemplo n.º 27
0
        /// -------------------------------------------------------------------
        /// <summary>
        /// Check the IsOffScreen property, and that FromPoint(pt) == element where point
        /// was obtained from TryClickablePoint
        /// </summary>
        /// -------------------------------------------------------------------
        private void TS_VerifyElementIsOnScreenAndNotOverlapped(AutomationElement element, CheckType checkType)
        {
            if (true == element.Current.IsOffscreen)
            {
                ThrowMe(checkType, "IsOffScreen == true");
            }

            Point pt = new Point();

            if (false == element.TryGetClickablePoint(out pt))
            {
                ThrowMe(checkType, "TryGetClickablePoint() returned false");
            }

            if (false == Automation.Compare(element, AutomationElement.FromPoint(pt)))
            {
                ThrowMe(checkType, "Could not get element from pt{0}, could the element be covered by another window?", pt);
            }

            m_TestStep++;
        }
Ejemplo n.º 28
0
        public static void ListenForWindowOpen()
        {
            var desktopElement = AutomationElement.FromHandle(DesktopWindowHandle);

            Automation.AddAutomationEventHandler(WindowPattern.WindowOpenedEvent, desktopElement,
                                                 TreeScope.Subtree, (s1, e1) =>
            {
                var element = s1 as AutomationElement;

                if (element.Current.Name != null)
                {
                    IntPtr handle = (IntPtr)element.Current.NativeWindowHandle;
                    //string name = element.Current.Name;

                    mainWindow.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
                    {
                        AddAWindow(GetAWINDOW(handle));
                    }));
                }
            });
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Compares the two automation elements and returns if
        /// they are identical or not
        /// </summary>
        /// <param name="ele1">first element</param>
        /// <param name="ele2">second element</param>
        /// <returns></returns>
        public static bool IsDifferent(AutomationElement ele1, AutomationElement ele2)
        {
            bool retVal;

            if (ele1 == null || ele2 == null)
            {
                return(true);
            }

            try
            {
                retVal = !Automation.Compare(ele1.GetRuntimeId(), ele2.GetRuntimeId());
            }
            catch
            {
                retVal = true;
            }

            Log.Debug(retVal ? "YES" : "NO");
            return(retVal);
        }
        public static void UpdateAutomation(SoapClient soapClient,
            string AutomationObjectID,
            string NewNameForAutomation)
        {
            Automation automation = new Automation();
            automation.ObjectID = AutomationObjectID;
            automation.Name = NewNameForAutomation;

            string RequestID = String.Empty;
            string OverallStatus = String.Empty;

            UpdateResult[] createResults = soapClient.Update(new UpdateOptions(), new APIObject[] { automation }, out RequestID, out OverallStatus);

            Console.WriteLine("Status: " + OverallStatus);
            foreach (UpdateResult ur in createResults)
            {
                Console.WriteLine("StatusCode: " + ur.StatusCode);
                Console.WriteLine("ErrorCode: " + ur.ErrorCode);
                Console.WriteLine("StatusMessage: " + ur.StatusMessage);
            }
        }
        /// <summary>
        /// Default constructor for the test.
        /// </summary>
        public AutomationTests()
        {
            _automationService = new AutomationService(
                new Mock <IAutomationManager>().Object,
                new Mock <IOptions <AutomationOptions> >().Object,
                new Mock <ILogger <AutomationService> >().Object);

            _defaultCustomer = new Customer()
            {
                Name   = "Test1",
                Email  = "*****@*****.**",
                Age    = 18,
                Active = false
            };

            _defaultAutomation          = new Automation();
            _defaultAutomation.IsActive = true;
            _defaultAutomation.Conditions.Add(new Condition <Customer>(_defaultAutomation.AutomationId, (e) => !string.IsNullOrEmpty(e.Name)));
            _defaultAutomation.Conditions.Add(new Condition <Customer>(_defaultAutomation.AutomationId, (e) => !string.IsNullOrEmpty(e.Email)));
            _defaultAutomation.Conditions.Add(new Condition <Customer>(_defaultAutomation.AutomationId, (e) => e.Age >= 18));
        }
Ejemplo n.º 32
0
        private void OnWindowOpened(object src, AutomationEventArgs args)
        {
            AutomationElement openedWin = src as AutomationElement;

            if (openedWin != null)
            {
                WGWindow window = new WGWindow(openedWin);
                openedWindows.Add(window);

                AutomationEventHandler closeFunction =
                    (object sender, AutomationEventArgs e) =>
                {
                    openedWindows.Remove(window);
                    closedWindows.Add(window);
                };

                Automation.AddAutomationEventHandler(
                    WindowPattern.WindowClosedEvent,
                    openedWin, TreeScope.Element, closeFunction);
            }
        }
Ejemplo n.º 33
0
        static void Main(string[] args)
        {
            var notepadWindow = AutomationElement.RootElement.FindFirst(
                TreeScope.Children,
                new PropertyCondition(AutomationElementIdentifiers.NameProperty, "Untitled - Notepad")
                );

            var document = notepadWindow.FindFirst(
                TreeScope.Children,
                new PropertyCondition(AutomationElementIdentifiers.ControlTypeProperty, ControlType.Document)
                );

            Automation.AddAutomationEventHandler(
                TextPattern.TextSelectionChangedEvent,
                document,
                TreeScope.Element,
                AutoCorrect
                );

            Console.ReadLine();
        }
Ejemplo n.º 34
0
        protected override string GetNameCore()
        {
            if (_owner.ContentTemplateRoot is MessageSelector selector)
            {
                var bubble = selector.Content as MessageBubble;
                if (bubble != null)
                {
                    return(bubble.GetAutomationName() ?? base.GetNameCore());
                }
            }
            else if (_owner.ContentTemplateRoot is MessageBubble child)
            {
                return(child.GetAutomationName() ?? base.GetNameCore());
            }
            else if (_owner.Content is Message message && _protoService != null)
            {
                return(Automation.GetDescription(_protoService, message));
            }

            return(base.GetNameCore());
        }
Ejemplo n.º 35
0
        //public InternetExplorer get_browser()
        //{
        //    ShellWindows shell = new ShellWindows();
        //    List<InternetExplorer> browsers = new List<InternetExplorer>();

        //    Window_Info foreground_window = Windows.GetForegroundWindow();
        //    List<Window_Info> children = Windows.enum_child_windows(foreground_window.handle);
        //    //       StreamWriter writer = new StreamWriter("debug/ie.txt");
        //    foreach (Window_Info child in children)
        //    {
        //        if (child.class_name == "TabWindowClass")
        //        {

        //        }
        //        //        writer.WriteLine(child.handle.ToString() + " - " + child.class_name + " - " + child.title);
        //    }

        //     writer.Close();

        //    foreach (InternetExplorer application in shell)
        //    {
        //        if (application.HWND == foreground_window.handle.ToInt32())
        //        {
        //            // if (foreground_window.title.Contains(application.LocationName))
        //            //     return application;
        //        }
        //    }

        //    return null;
        //}

        public void cd_target(Sentence result)
        {
            try
            {
                string url = result.parameter["address"].text;

                if (folders.ContainsKey(url))
                {
                    //string path = folders[url].path;
                    //string command = path[0] + ":{ENTER}";
                    //Automation.sendkeys(command);
                    //command = @"cd\" + path.Substring(3) + "{ENTER}";
                    string command = "cd \"" + folders[url].path + "\"{ENTER}";
                    Automation.sendkeys(command);
                }
            }
            catch (Exception ex)
            {
                Feedback.print(ex);
            }
        }
Ejemplo n.º 36
0
        private void init()
        {
            timerEveProcessCheck.Elapsed += new ElapsedEventHandler(execEveTimer);
            timerEveProcessCheck.Interval = 1000 * 60 * 1;
            timerEveProcessCheck.Start();

            timerFileDiscover.Elapsed += new ElapsedEventHandler(execFileDiscoverTimer);
            timerFileDiscover.Interval = 1000 * 60 * 2;

            timerFileReader.Elapsed += new ElapsedEventHandler(execFileReaderTimer);

            timerConfigCheck.Elapsed += new ElapsedEventHandler(execConfigCheckTimer);
            timerConfigCheck.Interval = Configuration.ConfigCheckFrequency * 1000 * 60;

            myhandle = this.Handle; // for SetEveToBackground
            Automation.AddAutomationFocusChangedEventHandler(OnFocusChangedHandler);

            mnuSetEveToBackground.Checked = Configuration.SetEveToBackground;
            mnuOutputVerbose.Checked      = Configuration.Verbose;
            mnuOutputMinimal.Checked      = !Configuration.Verbose;
        }
Ejemplo n.º 37
0
        public void TestStructureChangeEvent()
        {
            StructureChangeHandler handler = new StructureChangeHandler();

            Automation.AddStructureChangedEventHandler(
                AutomationElement.RootElement,
                TreeScope.Subtree,
                new StructureChangedEventHandler(handler.HandleEvent));
            handler.Start();

            // Start Notepad to get a structure change event
            using (AppHost host = new AppHost("notepad.exe", ""))
            {
            }

            Assert.IsTrue(handler.Confirm());
            Assert.IsNotNull(handler.EventSource);
            Automation.RemoveStructureChangedEventHandler(
                AutomationElement.RootElement,
                new StructureChangedEventHandler(handler.HandleEvent));
        }
Ejemplo n.º 38
0
        public async Task ClickAutomationElementAsync(string elementName, bool recursive = false)
        {
            var element = await FindAutomationElementAsync(elementName, recursive).ConfigureAwait(false);

            if (element != null)
            {
                var tcs = new TaskCompletionSource <object>();

                Automation.AddAutomationEventHandler(InvokePattern.InvokedEvent, element, TreeScope.Element, (src, e) => {
                    tcs.SetResult(null);
                });

                if (element.TryGetCurrentPattern(InvokePattern.Pattern, out var invokePatternObj))
                {
                    var invokePattern = (InvokePattern)invokePatternObj;
                    invokePattern.Invoke();
                }

                await tcs.Task;
            }
        }
Ejemplo n.º 39
0
        private void MainWindow_Load(object z, EventArgs x)
        {
            modListControl1.SetWorker("Loading...");
            ToggleConsole(false);

            UpdateChk = new UpdateChecker(BuildData.CurrentVersion, BuildData.UpdateUrl, new Action(() => {
                this.Invoke(new MethodInvoker(() =>
                {
                    var dialog = GUI.MessageBox.Show(this, "New version of OpenModManager is avaiable!\nDo you want to download it?", "Update checker", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (dialog == DialogResult.Yes)
                    {
                        Process.Start(BuildData.ReleasesPage);
                    }
                }));
            }));

            modListControl1.AddModSource(new ModDirectorySource("Mods directory", Path.Combine(Program.ProcFactory.GetGamePath(), @"HatinTimeGame\Mods"), true));
            modListControl1.AddModSource(new ModDirectorySource("Mods directory (disabled)", Path.Combine(Program.ProcFactory.GetGamePath(), @"HatinTimeGame\Mods\Disabled"), true, true, true));

            var autoLoad = Properties.Settings.Default.AutoScanDownloadedMods;

            modListControl1.AddModSource(new ModDirectorySource("Downloaded mods", GameFinder.GetWorkshopDir(), autoLoad, false, true));
            modListControl1.AddModSource(new ModDirectorySource("Downloaded mods (disabled)", Path.Combine(GameFinder.GetWorkshopDir(), "Disabled"), autoLoad, false, true));

            modListControl1.ReloadList();

            SetModListState(null);

            Automation.AddAutomationEventHandler(
                WindowPattern.WindowOpenedEvent,
                AutomationElement.RootElement,
                TreeScope.Children,
                (sender, e) =>
            {
                var element = sender as AutomationElement;
                Console.WriteLine("new window opened");
            });

            UpdateChk.CheckForUpdatesAsync();
        }
        public static void PerformAutomation(SoapClient soapClient,
            string iAutomationObjectID)
        {
            Automation automation = new Automation();
            automation.ObjectID = iAutomationObjectID;

            string sStatus = "";
            string sStatusMessage = "";
            string sRequestId = "";

            PerformResult[] pResults = soapClient.Perform(new PerformOptions(), "start", new APIObject[] { automation }, out sStatus, out sStatusMessage, out sRequestId);

            Console.WriteLine("Status: " + sStatus);
            Console.WriteLine("Status Message: " + sStatusMessage);
            Console.WriteLine("Request ID: " + sRequestId);

            foreach (PerformResult pr in pResults)
            {
                Console.WriteLine("StatusCode: " + pr.StatusCode);
                Console.WriteLine("ErrorCode: " + pr.ErrorCode);
                Console.WriteLine("StatusMessage: " + pr.StatusMessage);
            }
        }
Ejemplo n.º 41
0
        public void DisplayMenu()
        {
            Boolean exit = false;
            Automation executer = new Automation();
            do
            {
                centerText("Automation TC 7zip");
                centerText("=========================");
                Console.WriteLine("Type an option:");
                Console.WriteLine("1.Create Test Case ");
                Console.WriteLine("2.Executed Test Case");
                Console.WriteLine("3.Change 7zip path");
                Console.WriteLine("4.Exit");
                var initOption = Console.ReadLine();
                switch(initOption)
                {
                    case "1":
                        Console.WriteLine("Type an option:");
                        Console.WriteLine("1. File");
                        Console.WriteLine("2. Folder");
                        var dataOption = Console.ReadLine();
                        switch (dataOption)
                        {
                            case "1":
                                Console.WriteLine("Put the entry data");
                                Console.WriteLine("Type the path File");
                                var pathFile = Console.ReadLine();
                                extensionMenu();
                                //executer.CreateFileTCs;
                                if (!exit)
                                {
                                    TestCase tc = new TestCase();
                                    //executer.CreateFileTCs;
                                }
                                else
                                {
                                    Console.ForegroundColor = ConsoleColor.Red;
                                    displayErrorMessage("ERROR : Invalid data was entered");
                                    Console.ResetColor();
                                }

                                break;

                            case "2":
                                Console.WriteLine("Put the entry data");
                                Console.WriteLine("Type the path File");
                                var pathFolder = Console.ReadLine();
                                break;

                        }
                        break;
                    case "3":
                        Console.WriteLine("Type the path File");
                        var path7zip = Console.ReadLine();
                        break;
                    case "4":
                        exit = true;
                        break;
                }

            } while (!exit);
        }
Ejemplo n.º 42
0
        void ExportBars(Track track)
        {
            int lastTempo = -1;
            prevChordId = -1;
            for (int i = 0; i < track.Bars.Count; ++i)
            {
                var bar = track.Bars[i];
                if (gpif.MasterBars.Count <= i)
                {
                    // this only has to be done for the first track, all other tracks
                    // are assumed to have the same bar layout (which makes sense, if
                    // they are supposed to fit together :) ).
                    var masterBar = new MasterBar();
                    masterBar.Time = string.Format("{0}/{1}", bar.TimeNominator, bar.TimeDenominator);
                    gpif.MasterBars.Add(masterBar);
                    if (bar.BeatsPerMinute != lastTempo)
                    {
                        // set tempo for this bar
                        var tempo = new Automation();
                        tempo.Bar = i;
                        tempo.Position = 0;
                        tempo.Linear = false;
                        tempo.Value[0] = bar.BeatsPerMinute;
                        tempo.Value[1] = 2; // no idea what this represents
                        gpif.MasterTrack.Automations.Add(tempo);
                        lastTempo = bar.BeatsPerMinute;
                    }
                }

                // construct a voice for this bar
                var voice = new Voice();
                voice.Id = gpif.Voices.Count;
                foreach (var chord in bar.Chords)
                {
                    int id = ExportOrFindBeat(chord);
                    voice.Beats.Add(id);
                }

                // see if this voice is already available, otherwise add
                var searchVoice = gpif.Voices.Find(x => x.Equals(voice));
                if (searchVoice != null)
                    voice = searchVoice;
                else
                    gpif.Voices.Add(voice);

                // construct the bar
                var gpBar = new Gpif.Bar();
                gpBar.Id = gpif.Bars.Count;
                if (track.Instrument == Track.InstrumentType.Bass)
                    gpBar.Clef = "F4";
                else
                    gpBar.Clef = "G2";
                gpBar.Voices[0] = voice.Id;
                // see if this bar is already available, otherwise add
                var searchBar = gpif.Bars.Find(x => x.Equals(gpBar));
                if (searchBar != null)
                    gpBar = searchBar;
                else
                    gpif.Bars.Add(gpBar);

                // add to master bar
                gpif.MasterBars[i].Bars.Add(gpBar.Id);
            }
        }
 public void SetVisualState(Automation.WindowVisualState state)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 44
0
        /** Controls:
         * Alt + Enter : Toggle full screen
         * Escape : Quit
         * Space : Generate noise
         * Tilde: clear
         * click: inject pixels (draw)
         * scroll: adjust draw size
         * 1: use game of life rules
         * 2: use high life rules
         * 3: use chaos seeds rules
         * 4: use day and night rules
         * 5: use rule 90
         */
        protected override void Update(GameTime gameTime)
        {
            keysl = keysc; keysc = Keyboard.GetState();
            mousel = mousec; mousec = Mouse.GetState();

            if (keysc.IsKeyUp(Keys.Escape) && keysl.IsKeyDown(Keys.Escape))
                this.Exit();

            if ((keysc.IsKeyDown(Keys.LeftAlt) || keysc.IsKeyDown(Keys.RightAlt)) && (keysc.IsKeyDown(Keys.Enter) && keysl.IsKeyUp(Keys.Enter)))
            {
                if (graphics.IsFullScreen)
                {
                    graphics.PreferredBackBufferWidth = defaultSize.X;
                    graphics.PreferredBackBufferHeight = defaultSize.Y;
                }
                else
                {
                    graphics.PreferredBackBufferWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
                    graphics.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
                }
                effect.Parameters["resolution"].SetValue(new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight));
                resizeTextures();
                graphics.ToggleFullScreen();
            }

            if (keysc.IsKeyDown(Keys.Space) && keysl.IsKeyUp(Keys.Space))
                DrawSplatter();

            if (keysc.IsKeyDown(Keys.OemTilde) && keysl.IsKeyUp(Keys.OemTilde))
                resizeTextures();

            if (keysc.IsKeyDown(Keys.D1) && keysl.IsKeyUp(Keys.D1))
                automation = Automation.gol;

            if (keysc.IsKeyDown(Keys.D2) && keysl.IsKeyUp(Keys.D2))
                automation = Automation.hl;

            if (keysc.IsKeyDown(Keys.D3) && keysl.IsKeyUp(Keys.D3))
                automation = Automation.cs;

            if (keysc.IsKeyDown(Keys.D4) && keysl.IsKeyUp(Keys.D4))
                automation = Automation.dan;

            if (keysc.IsKeyDown(Keys.D5) && keysl.IsKeyUp(Keys.D5))
                automation = Automation.r90;

            int scrolldelta = mousec.ScrollWheelValue - mousel.ScrollWheelValue;
            if (scrolldelta != 0)
            {
                // dumb hack because .Net wont let a uint be incremented by an int.
                if (mousesize < 10)
                {
                    if (scrolldelta > 0)
                        mousesize++;
                    else
                        mousesize--;
                }
                else
                {
                    if (scrolldelta > 0)
                        mousesize = (uint)(((double)mousesize) * 1.2);
                    else
                        mousesize = (uint)(((double)mousesize) * 0.8);
                }

                mousesize = Math.Max(1, mousesize);
                mousesize = Math.Min(1000, mousesize);
            }

            base.Update(gameTime);
        }
Ejemplo n.º 45
0
 public Automation Clone()
 {
     var a = new Automation();
     CopyTo(this, a);
     return a;
 }
Ejemplo n.º 46
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            lync = LyncClient.GetAutomation();
            client = LyncClient.GetClient();
            ConversationManager mgr = client.ConversationManager;
            mgr.ConversationAdded += (s, evt) =>
            {
                meetNowConvo = evt.Conversation;
                meetNowConvo.PropertyChanged += (s3, e3) =>
                {
                    Debug.Print("> Conversation.PropertyChanged : Property:{0}, Value:{1}", e3.Property, e3.Value);
                    if (e3.Property == ConversationProperty.NumberOfParticipantsRecording && e3.Value.Equals(0))
                    {
                        if(ConversationEnded != null)
                        {
                            ConversationEnded(s3, e3);
                        }
                    }
                };
                ConversationWindow win = lync.GetConversationWindow(meetNowConvo);

                Modality m = meetNowConvo.Modalities[ModalityTypes.AudioVideo];
                            
                AVModality avm = (AVModality)m;

                avm.ModalityStateChanged += (s2, e2) =>
                {
                    Debug.Print("> AVModality.ModalityStateChanged : {0}", e2.NewState);
                    if (e2.NewState == ModalityState.Connected)
                    {
                        Debug.Print("** AV Connected**");
                        ApplicationSharingModality m1 = (ApplicationSharingModality)meetNowConvo.Modalities[ModalityTypes.ApplicationSharing];
                        m1.ModalityStateChanged += (s5, e5) =>
                        {
                            Debug.Print("> ApplicationSharingModality.ModalityChanged : {0}", e5.NewState);

                            if (e5.NewState == ModalityState.Connected)
                            {
                                Debug.Print("** Sharing Ok **");                                

                                Windowing.SetForegroundWindow(win.Handle);
                                SendKeys.SendWait("{TAB}");
                                SendKeys.SendWait("{TAB}");
                                SendKeys.SendWait("{TAB}");
                                SendKeys.SendWait("{TAB}");
                                SendKeys.SendWait("{TAB}");
                                SendKeys.SendWait("{TAB}");
                                SendKeys.SendWait("{TAB}");
                                SendKeys.SendWait("{TAB}");
                                SendKeys.SendWait("{TAB}");
                                SendKeys.SendWait(" ");
                                SendKeys.SendWait("r");

                                Windowing.ShowWindow(win.Handle, (int)Windowing.ShowCommands.SW_SHOWMINNOACTIVE);
                            }
                        };
                        
                        m1.BeginShareDesktop(GetNullAsyncCallback("ApplicationSharingModality.BeginShareDesktop"), null);
                        
                    }
                };

                avm.BeginConnect(GetNullAsyncCallback("AVModality.BeginConnect"), null);

            };
            
        }
Ejemplo n.º 47
0
 ///<summary>Updates one Automation in the database.</summary>
 internal static void Update(Automation automation)
 {
     string command="UPDATE automation SET "
         +"Description   = '"+POut.String(automation.Description)+"', "
         +"Autotrigger   =  "+POut.Int   ((int)automation.Autotrigger)+", "
         +"ProcCodes     = '"+POut.String(automation.ProcCodes)+"', "
         +"AutoAction    =  "+POut.Int   ((int)automation.AutoAction)+", "
         +"SheetDefNum   =  "+POut.Long  (automation.SheetDefNum)+", "
         +"CommType      =  "+POut.Long  (automation.CommType)+", "
         +"MessageContent= '"+POut.String(automation.MessageContent)+"' "
         +"WHERE AutomationNum = "+POut.Long(automation.AutomationNum);
     Db.NonQ(command);
 }
Ejemplo n.º 48
0
 ///<summary>Updates one Automation in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.</summary>
 internal static void Update(Automation automation,Automation oldAutomation)
 {
     string command="";
     if(automation.Description != oldAutomation.Description) {
         if(command!=""){ command+=",";}
         command+="Description = '"+POut.String(automation.Description)+"'";
     }
     if(automation.Autotrigger != oldAutomation.Autotrigger) {
         if(command!=""){ command+=",";}
         command+="Autotrigger = "+POut.Int   ((int)automation.Autotrigger)+"";
     }
     if(automation.ProcCodes != oldAutomation.ProcCodes) {
         if(command!=""){ command+=",";}
         command+="ProcCodes = '"+POut.String(automation.ProcCodes)+"'";
     }
     if(automation.AutoAction != oldAutomation.AutoAction) {
         if(command!=""){ command+=",";}
         command+="AutoAction = "+POut.Int   ((int)automation.AutoAction)+"";
     }
     if(automation.SheetDefNum != oldAutomation.SheetDefNum) {
         if(command!=""){ command+=",";}
         command+="SheetDefNum = "+POut.Long(automation.SheetDefNum)+"";
     }
     if(automation.CommType != oldAutomation.CommType) {
         if(command!=""){ command+=",";}
         command+="CommType = "+POut.Long(automation.CommType)+"";
     }
     if(automation.MessageContent != oldAutomation.MessageContent) {
         if(command!=""){ command+=",";}
         command+="MessageContent = '"+POut.String(automation.MessageContent)+"'";
     }
     if(command==""){
         return;
     }
     command="UPDATE automation SET "+command
         +" WHERE AutomationNum = "+POut.Long(automation.AutomationNum);
     Db.NonQ(command);
 }
Ejemplo n.º 49
-1
        public void FocusChangedWithPaintTest()
        {
            var focusChangedElements = new List <string>();
            var mainWindow           = Application.GetMainWindow(Automation);
            var x = Automation.RegisterFocusChangedEvent(element => { focusChangedElements.Add(element.ToString()); });

            Thread.Sleep(100);
            var button1 = mainWindow.FindFirstDescendant(cf => cf.ByControlType(ControlType.Button).And(cf.ByText(GetResizeText())));

            button1.AsButton().Invoke();
            Thread.Sleep(100);
            var radio2 = mainWindow.FindFirstDescendant(cf => cf.ByControlType(ControlType.RadioButton).And(cf.ByText(GetPixelsText())));

            Mouse.Click(radio2.GetClickablePoint());
            Thread.Sleep(100);
            Keyboard.Press(VirtualKeyShort.ESCAPE);
            Thread.Sleep(100);
            x.Dispose();
            mainWindow.Close();
            Assert.That(focusChangedElements.Count, Is.GreaterThan(0));
        }