Files

43 lines
2.7 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- DataPRO/SLICEDBMerge/SLICEDBMerge/Program.cs
- DataPRO/SLICEDBMerge/SLICEDBMerge/Form1.cs
- DataPRO/SLICEDBMerge/SLICEDBMerge/Form1.Designer.cs
generated_at: "2026-04-17T15:54:57.534205+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "ed616bd81c400b4e"
---
# SLICEDBMerge Module Documentation
## 1. Purpose
SLICEDBMerge is a Windows Forms desktop application that provides a GUI for merging sensor databases. It allows users to select a source sensor database directory and a destination database directory, view the sensors in each, select specific sensors from the source, and merge them (along with their calibration data) into the destination database. The application is built using ComponentOne's C1FlexGrid for data display and depends on a proprietary `DTS.SensorDB` library for sensor database operations.
## 2. Public Interface
### `Program` class (static)
- **`void Main()`** - Application entry point. Configures visual styles and launches `Form1`.
### `Form1` class (public partial, inherits from `Form`)
#### Public Methods
- **`Form1()`** - Constructor. Calls `InitializeComponent()` to set up UI components.
#### Private Fields
- **`DTS.SensorDB.SensorDBTables _sourceDB`** - Holds the loaded source sensor database.
- **`DTS.SensorDB.SensorDBTables _destination`** - Holds the loaded destination sensor database.
#### Event Handlers
- **`void btnBrowse_Click(object sender, EventArgs e)`** - Opens a `FolderBrowserDialog` to select the source directory. On success, populates `tbSourceLocation.Text` and calls `LoadSourceDG()`.
- **`void btnDestinationBrowse_Click(object sender, EventArgs e)`** - Opens a `FolderBrowserDialog` to select the destination directory. On success, populates `tbDestination.Text` and calls `LoadDestinationDG()`.
- **`void button1_Click(object sender, EventArgs e)`** - Executes the merge operation. Iterates through `dgSource` rows, and for each selected row (where column index 1 is `true`), adds the `SensorData` to `_destination`, saves, retrieves the latest calibration via `_sourceDB.GetLatestCalibrationBySerialNumber()`, adds the calibration, and saves again. Collects errors and displays them in a message box. Refreshes the destination grid upon completion.
- **`void lbSelectAll_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)`** - Sets column index 1 to `true` for all rows in `dgSource` (starting at index 1).
- **`void lbInvertSelection_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)`** - Toggles the boolean value at column index 1 for all rows in `dgSource` (starting at index 1).
- **`void lbClearAll_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)`** - Sets column index