17 KiB
17 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
2026-04-16T03:49:31.452209+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 1010e7b302783464 |
DataPROWin7 Module Documentation
1. Purpose
This module provides core infrastructure and UI framework components for the DataPROWin7 application, a Windows-based data acquisition and analysis system. It establishes foundational patterns for page navigation, search functionality, licensing display, and user permission management, while integrating with Prism-based modular architecture (via Unity container and region management). The module enables structured UI composition through interfaces like IPageContent and IActionButtonContainer, supports WPF-specific utilities (e.g., WaitCursor, TranslateExtension), and enforces permission-based visibility and enabled states for UI controls.
2. Public Interface
Interfaces
IActionButtonContainer
DataPROWin7.Controls.ActionButton[] GetActionButtons()
Returns all action buttons managed by the container.void OnActionButtonPress(DataPROWin7.Controls.ActionButton button)
Handles press events for action buttons.void OnActionComboBoxChange(DataPROWin7.Controls.ActionComboBox comboBox)
Handles selection change events for action combo boxes.void OnActionComboBoxDropDownClose(DataPROWin7.Controls.ActionComboBox comboBox)
Handles dropdown close events for action combo boxes.void OnActionRadioButtonPress(DataPROWin7.Controls.ActionRadioButton button)
Handles press events for action radio buttons.
IPageContent
void StartSearch(string term)
Initiates a search operation using the provided search term.bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)
Validates the page content; populateserrorsandwarningslists;displayWindowcontrols whether validation errors are shown in a UI dialog.void OnSetActive()
Called when the page becomes the active content (e.g., on navigation to the page).void SetPermissions(DTS.Slice.Users.User.UserPermissionLevels actualPermission, DTS.Slice.Users.User.UserPermissionLevels requiredPermission)
Configures UI state based on user permissions (e.g., enabling/disabling controls).void UnSet(Action OnComplete = null)
Cleans up resources allocated duringOnSetActive; optional callback after cleanup.bool OnButtonPress(Controls.PageButton button)
Handles presses of page-specific buttons; returnstrueif handled.object GetPageContent()
Returns the underlying content object (e.g., view model or data model).bool KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
Handles key press events; returnstrueif the event was handled.
Classes
WaitCursor
WaitCursor()
Sets the mouse cursor toCursors.Waitand stores the previous cursor. ImplementsIDisposable.void Dispose()
Restores the previously stored cursor.
BoolToOppositeBoolConverter
object Convert(object value, Type targetType, object parameter, CultureInfo culture)
Converts aboolto its logical opposite (!value). ThrowsInvalidOperationExceptioniftargetTypeis notbool.object ConvertBack(...)
ThrowsNotSupportedException.
TranslateExtension
TranslateExtension(string key)
Constructor storing the resource key.override object ProvideValue(IServiceProvider serviceProvider)
Retrieves localized string fromStringResources.ResourceManagerusing_key; returns"#stringnotfound#"or"#stringnotfound# <key>"if not found.
DataProSession
DataProSession()
Default constructor.void CreateSession()
Initializes Prism infrastructure (bootstrapper, container, event aggregator, region manager) using default config.void CreateSession(string customConfigPath)
Initializes Prism infrastructure using a custom configuration path.void Terminate()
Placeholder for shutdown logic (currently empty).IUnityContainer Container { get; }
Gets the Unity container after session creation.IEventAggregator EventAggregator { get; }
Gets the Prism event aggregator.IRegionManager RegionManager { get; }
Gets the Prism region manager.string CustomConfigPath { get; set; }
Gets/sets the custom configuration path used during session creation.
PageContentHeaderControl
bool UsesSearchControl { get; set; }
Controls visibility of search controls (searchTextBlock,searchTextBox). RaisesPropertyChangedfor"UsesSearchControl".bool UsesSelectControl { get; set; }
Controls visibility of select controls (selectTextBlock,selectComboBox). RaisesPropertyChangedfor"UsesSearchControl"(note: property name mismatch inSetPropertycall).
LicensingFooter
Color BackgroundColor { get; }
Gets the footer background color (fromBrushesAndColors.Brush_ApplicationLicensingFooterBackgroundifMainWindowisMainWindow).void OnSetActive()
Updates licensing info and triggersUpdateLicensingBar()asynchronously.string LicensedTo { get; set; }
Licensed entity name.string FooterMessage { get; set; }
Combined validation/license expiration messages.string LicenseType { get; set; }
License type string (e.g.,"Professional Edition").string DataProVersion { get; set; }
Version string (e.g.,"DataPRO 3.1.0 - ").
PageContentControl
object MainContent { get; set; }
Gets/sets the main content; on set, callsOnSetActive()on the content if it implementsIPageContent.Color ContentBackgroundColor { get; set; }
Background color; syncs toNavControlandMainContentControl.bool UsesNavControl { get; set; }
Controls visibility of navigation control (NavControl).bool IsInSetMainContentActive()
ReturnstrueifMainContentis currently being set/activated.ContentControl GetMainContentControl()
Returns the internalMainContentControl.virtual void UnSet()
CallsNavControl.UnSet()ifUsesNavControl.virtual bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)
Delegates validation toNavControlorMainContent(ifIPageContent).virtual void OnSetActive()
CallsNavControl.OnSetActive()ifUsesNavControl.
PageActionControlsRibbon
void SetGroups(PageActionControlsGroup[] groups)
Adds groups to the ribbon grid.void SetGroups(Controls.ActionRadioButton[] groups)
Adds radio button groups to the ribbon grid (stored separately in_newRadioButtons).Controls.ActionButton GetButton(string id)
Searches all groups for a button withUniqueId == id; throwsNullReferenceExceptionif not found.Controls.ActionButton[] GetButtons()
Returns all buttons from all groups.Controls.ActionLabel GetLabel(string id)
Searches all groups for a label withUniqueId == id; throwsNullReferenceExceptionif not found.Controls.ActionComboBox GetComboBox(string id)
Searches all groups for a combo box withUniqueId == id; throwsNullReferenceExceptionif not found.
PageSearchControl
void ClearSearchTerm()
Clears thesearchTextBox.Text.bool UsesSearchControl { get; set; }
Controls search visibility; raisesPropertyChangedfor"SearchVisibility".bool UsesSelectControl { get; set; }
Controls select control visibility.Visibility SearchVisibility { get; }
Computed visibility (VisibleifUsesSearchControl, elseCollapsed).int RaiseSearchDelay { get; set; }
Debounce delay (ms) for search events; if> 0, usesDispatcherTimer.event SearchDelegate OnSearch
Raised after search term changes (debounced ifRaiseSearchDelay > 0).
PageNavControlsGroup
UserPermissionLevels GetRequiredPermission()
Gets_requiredPermission.UserPermissionLevels GetDefaultRolePermission(DefaultRoles role)
Returns default permission per role (Read,Edit,Admin, etc.).void SetEnabled(bool bEnable)
Enables/disables control based on user permission vs._requiredPermission.bool GetDefaultRoleVisibility(DefaultRoles role)
Returns visibility per role based on_requiredPermission.string UniqueId { get; set; }
Unique identifier.string GetName()
ReturnsUniqueId.long GetID()/void SetID(long id)
Gets/sets_id.void SetVisible(bool bShow)
Sets visibility based onCurrentUser.IsShowTabFlagSet(this).int SetControls(UserControl[] controls, int startingRow)
Adds controls tonavControlGridsgrid; returns number of rows used.
PageMainContentControl
ContentControl GetContentControl()
Returns internalcontentControl.object MainContent { get; set; }
Gets/setscontentControl.Content.Color BackgroundColor { get; set; }
Background color.static void MarkWarning(Control tb)
SetsBorderBrushtoOrangeandBorderThicknessto2.0forNavStepcontrols.static void MarkInvalid(Control tb)
Applies error styles (e.g.,PageContentTextBoxErrorStyle) or sets red border for various control types.static void MarkInvalid(TextBlock tb)
SetsForegroundtoRed.static void MarkValid(Control tb)
Restores default styles for various control types.static void MarkValid(TextBlock tb)
SetsForegroundtoBlack.
NavGraphStep
string Title { get; }
Step title (read-only).string SerialNumber { set; }
SetssensorSerialNumber.Text; toggles visibility.string AxisUnit { set; }
SetsaxisUnit.Text; toggles visibility.Color GraphStepColor { get; set; }
Graph step background color.bool GraphChannel { get; set; }
Controls visibility ofGraphColorVisibility,TextVisibility, andPartitionVisibility.Visibility GraphColorVisibility { get; }
VisibleifGraphChannel, elseCollapsed.Visibility TextVisibility { get; set; }
Controls text visibility.Visibility PartitionVisibility { get; set; }
Controls partition visibility.IPageContent NavStepContent { get; set; }
Content associated with the step.void SetStatus(StatusTypes status)
Updates button/text colors based onStatusTypes.CurrentorNotCurrent.void SetCurrent()
Sets button background toLightGray.void SetInvalid()/void SetValid()
Placeholder methods (currently no-op).
Routed Events (PageActionButtonsRibbon)
FirstGroupFirstButtonClickedEvent,FirstGroupSecondButtonClickedEvent,FirstGroupThirdButtonClickedEventSecondGroupFirstButtonClickedEvent,SecondGroupSecondButtonClickedEvent,SecondGroupThirdButtonClickedEventThirdGroupThirdButtonClickedEvent,FourthGroupFirstButtonClickedEvent,FourthGroupSecondButtonClickedEvent,FourthGroupThirdButtonClickedEvent
3. Invariants
IPageContent.OnSetActive()must be called exactly once when a page becomes active, andIPageContent.UnSet()must be called before the page is deactivated or destroyed.WaitCursormust be used in ausingblock to ensure cursor restoration; no manualDispose()calls should be missed.TranslateExtensionalways returns a non-null string; missing keys are indicated by"#stringnotfound#"prefix.PageContentControl.MainContentsetter prevents re-entrancy via_bSettingMainContentActiveflag.PageNavControlsGroup.SetEnabled()respects user permissions: controls are disabled if user permission level <_requiredPermission.PageNavControlsGroup.SetVisible()respectsCurrentUser.IsShowTabFlagSet(this)whenbShowistrue.PageSearchControl.RaiseSearchDelaymust be>= 0; negative values are coerced to0.PageMainContentControl.MarkInvalid/MarkValidmethods must be called only on supported control types (e.g.,TextBox,ComboBox,ChannelCodeBuilder, etc.).NavGraphStep.GraphChannelaffects multiple computed properties (GraphColorVisibility,TextVisibility,PartitionVisibility); changes must be propagated viaSetProperty.
4. Dependencies
External Dependencies
- Prism (Unity):
Prism.Events,Prism.Regions,Prism.Ioc,Unity(used inDataProSession). - DTS.Slice.Users:
DTS.Slice.Users.User.UserPermissionLevels,DTS.Slice.Users.User.DefaultRoles,DTS.Slice.Users.IUIItems(used inPageNavControlsGroup). - DTS.Common:
DTS.Common.Controls,DTS.Common.SharedResource.Strings(used inLicensingFooter,TranslateExtension). - WPF Framework:
System.Windows,System.Windows.Input,System.Windows.Media,System.Windows.Controls,System.Windows.Threading. - C1.WPF:
C1.WPF(used inPageMainContentControlforC1NumericBox). - System.Configuration: Implicitly used via
Settingsclass (auto-generated).
Internal Dependencies
DataPROWin7.Controlsnamespace:ActionButton,ActionComboBox,ActionRadioButton,ActionLabel,PageButton,NavStep,ChannelCodeBuilder,ChannelNameBuilder,SupportedExcitationControl,DatePicker,C1NumericBox,ItemsControl,GroupBox,PageActionControlsGroup,PageActionButtonsGroup.DataPROWin7.Properties.Settings: Auto-generated settings class.Appclass: Used inLicensingFooter,PageNavControlsGroup,PageContentControlto accessCurrentUser,LicenseValidationResult,GetVersionString().BrushesAndColors: Used inLicensingFooter,NavGraphStepfor color resources.
Inferred Usage
DataProMainWindowinitializes withLoginControl2as initial content.PageContentControlandPageNavControlsGroupare used together for hierarchical navigation.PageSearchControlis integrated intoPageContentHeaderControlandPageContentControl.LicensingFooteris likely hosted in the main window's footer area.
5. Gotchas
PageContentHeaderControl.UsesSelectControlsetter: CallsSetProperty(..., "UsesSearchControl")instead of"UsesSelectControl"— likely a typo causing incorrectPropertyChangednotifications.PageActionControlsRibbon.SetGroups(ActionRadioButton[]): Stores radio button groups in_newRadioButtonsbut does not expose them via public methods (only_groupsis used inGetButtons,GetLabel,GetComboBox).PageActionButtonsRibbon: Button click handlers (FirstGroupFirstButton_Click, etc.) raise routed events but do not handle selection changes for combo boxes (handlers are empty).DataProSession.CreateBootstrapper(): Bootstrapper is created only once; re-creation is blocked. Attempting to re-initialize after termination may fail silently (returnsnull).WaitCursor: Does not handle multi-threading or nested usage; overlappingWaitCursorinstances may restore incorrect cursors.BoolToOppositeBoolConverter.ConvertBack: Always throwsNotSupportedException; not suitable for two-way bindings.PageContentControl.MainContentsetter: Skips setting if_bSettingMainContentActiveistrue, preventing re-entrancy but potentially ignoring updates during activation.NavGraphStep.SetInvalid()/SetValid(): Methods are empty stubs; no visual feedback for invalid states is implemented.LicensingFooter.UpdateLicensingBar(): RunsUpdateLicensingBar()on a background thread (Task.Run), but UI properties (LicensedTo,FooterMessage, etc.) are updated directly — may cause cross-thread exceptions if not thread-safe (thoughINotifyPropertyChangedis typically handled on UI thread in WPF).PageSearchControl.RaiseSearchDelay: IfRaiseSearchDelay == 0,_raiseSearchTimeris set tonulland not reused; repeated searches may recreate the timer unnecessarily.PageNavControlsGroup.SetControls: Row definitions are added dynamically; ifstartingRowis reused across calls, rows may overlap or misalign.PageContentControl.Validate: IfUsesNavControlisfalseandMainContentis notIPageContent, validation returnstruewithout validation.