/// <summary> /// Validates the settings for an OutOfProcessApplication. /// </summary> /// <param name="settings">The settings to validate.</param> private void ValidateApplicationSettings(OutOfProcessApplicationSettings settings) { if (settings.ProcessStartInfo == null) { throw new InvalidOperationException("For OutOfProc scenario, ProcessStartInfo cannot be null."); } if (settings.ApplicationImplementationFactory == null) { throw new InvalidOperationException("ApplicationImplementationFactory must be specified."); } }
internal UIAutomationApplicationImpl(OutOfProcessApplicationSettings settings) { IsMainWindowOpened = false; this.settings = settings; this.windows = new List <AutomationElement>(); Process = new Process(); Process.StartInfo = settings.ProcessStartInfo; Process.EnableRaisingEvents = true; Process.Exited += this.OnApplicationExit; Automation.AddAutomationEventHandler( WindowPatternIdentifiers.WindowOpenedEvent, AutomationElement.RootElement, TreeScope.Subtree, OnActivated); Automation.AddAutomationFocusChangedEventHandler(OnFocusChanged); }
/// <summary> /// Initializes a new instance of an OutOfProcessApplication. /// </summary> /// <param name="settings">The settings used to start the test application.</param> public OutOfProcessApplication(OutOfProcessApplicationSettings settings) { ValidateApplicationSettings(settings); ApplicationSettings = settings; }