/// <summary> /// Creates a new instance of the <see cref="FrmLogBookmarks"/> window. /// </summary> /// <param name="bookmarkProvider">The <see cref="IBookmarkProvider"/> instance that provides bookmarked <see cref="LogMessage"/>s.</param> public FrmLogBookmarks(IBookmarkProvider bookmarkProvider) { mBookmarkProvider = bookmarkProvider; // Register this instance as observer. mBookmarkProvider?.RegisterBookmarkObserver(this); InitializeComponent(); // Apply the current application theme to the control. ThemeManager.ApplyTo(this); }
private async Task <IList <WorkflowTrigger> > GetTriggersForBookmarkProvider( IBookmarkProvider provider, BookmarkProviderContext context, IActivityBlueprint activityBlueprint, IWorkflowBlueprint workflowBlueprint, CancellationToken cancellationToken = default) { var bookmarkResults = (await provider.GetBookmarksAsync(context, cancellationToken)).ToList(); return(bookmarkResults .Select(x => new WorkflowTrigger(workflowBlueprint, activityBlueprint.Id, x.ActivityTypeName ?? activityBlueprint.Type, _bookmarkHasher.Hash(x.Bookmark), x.Bookmark)) .ToList()); }
/// <summary> /// Creates a new instance of the <see cref="FrmLogBookmarks"/> window. /// </summary> /// <param name="bookmarkProvider">The <see cref="IBookmarkProvider"/> instance that provides bookmarked <see cref="LogMessage"/>s.</param> public FrmLogBookmarks(IBookmarkProvider bookmarkProvider) { mBookmarkProvider = bookmarkProvider; if (mBookmarkProvider != null) { // Register this instance as observer. mBookmarkProvider.RegisterBookmarkObserver(this); } InitializeComponent(); // Apply the current application theme to the control. ThemeManager.CurrentApplicationTheme.ApplyTo(toolStrip1); }
public FileBufferDataProviderThatAllowscurrentBookmarkToBeSet( string baseBufferFileName, IFileSystemAdapter fileSystemAdapter, IBookmarkProvider bookmarkProvider, Encoding encoding, int batchPostingLimit, long?eventBodyLimitBytes, int?retainedFileCountLimit) : base(baseBufferFileName, fileSystemAdapter, bookmarkProvider, encoding, batchPostingLimit, eventBodyLimitBytes, retainedFileCountLimit) { }
public FileBufferDataProvider( string baseBufferFileName, IFileSystemAdapter fileSystemAdapter, IBookmarkProvider bookmarkProvider, Encoding encoding, int batchPostingLimit, long?eventBodyLimitBytes, int?retainedFileCountLimit) { //construct a valid path to a file in the log folder to get the folder path: _logFolder = Path.GetDirectoryName(Path.GetFullPath(baseBufferFileName + ".bookmark")); _candidateSearchPath = Path.GetFileName(baseBufferFileName) + "*.json"; _fileSystemAdapter = fileSystemAdapter; _bookmarkProvider = bookmarkProvider; _encoding = encoding; _batchPostingLimit = batchPostingLimit; _eventBodyLimitBytes = eventBodyLimitBytes; _retainedFileCountLimit = retainedFileCountLimit; }
public async Task GetTriggersForActivityBlueprintAsyncReturnsTriggersForEachBookmarkInSupportedBookmarkProviders(IBookmarkHasher bookmarkHasher, IBookmarkProvider bookmarkProvider1, IBookmarkProvider unsupportedBookmarkProvider, IBookmarkProvider bookmarkProvider2, ICreatesActivityExecutionContextForActivityBlueprint activityExecutionContextFactory, [Frozen] IActivityBlueprint activityBlueprint, [WithAutofixtureResolution, Frozen] IServiceProvider serviceProvider, [Frozen] IWorkflowBlueprint workflowBlueprint, [OmitOnRecursion, Frozen] WorkflowInstance workflowInstance, [Frozen] WorkflowExecutionContext workflowExecutionContext, [NoAutoProperties] ActivityExecutionContext activityExecutionContext, ActivityType activityType, IBookmark bookmark1, IBookmark bookmark2, IBookmark bookmark3, IBookmark bookmark4) { var sut = new TriggersForActivityBlueprintAndWorkflowProvider(bookmarkHasher, new[] { bookmarkProvider1, unsupportedBookmarkProvider, bookmarkProvider2 }, activityExecutionContextFactory); Mock.Get(activityExecutionContextFactory) .Setup(x => x.CreateActivityExecutionContext(activityBlueprint, workflowExecutionContext, default)) .Returns(activityExecutionContext); Mock.Get(activityBlueprint).SetupGet(x => x.Type).Returns(activityType.TypeName); Mock.Get(bookmarkProvider1) .Setup(x => x.SupportsActivityAsync(It.Is <BookmarkProviderContext>(c => c.ActivityType == activityType), default)) .Returns(() => ValueTask.FromResult(true)); Mock.Get(unsupportedBookmarkProvider) .Setup(x => x.SupportsActivityAsync(It.Is <BookmarkProviderContext>(c => c.ActivityType == activityType), default)) .Returns(() => ValueTask.FromResult(false)); Mock.Get(bookmarkProvider2) .Setup(x => x.SupportsActivityAsync(It.Is <BookmarkProviderContext>(c => c.ActivityType == activityType), default)) .Returns(() => ValueTask.FromResult(true)); Mock.Get(bookmarkProvider1) .Setup(x => x.GetBookmarksAsync(It.IsAny <BookmarkProviderContext>(), default)) .Returns(() => ValueTask.FromResult <IEnumerable <IBookmark> >(new [] { bookmark1, bookmark2 })); Mock.Get(bookmarkProvider2) .Setup(x => x.GetBookmarksAsync(It.IsAny <BookmarkProviderContext>(), default)) .Returns(() => ValueTask.FromResult <IEnumerable <IBookmark> >(new [] { bookmark3, bookmark4 })); var result = await sut.GetTriggersForActivityBlueprintAsync(activityBlueprint, workflowExecutionContext, new Dictionary <string, ActivityType> { { activityType.TypeName, activityType } }); Assert.True(result.Any(x => x.Bookmark == bookmark1), "Result contains a trigger for bookmark 1"); Assert.True(result.Any(x => x.Bookmark == bookmark2), "Result contains a trigger for bookmark 2"); Assert.True(result.Any(x => x.Bookmark == bookmark3), "Result contains a trigger for bookmark 3"); Assert.True(result.Any(x => x.Bookmark == bookmark4), "Result contains a trigger for bookmark 4"); Assert.True(result.Count() == 4, "Result has 4 items"); }
/// <summary> /// Creates a new instance of the <see cref="FrmLogScript"/> window. /// </summary> /// <param name="bookmarkProvider">The <see cref="IBookmarkProvider"/> instance that provides bookmarked <see cref="LogMessage"/>s.</param> /// <param name="logContainer">The <see cref="ILogContainer"/> that contains the source for <see cref="LogMessage"/>s.</param> public FrmLogScript(IBookmarkProvider bookmarkProvider, ILogContainer logContainer) { InitializeComponent(); // Apply the current application theme to the control. ThemeManager.CurrentApplicationTheme.ApplyTo(tsCuCommands); ThemeManager.CurrentApplicationTheme.ApplyTo(tsOutput); ThemeManager.CurrentApplicationTheme.ApplyTo(cmsLuaEdit); DockHandler.CloseButton = false; DockHandler.CloseButtonVisible = false; mLogContainer = logContainer; mBookmarkProvider = bookmarkProvider; if (mBookmarkProvider != null) { mBookmarkProvider.RegisterBookmarkObserver(this); } // Intialize the edit control. InitializeScintilaCtrl(); // Prevent the undo of the initial text. scintilla.EmptyUndoBuffer(); // Listening for settings changes. Settings.Default.SettingChanging += DefaultSettingChanging; }