private StrategyScopeLocatorExecutionUnit CreateExecutionUnitForFinalFindAttribute(FindAttribute findAttribute, SearchOptions desiredSearchOptions)
        {
            object strategy = findAttribute.CreateStrategy();

            SearchOptions searchOptions = desiredSearchOptions.Clone();

            if (!desiredSearchOptions.IsVisibilitySet)
            {
                searchOptions.Visibility = findAttribute.Visibility;
            }

            if (!desiredSearchOptions.IsTimeoutSet)
            {
                searchOptions.Timeout = TimeSpan.FromSeconds(findAttribute.Timeout);
            }

            if (!desiredSearchOptions.IsRetryIntervalSet)
            {
                searchOptions.RetryInterval = TimeSpan.FromSeconds(findAttribute.RetryInterval);
            }

            ComponentScopeLocateOptions scopeLocateOptions = ComponentScopeLocateOptions.Create(_component, _component.Metadata, findAttribute);

            return(new StrategyScopeLocatorExecutionUnit(strategy, scopeLocateOptions, searchOptions));
        }
Exemplo n.º 2
0
        private static void InitComponentLocator(UIComponent component, UIComponentMetadata metadata, FindAttribute findAttribute)
        {
            ComponentScopeLocateOptions   locateOptions = CreateScopeLocateOptions(metadata, findAttribute);
            IComponentScopeLocateStrategy strategy      = findAttribute.CreateStrategy(metadata);

            component.ScopeSource = findAttribute.ScopeSource;

            if (component is IItemsControl itemsControl)
            {
                IFindItemAttribute       findItemAttribute       = GetPropertyFindItemAttribute(metadata);
                IItemElementFindStrategy itemElementFindStrategy = findItemAttribute.CreateStrategy(component, metadata);
                itemsControl.Apply(itemElementFindStrategy);
            }

            component.ScopeLocator = new StrategyScopeLocator(component, strategy, locateOptions);
        }
Exemplo n.º 3
0
        private StrategyScopeLocatorLayerExecutionUnit CreateExecutionUnitForLayerFindAttribute(FindAttribute findAttribute, SearchOptions desiredSearchOptions)
        {
            object strategy = findAttribute.CreateStrategy();

            // TODO: Set Timeout and RetryInterval too.
            SearchOptions searchOptions = new SearchOptions
            {
                IsSafely   = desiredSearchOptions.IsSafely,
                Visibility = findAttribute.Visibility
            };

            ComponentScopeLocateOptions scopeLocateOptions   = ComponentScopeLocateOptions.Create(component, findAttribute.Properties.Metadata, findAttribute);
            ILayerScopeContextResolver  scopeContextResolver = LayerScopeContextResolverFactory.Create(findAttribute.As);

            return(new StrategyScopeLocatorLayerExecutionUnit(strategy, scopeLocateOptions, searchOptions, scopeContextResolver));
        }
Exemplo n.º 4
0
        private StrategyScopeLocatorExecutionUnit CreateExecutionUnitForFinalFindAttribute(FindAttribute findAttribute, SearchOptions desiredSearchOptions)
        {
            object strategy = findAttribute.CreateStrategy();

            SearchOptions searchOptions = desiredSearchOptions.Clone();

            // TODO: Set Timeout and RetryInterval too.
            if (!desiredSearchOptions.IsVisibilitySet)
            {
                searchOptions.Visibility = findAttribute.Visibility;
            }

            ComponentScopeLocateOptions scopeLocateOptions = ComponentScopeLocateOptions.Create(component, component.Metadata, findAttribute);

            return(new StrategyScopeLocatorExecutionUnit(strategy, scopeLocateOptions, searchOptions));
        }
        private StrategyScopeLocatorLayerExecutionUnit CreateExecutionUnitForLayerFindAttribute(FindAttribute findAttribute, SearchOptions desiredSearchOptions)
        {
            object strategy = findAttribute.CreateStrategy();

            SearchOptions searchOptions = new SearchOptions
            {
                IsSafely      = desiredSearchOptions.IsSafely,
                Visibility    = findAttribute.Visibility,
                Timeout       = TimeSpan.FromSeconds(findAttribute.Timeout),
                RetryInterval = TimeSpan.FromSeconds(findAttribute.RetryInterval)
            };

            ComponentScopeLocateOptions scopeLocateOptions   = ComponentScopeLocateOptions.Create(_component, findAttribute.Properties.Metadata, findAttribute);
            ILayerScopeContextResolver  scopeContextResolver = LayerScopeContextResolverFactory.Create(findAttribute.As);

            return(new StrategyScopeLocatorLayerExecutionUnit(strategy, scopeLocateOptions, searchOptions, scopeContextResolver));
        }
Exemplo n.º 6
0
        private static void InitComponentLocator(UIComponent component, UIComponentMetadata metadata, FindAttribute findAttribute)
        {
            ComponentScopeLocateOptions   locateOptions = CreateScopeLocateOptions(metadata, findAttribute);
            IComponentScopeLocateStrategy strategy      = findAttribute.CreateStrategy(metadata);

            component.ScopeSource = findAttribute.ScopeSource;

            // TODO: Remove this condition when IItemsControl will be removed.
#pragma warning disable CS0618
            if (component is IItemsControl itemsControl)
#pragma warning restore CS0618
            {
                IFindItemAttribute       findItemAttribute       = GetPropertyFindItemAttribute(metadata);
                IItemElementFindStrategy itemElementFindStrategy = findItemAttribute.CreateStrategy(component, metadata);
                itemsControl.Apply(itemElementFindStrategy);
            }

            component.ScopeLocator = new StrategyScopeLocator(component, strategy, locateOptions);
        }