Table of Contents

Class StudioRecorderService

Namespace
Cress.Studio.Services
Assembly
Cress.Studio.Core.dll

Wraps RecordingSession (desktop) and WebRecorderClient (web) and exposes recording state for the Blazor Studio. Registered as Scoped — one instance per Blazor circuit (one per browser tab). Thread-safe: UIA events fire on COM background threads; all state writes are guarded by Interlocked / volatile / Lock.

public sealed class StudioRecorderService : IStudioRecorderService, IDisposable
Inheritance
StudioRecorderService
Implements
Inherited Members

Constructors

StudioRecorderService(RuntimeOrchestrator)

public StudioRecorderService(RuntimeOrchestrator orchestrator)

Parameters

orchestrator RuntimeOrchestrator

Properties

CapturedEventCount

Number of events captured in the active session so far.

public int CapturedEventCount { get; }

Property Value

int

CurrentEvents

The raw events captured so far in the active session. Empty when not recording. Thread-safe snapshot on each access.

public IReadOnlyList<RecordedEvent> CurrentEvents { get; }

Property Value

IReadOnlyList<RecordedEvent>

CurrentInferredSteps

Live inference applied to CurrentEvents. Recomputed on each StateChanged tick (~250 ms debounce). Empty when not recording.

public IReadOnlyList<InferredStep> CurrentInferredSteps { get; }

Property Value

IReadOnlyList<InferredStep>

CurrentTarget

The target that is currently being (or was last) recorded.

public RecordingTargetInfo? CurrentTarget { get; }

Property Value

RecordingTargetInfo

Elapsed

Elapsed time since recording started.

public TimeSpan Elapsed { get; }

Property Value

TimeSpan

IsRecording

True while a recording session is active.

public bool IsRecording { get; }

Property Value

bool

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

ListAvailableTargetsAsync()

Returns running processes that have a visible main window and can be attached to. Silently skips elevated/protected processes.

public Task<IReadOnlyList<RecordingTargetInfo>> ListAvailableTargetsAsync()

Returns

Task<IReadOnlyList<RecordingTargetInfo>>

ReplayRecordedFlowAsync(string, string)

Loads the flow at flowFilePath and executes it in-process using the project rooted at projectPath. Returns pass/fail + step summary. Never spawns an external process.

public Task<RecordingReplayResult> ReplayRecordedFlowAsync(string flowFilePath, string projectPath)

Parameters

flowFilePath string
projectPath string

Returns

Task<RecordingReplayResult>

StartRecordingAsync(int)

Attaches to processId and starts capturing events.

public Task StartRecordingAsync(int processId)

Parameters

processId int

Returns

Task

StartWebRecordingAsync(string, string, CancellationToken)

Spawns the Node.js web recorder, opens a browser at url, and starts streaming web events.

public Task StartWebRecordingAsync(string url, string browserType, CancellationToken ct = default)

Parameters

url string

Initial URL to navigate to (must be a valid absolute URL).

browserType string

Browser to launch: "chromium", "firefox", or "webkit".

ct CancellationToken

Optional cancellation token.

Returns

Task

StopRecordingAsync()

Stops the active session and returns the inferred steps plus raw events.

public Task<RecordingResult> StopRecordingAsync()

Returns

Task<RecordingResult>

Events

StateChanged

Fires when recording state changes (start/stop/new event). Debounced to ~250 ms so rapid UIA event streams don't spam Blazor renders.

public event Action? StateChanged

Event Type

Action