protected override void SetUpPage() { base.SetUpPage(); _actualEvents = new StringCollection(); _lazyContainer = new LazyContainer(); _lazyContainer.ID = "LazyContainer"; _lazyContainer.Init += new EventHandler(LazyContainer_Init); _lazyContainer.Load += new EventHandler(LazyContainer_Load); NamingContainer.Controls.Add(_lazyContainer); _lazyContainerInvoker = new ControlInvoker(_lazyContainer); _parent = new ControlMock(); _parent.ID = "Parent"; _parent.Init += new EventHandler(Parent_Init); _parent.Load += new EventHandler(Parent_Load); _parentInvoker = new ControlInvoker(_parent); _child = new ControlMock(); _child.ID = "Child"; _child.Init += new EventHandler(Child_Init); _child.Load += new EventHandler(Child_Load); _childInvoker = new ControlInvoker(_child); _parent.Controls.Add(_child); _childSecond = new ControlMock(); _childSecond.ID = "ChildSecond"; _childSecond.Init += new EventHandler(ChildSecond_Init); _childSecond.Load += new EventHandler(ChildSecond_Load); _childSecondInvoker = new ControlInvoker(_childSecond); _parent.Controls.Add(_childSecond); }
public UpdateChecker(GlobalSettingsContainer globalSettingsContainer, LazyContainer <INotificationProvider, IPriorityMetadata> notificationProviders) { this.globalSettingsContainer = globalSettingsContainer; this.timer.Elapsed += TimerOnElapsed; this.notificationProvider = notificationProviders.GetSupportedNotificationProvider(); }
public NotificationManager(LazyContainer <INotificationProvider, IPriorityMetadata> notificationProviders, BuildCache buildCache, IEqualityComparer <IBuild> buildEqualityComparer, ExportFactory <IBuildsStatusView> buildsExportFactory) { this.buildCache = buildCache; this.buildEqualityComparer = buildEqualityComparer; this.buildsExportFactory = buildsExportFactory; this.buildCache.CacheUpdated += (sender, args) => ShowNotification(); this.notificationProvider = notificationProviders.GetSupportedNotificationProvider(); }
public static INotificationProvider GetSupportedNotificationProvider(this LazyContainer <INotificationProvider, IPriorityMetadata> notificationProviders) { var orderedKeys = notificationProviders.Keys.OrderByDescending(a => a.Priority); foreach (var priorityMetadata in orderedKeys) { var provider = notificationProviders.GetSingleOrDefault(a => a == priorityMetadata); if (provider.IsSupported) { return(provider); } } return(null); }
public BuildMonitor(LazyContainer <IBuildProvider, IBuildProviderMetadata> buildProviders, LazyContainer <INotificationProvider, IPriorityMetadata> notificationProviders, IEqualityComparer <IBuildDefinition> buildDefinitionEqualityComparer, GeneralSettings generalSettings) { this.buildProviders = buildProviders; this.buildDefinitionEqualityComparer = buildDefinitionEqualityComparer; this.generalSettings = generalSettings; this.notificationProvider = notificationProviders.GetSupportedNotificationProvider(); this.timer.Elapsed += (sender, args) => BeginPollingBuildsAsync().GetAwaiter().GetResult(); this.timer.ProgressElapsed += (sender, args) => { OnProgressUpdated(MaximumProgress - this.timer.CurrentInterval); }; }
/// <summary> /// Constructs a new occurence pattern-mather /// </summary> /// <param name="patternName"><see cref="PatternName"/>.</param> /// <param name="matchCount">The amount of matches necessary to constitute a pattern-match.</param> /// <param name="minLookBackCount"><see cref="MinLookBackCount"/>.</param> /// <param name="maxLookBackCount"><see cref="MaxLookBackCount"/>.</param> /// <param name="predicateBuilderFunction">The function that builds the predicate.</param> public OccurencePatternMatcher(string patternName, int matchCount, int minLookBackCount, int maxLookBackCount, Func <T, T, Func <T, bool> > predicateBuilderFunction) { //Cache the parameters. _matchCount = matchCount; PatternName = patternName; MinLookBackCount = minLookBackCount; MaxLookBackCount = maxLookBackCount; //Initialize the history. _history = new OccurenceHistory <T>(MaxLookBackCount - 1); //Initialize the predicate builder and property. _predicateBuilder = new RangePredicateBuilder <T, T>(predicateBuilderFunction); _predicateContainer = new LazyContainer <Func <T, bool> >(_predicateBuilder.BuildPredicate); }
/// <summary> /// Creates a new Pattern filter. /// </summary> /// <param name="patternName">Name of the pattern this filter matches for.</param> /// <param name="checkAmount">The amount of concurrent previous values to check.</param> /// <param name="matchAmount">The amount of instances of the <paramref name="neighborComparison"/> at which point the pattern is matched.</param> /// <param name="neighbourOffset">The size of the step between the value to check and it's neighbour.</param> /// <param name="neighborComparison">The predicate to compare the value and it's neighbour <paramref name="neighbourOffset"/> before it.</param> public NeighbourPatternMatcher(string patternName, int checkAmount, int matchAmount, int neighbourOffset, Func <Pair <T>, bool> neighborComparison) { PatternName = patternName; //Cache values. _matchAmount = matchAmount; _neighbourOffset = neighbourOffset; //Calculate the look back range. MinLookBackCount = matchAmount + neighbourOffset; MaxLookBackCount = checkAmount + neighbourOffset; _history = new NeighbourHistory <T>(MaxLookBackCount - 1, neighbourOffset); _predicateBuilder = new DefaultPredicateBuilder <T, Pair <T> >(neighborComparison); _predicateContainer = new LazyContainer <Func <Pair <T>, bool> >(_predicateBuilder.BuildPredicate); }
public TrackListLazyLoading(int[] trackIds, List <TrackDto> tracks, IDataApiClient apiClient) { container = new LazyContainer(trackIds, tracks, apiClient); }
public LazyIterator(LazyContainer container) { this.container = container; }