Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Element"/> class.
        /// </summary>
        /// <param name="itemWrapper">Wrapped UI item by specific UI automation framework.</param>
        /// <param name="uiNavigationProvider">
        /// A service for locating UI items and navigating
        /// among several running applications.
        /// </param>
        /// <param name="elementFactory">
        /// A service for helping locating UI items in a visual tree
        /// and initializing instances of <see cref="Element"/> for located items.
        /// </param>
        /// <param name="awaitingService">A service for awaiting various conditions to match.</param>
        /// <param name="logger">A loggind service.</param>
        protected internal Element(
            IUiItemWrapper itemWrapper,
            IUiNavigationProvider uiNavigationProvider,
            IElementFactory elementFactory,
            IAwaitingService awaitingService,
            ILogger logger)
        {
            this.Instance = itemWrapper ?? throw new ArgumentNullException(nameof(itemWrapper));

            this.uiNavigationProvider = uiNavigationProvider ?? throw new ArgumentNullException(nameof(uiNavigationProvider));
            this.elementFactory       = elementFactory ?? throw new ArgumentNullException(nameof(elementFactory));
            this.awaitingService      = awaitingService ?? throw new ArgumentNullException(nameof(awaitingService));
            this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
            this.DefaultSearchConditions = new ReadOnlyCollection <(string key, object value)>(elementFactory.GetDefaultSearchConditions(this.GetType()).ToList());
        }