Files
DP44/docs/ai/DataPRO/DataPRO/Controls.md
2026-04-17 14:55:32 -04:00

13 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
DataPRO/DataPRO/Controls/GridFullScreen.xaml.cs
DataPRO/DataPRO/Controls/CollectSelectControl.xaml.cs
DataPRO/DataPRO/Controls/EditChannelCodesControl.xaml.cs
DataPRO/DataPRO/Controls/UserListControl.cs
DataPRO/DataPRO/Controls/RealtimeFullScreen.xaml.cs
DataPRO/DataPRO/Controls/ViewGraphSelectControl.xaml.cs
DataPRO/DataPRO/Controls/StatusRibbon.xaml.cs
DataPRO/DataPRO/Controls/EditTestEngineerDetailsControl.xaml.cs
DataPRO/DataPRO/Controls/EditUserInfoControl.xaml.cs
2026-04-17T15:46:03.267118+00:00 zai-org/GLM-5-FP8 1 ebe4edb1e9d5ba50

DataPRO Controls Module Documentation

1. Purpose

This module contains WPF UserControls for the DataPRO application's UI layer, providing specialized controls for fullscreen display, test setup selection, channel code editing, user management, realtime chart display, graph selection, status feedback, and data entry forms. These controls implement the IPageContent interface for page lifecycle management and INotifyPropertyChanged for data binding, serving as the primary UI components within the application's page-based navigation system.


2. Public Interface

GridFullScreen

public partial class GridFullScreen : UserControl, INotifyPropertyChanged
  • GridFullScreen() - Initializes the control.
  • object MyFullscreenObject - Gets/sets the content displayed in fullscreen mode.
  • event PropertyChangedEventHandler PropertyChanged - Property change notification.
  • void closeButton_Click(object sender, RoutedEventArgs e) - Closes fullscreen and navigates to previous page via MainWindow.GoToPreviousPage().

CollectSelectControl

public partial class CollectSelectControl : UserControl, IPageContent, INotifyPropertyChanged
  • CollectSelectControl() - Initializes the control.
  • bool Validate() - Returns true (no validation logic implemented).
  • void IPageContent.OnSetActive() - Empty implementation.
  • object GetPageContent() - Loads test setups from database table [tblTestSetups] on first call; returns this.
  • bool NextStepButtonFocus - Property for button focus state.
  • bool NextStepFocusLost - Property for focus lost state.

TestSetupInfo class:

public class TestSetupInfo
{
    public string TestSetupName { get; set; }
    public string Description { get; set; }
    public string SamplesPerSecond { get; set; }
    public DataModel.TestTemplate.RecordingModes Mode { get; set; }
}

EditChannelCodesControl

public partial class EditChannelCodesControl : UserControl, IPageContent, INotifyPropertyChanged
  • const string MY_ID = "Prepare_AdditionalDetails_Page_ChannelCodeDetails" - Page identifier constant.
  • EditChannelCodesControl() - Initializes the control.
  • bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow) - Delegates to _vm.Validate(displayWindow).
  • void OnSetActive() - Initializes ViewModels and activates the channel codes list.
  • object GetPageContent() - Returns this.
  • void Delete() - Deletes selected channel codes with confirmation dialog.
  • void Save() - Saves changes via _vm.Save().
  • void Reset() - Empty implementation.
  • DataPROPage Page - Sets the parent page reference.

UserListControl

public class UserListControl : GenericTable2
  • UserListControl(ContentControl parentControl, DataPROPage page) - Initializes with multi-row selection mode and creates columns.
  • void UpdateList() - Clears and repopulates the user list from UserCollection.GetAllUsers(), applying filters from App.FilterUsers().
  • User SelectedUser - Gets/sets the currently selected user.
  • User[] SelectedUsers - Gets/sets the currently selected users (multi-select).

TableColumns enum:

public enum TableColumns
{
    DisplayName, UserName, Role, LastModified, LastModifiedBy, DatabaseId
}

RealtimeFullScreen

public partial class RealtimeFullScreen : UserControl, INotifyPropertyChanged
  • RealtimeFullScreen() - Initializes the control.
  • void OnSetActive(RealtimeChart myChart) - Sets the active chart for display.
  • RealtimeChart MyChart - Gets/sets the displayed chart.
  • RunTestBase RTB - Gets/sets the run test base reference.
  • SubControls.Realtime RealtimePage - Sets the realtime page reference.
  • void EnableRealtimePrevious(bool bEnable) - Enables/disables back button.
  • void EnableRealtimeNext(bool bEnable) - Enables/disables next button.
  • Visibility BackButtonVisibility / NextButtonVisibility - Controls button visibility.
  • bool HasBackButton / HasNextButton - Controls button presence.

ViewGraphSelectControlDelete

public partial class ViewGraphSelectControlDelete : UserControl, IPageContent, INotifyPropertyChanged
  • ViewGraphSelectControlDelete() - Initializes with empty TestInfo array.
  • bool Validate() - Returns true.
  • void IPageContent.OnSetActive() - Empty implementation.
  • object GetPageContent() - Returns this (most logic commented out).
  • TestInfo[] FileNameList - Gets/sets the list of test files.
  • DataModel.TestTemplate SelectedTest - Gets/sets selected test.
  • bool BrowseFocusLost - Focus tracking property.
  • string TestItemLongString - Test item identifier string.

StatusRibbon

public partial class StatusRibbon : UserControl, INotifyPropertyChanged
  • StatusRibbon() - Initializes the control.
  • string Prepend - Dependency property for status text resource lookup prefix.
  • string Status - Sets status text (triggers resource lookup via Prepend_Status).
  • string AggregateStatusText - Gets the resolved status text.
  • int ProgressBarValue - Gets/sets progress bar value (0-100).
  • Visibility ProgressBarVisibility - Gets/sets progress bar visibility.
  • Color AggregateStatusColor - Gets/sets the ribbon background color.
  • SolidColorBrush TextColor - Gets/sets the text color.
  • void SetProgressValue(int value) - Thread-safe progress setter; normalizes values to 0-100.
  • void SetProgressBarVisibility(Visibility v) - Thread-safe visibility setter.
  • void SetStatusTextNoTranslate(string s) - Sets status text directly without resource lookup.
  • void SetAggregateStatusColor(Color c) - Thread-safe color setter.
  • void SetAlert(bool set) - Thread-safe alert mode toggle; changes text color and alert visibility.

EditTestEngineerDetailsControl

public partial class EditTestEngineerDetailsControl : UserControl, IPageContent, INotifyPropertyChanged
  • EditTestEngineerDetailsControl() - Initializes the control.
  • bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow) - Validates engineer names for blanks and duplicates.
  • void OnSetActive() - Loads engineers from DataModel.TestEngineerDetailsList.TestEngineerList.TestEngineers.
  • object GetPageContent() - Returns this.
  • void Save() - Persists changes to TestEngineerDetailsList.
  • void Delete() - Deletes selected engineers with confirmation dialog.
  • void Reset() - Empty implementation.
  • DataPROPage Page - Sets the parent page reference.
  • DataModel.TestEngineerDetails[] TestEngineers - Gets/sets the engineer list.
  • ObservableCollection<DataModel.TestEngineerDetails> SelectedEngineerItems - Selected items collection.

EditUserInfoControl

public partial class EditUserInfoControl : IPageContent, INotifyPropertyChanged
  • EditUserInfoControl() - Initializes the control.
  • bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow) - Validates display name, role selection, and username uniqueness (for new users).
  • void OnSetActive() - Triggers property change notifications for all Tags enum values.
  • object GetPageContent() - Returns this.
  • void Reset() - Clears validation markers on all input fields.
  • User CurrentUser - Gets/sets the user being edited.
  • bool IsAdd - Indicates if this is a new user creation.
  • bool IsNotDefaultUser - Returns true if user is not a default system user.
  • string UserName - Gets/sets the username.
  • string DisplayName - Gets/sets the display name.
  • int UserRoleIndex - Gets/sets the role index.
  • UserRoleData[] UserRoles - Gets available roles.
  • bool LocalOnly - Gets/sets local-only flag.
  • string LastModified / LastModifiedBy - Gets modification metadata.
  • string UserTags - Gets/sets comma-separated user tags.

UserRoleData nested class:

public class UserRoleData
{
    public User.DefaultRoles Role { get; }
    public override string ToString() // Returns localized role name
}

3. Invariants

  • IPageContent contract: All controls implementing IPageContent must provide Validate(), OnSetActive(), GetPageContent(), Reset(), and UnSet() methods.
  • Property change notification: All INotifyPropertyChanged implementations use the SetProperty<T> pattern that returns false if the value equals the current value (no change).
  • Thread affinity: WPF controls require UI thread access; StatusRibbon provides explicit thread-safe methods (SetProgressValue, SetProgressBarVisibility, SetAggregateStatusColor, SetAlert) that use Dispatcher.CheckAccess() and Dispatcher.BeginInvoke().
  • DatabaseId column visibility: In UserListControl, the DatabaseId column is always Visibility.Collapsed and is used internally to distinguish duplicate default user names.
  • Password sentinel: EditUserInfoControl uses UNCHANGED_SENTINEL = "***THISHASNTCHANGED***" to detect if password fields were modified.
  • Blank engineer record: EditTestEngineerDetailsControl always maintains a blank TestEngineerDetails at the end of the list for new entries.
  • Progress bar range: StatusRibbon.SetProgressValue() normalizes values to 0-100 range.

4. Dependencies

External Dependencies (from imports):

  • WPF assemblies: System.Windows.* (Controls, Data, Input, Media, Navigation, Shapes)
  • Prism framework: Prism.Events, Prism.Ioc (used in EditChannelCodesControl)
  • Unity container: Unity (used in EditChannelCodesControl)
  • C1.WPF.DataGrid: ComponentOne DataGrid (used in UserListControl for DataGridSelectionMode.MultiRow)
  • C1.WPF.FlexGrid: ComponentOne FlexGrid (used in ViewGraphSelectControlDelete)

Internal Dependencies:

  • DTS.Storage.DbOperations - Database operations (CollectSelectControl)
  • DTS.Common.Interface.Channels.ChannelCodes - Channel code interfaces (EditChannelCodesControl)
  • DTS.Common.SharedResource.Strings - Localized string resources (EditChannelCodesControl, StatusRibbon, EditTestEngineerDetailsControl, EditUserInfoControl)
  • DTS.Common.Utilities.Logging - Logging via APILogger (UserListControl)
  • DTS.Slice.Users - User management types (UserListControl, EditUserInfoControl)
  • DTS.Common.Storage - Storage operations (EditUserInfoControl)
  • DTS.Common.Events - Prism events (EditTestEngineerDetailsControl)
  • DTS.Common.ISO - ISO data types (EditTestEngineerDetailsControl)
  • DataModel namespace - Data model types (TestSetupInfo, TestEngineerDetails, TestTemplate)
  • MainWindow - Main application window for navigation
  • App - Application class for message boxes and user filtering
  • GenericTable2 - Base class for UserListControl
  • RunTestBase, RealtimeChart - Realtime testing components
  • DataPROPage, IPageContent, PageButton - Page framework types

Consumers:

  • MainWindow - Calls GoToPreviousPage(), RemoveFullScreenPlotInfo(), GoToSmallScreenRealtime()
  • App - Provides DoMessageBox(), FilterUsers(), GetAllIUIItems()

5. Gotchas

  1. Class naming inconsistency: ViewGraphSelectControlDelete has "Delete" in the class name but appears to be a functional control, not a deleted/deprecated one. The filename is ViewGraphSelectControl.xaml.cs.

  2. Commented-out code: ViewGraphSelectControlDelete.GetPageContent() contains extensive commented-out logic that may represent incomplete refactoring or dead code paths.

  3. Hardcoded SQL: CollectSelectControl uses a raw SQL string "SELECT * from [tblTestSetups]" without parameterization.

  4. Refresh flag pattern: CollectSelectControl uses a bool refreshing = true field that is set to false after first load and never reset, meaning GetPageContent() only loads data once per control instance.

  5. Null-conditional navigation: RealtimeFullScreen.closeButton_Click() uses both (Application.Current.MainWindow as MainWindow)?.RemoveFullScreenPlotInfo() and ((MainWindow)Application.Current.MainWindow)?.GoToSmallScreenRealtime() - mixing null-conditional with cast patterns.

  6. Password sentinel exposure: The UNCHANGED_SENTINEL constant value "***THISHASNTCHANGED***" is visible in source; if users type this exact string as a password, behavior is undefined.

  7. Thread-safety inconsistency: Only StatusRibbon provides thread-safe wrappers; other controls with INotifyPropertyChanged do not appear to handle cross-thread property changes.

  8. Validation stubs: CollectSelectControl.Validate() and ViewGraphSelectControlDelete.Validate() always return true without performing validation.

  9. Implicit dependencies on Application.Current: Multiple controls cast Application.Current.MainWindow to MainWindow and Application.Current to App, creating tight coupling to the specific application instance.