Files
2026-04-17 14:55:32 -04:00

6.4 KiB
Raw Permalink Blame History

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
Common/DTS.Common/Events/DTS.Viewer/TestModification/RefreshTestRequestEvent.cs
Common/DTS.Common/Events/DTS.Viewer/TestModification/ShowT0CursorEvent.cs
Common/DTS.Common/Events/DTS.Viewer/TestModification/TestModificationChangedEvent.cs
Common/DTS.Common/Events/DTS.Viewer/TestModification/SetUseZeroForUnfilteredEvent.cs
Common/DTS.Common/Events/DTS.Viewer/TestModification/TestModificationEvent.cs
Common/DTS.Common/Events/DTS.Viewer/TestModification/ShiftT0Event.cs
2026-04-16T03:26:33.870349+00:00 Qwen/Qwen3-Coder-Next-FP8 1 74b84eb90ba5f23e

TestModification

Documentation: Test Modification Event Module

1. Purpose

This module defines a set of Prism-based pub/sub events used to coordinate test modification operations within the DTS Viewer component. It enables decoupled communication between UI components (e.g., viewers, controllers) and backend services (e.g., data processors, ROI generators) when tests are modified, T0 cursor state changes, or related configuration (e.g., UseZeroForUnfiltered) is updated. The events serve as a contract for propagating state changes and user actions related to test metadata, cursor positioning, and filtering behavior.

2. Public Interface

  • RefreshTestRequestEvent

    public class RefreshTestRequestEvent : PubSubEvent<string> { }
    

    Publishes a request to refresh a specific test, identified by its string test ID. Payload is the test ID.

  • ShowT0CursorEvent

    public class ShowT0CursorEvent : PubSubEvent<bool> { }
    

    Publishes a request to show or hide the T0 cursor. Payload is a bool: true to show, false to hide.

  • TestModificationChangedEvent

    public class TestModificationChangedEvent : PubSubEvent<ITestModificationModel> { }
    

    Publishes when the test modification model has changed. Payload is an ITestModificationModel instance representing the new/updated state.

  • SetUseZeroForUnfilteredEvent

    public class SetUseZeroForUnfilteredEvent : PubSubEvent<bool> { }
    

    Publishes a request to set the UseZeroForUnfiltered property. Payload is a bool: true means 0 is used in the isocode filter field for unfiltered cases; false means P is used.

  • TestModificationEvent

    public class TestModificationEvent : PubSubEvent<TestModificationArgs> { }
    public class TestModificationArgs
    {
        public string DataSetDirectory { get; }
        public string TestId { get; }
        public TestModificationArgs(string dtsFilePath, string testId)
    }
    

    Publishes whenever a test is modified by the viewer. Payload is a TestModificationArgs object containing:

    • DataSetDirectory: The path to the data set directory (originally passed as dtsFilePath).
    • TestId: The ID of the modified test.
  • ShiftT0Event

    public class ShiftT0Event : PubSubEvent<ShiftT0EventArguments> { }
    public class ShiftT0EventArguments
    {
        public double T0Time { get; }
        public bool IsInitialization { get; }
        public int T0Steps { get; }
        public bool IsKeyPress { get; }
        public ShiftT0EventArguments(double t0, bool isInitialization)
        public ShiftT0EventArguments(int steps, bool isInitialization, bool isKeyPress)
    }
    

    Publishes a request to shift the T0 time. Payload is a ShiftT0EventArguments object, constructed via one of two constructors:

    • ShiftT0EventArguments(double t0, bool isInitialization): For absolute T0 time shifts. Sets T0Time = t0, T0Steps = 0, IsKeyPress = false.
    • ShiftT0EventArguments(int steps, bool isInitialization, bool isKeyPress): For relative shifts (e.g., arrow key navigation). Sets T0Time = 0, T0Steps = steps, IsKeyPress = isKeyPress.

3. Invariants

  • All events derive from Prism.Events.PubSubEvent<T>, implying they are published/subscribed using Prisms event aggregation mechanism.
  • TestModificationArgs.TestId and TestModificationArgs.DataSetDirectory are immutable after construction (private set).
  • ShiftT0EventArguments has two mutually exclusive modes of operation:
    • Absolute shift: T0Time != 0, T0Steps == 0, IsKeyPress == false.
    • Relative shift: T0Time == 0, T0Steps != 0, IsKeyPress reflects whether triggered by keyboard.
  • ShowT0CursorEvent payload is strictly interpreted as a boolean toggle (no undefined or null values).
  • RefreshTestRequestEvent payload is expected to be a valid test ID string (no validation is performed in this module).

4. Dependencies

  • Dependencies on other modules:
    • Prism.Events (external library for event aggregation).
    • DTS.Common.Interface (for ITestModificationModel used in TestModificationChangedEvent).
  • Dependencies on this module:
    • Inferred consumers include components that handle test modification (e.g., DataPro per TestModificationEvent summary), UI viewers managing T0 cursor visibility/position, and modules handling isocode filter configuration.
    • The module is part of DTS.Common.Events, suggesting it is consumed by viewer and data processing layers (e.g., DTS.Viewer, DTS.DataPro).

5. Gotchas

  • Ambiguous naming: TestModificationChangedEvents summary says “The Data Folder changed event”, but its payload is ITestModificationModel, not a folder path. This appears to be a documentation error.
  • Constructor overloading ambiguity: ShiftT0EventArguments has two constructors that set different fields; callers must ensure correct constructor is used. Mixing usage (e.g., passing T0Time in the steps-based constructor) is prevented by design but may cause confusion if not documented externally.
  • No validation on payloads: Events carry raw data (e.g., string test IDs, double T0 times) without built-in validation—consumers must validate inputs.
  • IsKeyPress in ShiftT0EventArguments is only set in the relative-shift constructor: In the absolute-shift constructor, it is always false, which may be non-obvious.
  • Namespace consistency: // ReSharper disable CheckNamespace is present in some files but not others—suggests possible inconsistency in namespace usage across the codebase (though all events reside in DTS.Common.Events).
  • No versioning or deprecation markers: Events may evolve without explicit signaling (e.g., adding fields to TestModificationArgs could break subscribers).