Skip to content

feat(stage-1): retire WinForms SimulateForm/Control and WelcomeForm#7

Merged
michaldengusiak merged 2 commits into
sow/2026-Q2from
sam-ui/retire-winforms-stage-1
May 21, 2026
Merged

feat(stage-1): retire WinForms SimulateForm/Control and WelcomeForm#7
michaldengusiak merged 2 commits into
sow/2026-Q2from
sam-ui/retire-winforms-stage-1

Conversation

@michaldengusiak
Copy link
Copy Markdown

Summary

Stage 1 of the WinForms → WPF migration in SAM_UI. After this PR, only SAM.Core.Mollier.UI remains on WinForms.

  • Delete unused WelcomeForm from SAM.Core.UI (no references anywhere)
  • Delete SimulateForm + SimulateControl (WinForms) from SAM.Analytical.UI — WPF twin already exists and is more complete
  • Move HooverTimer from SAM.Core.UISAM.Core.Mollier.UI (only user); detected as rename by git
  • Drop RibbonWinForms 5.1.0-beta NuGet from SAM.Analytical.UI (ribbon lives in WPF AnalyticalWindow.xaml)
  • Remove UseWindowsForms=true from SAM.Core.UI.csproj; add explicit System.Drawing.Common 7.0.0
  • Migrate UIJSAMObject dialogs → System.Windows.MessageBox + Microsoft.Win32.SaveFileDialog
  • Add UpdateConstructionLayersByPanelType checkbox to WPF SimulateControl (was missing vs WinForms version)
  • Wire WPF Modify/Simulate.cs second overload to use WPF SimulateWindow + WindowInteropHelper

Coordinated PR: SAM_Revit_UI sam-revit-ui/wpf-simulate-elementhost must be merged after this one.

Test plan

  • dotnet build succeeds with 0 errors
  • SAM Analytical WPF window opens; Simulate dialog works end-to-end
  • No UseWindowsForms in SAM.Core.UI.csproj after merge
  • SPDX headers on all changed .cs files

🤖 Generated with Claude Code

….UI to WPF dialogs

- Delete WelcomeForm (unused), SimulateForm + SimulateControl (WinForms)
- Move HooverTimer from SAM.Core.UI to SAM.Core.Mollier.UI (only used there)
- Drop RibbonWinForms NuGet from SAM.Analytical.UI.csproj
- Remove UseWindowsForms from SAM.Core.UI.csproj; add System.Drawing.Common 7.0.0
- Migrate UIJSAMObject dialogs to WPF MessageBox + Microsoft.Win32.SaveFileDialog
- Add UpdateConstructionLayersByPanelType checkbox to WPF SimulateControl
- Wire WPF Modify/Simulate.cs second overload to WPF SimulateWindow + WindowInteropHelper

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 350cd5a6cb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +406 to +407
projectName = simulateWindow_Path.ProjectName;
outputDirectory = simulateWindow_Path.OutputDirectory;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reinstate output/project validation before starting simulation

This overload now accepts ProjectName and OutputDirectory directly from SimulateWindow without validating them, while the removed WinForms SimulateForm previously blocked empty project names and non-existent output directories before returning OK. In the EnergySimulation path (which calls this overload), users can now proceed with invalid values and trigger writes to an unintended working directory or downstream conversion failures when creating the TBD file.

Useful? React with 👍 / 👎.


<CheckBox x:Name="checkBox_CreatePartL" Content="Create Part L" HorizontalAlignment="Left" Margin="30,450,0,0" VerticalAlignment="Top"/>

<CheckBox x:Name="checkBox_UpdateConstructionLayersByPanelType" Content="Update Construction Layers By Panel Type" HorizontalAlignment="Left" Margin="30,473,0,0" VerticalAlignment="Top" IsChecked="True"/>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Wire the new construction-layer checkbox into main flow

The new Update Construction Layers By Panel Type checkbox is now visible in the shared WPF simulate UI, but the primary Simulate(this UIAnalyticalModel) path still hardcodes updateConstructionLayersByPanelType = true and never reads this control. That makes user input ineffective in the main workflow and creates inconsistent behavior versus the newly updated secondary overload.

Useful? React with 👍 / 👎.

- Add SPDX header to MollierControl.cs (fixes SPDX CI failure)
- Primary Simulate(UIAnalyticalModel) overload: read UpdateConstructionLayersByPanelType
  from SimulateWindow instead of hardcoding true
- Second Simulate(AnalyticalModel, path) overload: add projectName and outputDirectory
  validation guards before starting simulation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5e7012fba5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +391 to +394
SimulateWindow simulateWindow_Path = new SimulateWindow();
simulateWindow_Path.ProjectName = System.IO.Path.GetFileNameWithoutExtension(path);
simulateWindow_Path.OutputDirectory = System.IO.Path.GetDirectoryName(path);
simulateWindow_Path.WeatherData = weatherData;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Initialize migrated dialog defaults before running simulation

This overload now opens SimulateWindow without setting legacy defaults beyond path/weather, so accepting the dialog can silently change simulation behavior compared with the removed WinForms flow. In particular, the previous SimulateForm defaulted Sizing to enabled, while the WPF control starts unchecked unless explicitly set; this can disable sizing runs and alter produced results for the same input model when users just click OK.

Useful? React with 👍 / 👎.

Comment on lines +221 to +225
public bool UpdateConstructionLayersByPanelType
{
get
{
return checkBox_UpdateConstructionLayersByPanelType.IsChecked != null && checkBox_UpdateConstructionLayersByPanelType.IsChecked.HasValue && checkBox_UpdateConstructionLayersByPanelType.IsChecked.Value;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Persist the new construction-layer toggle in saved options

The new UpdateConstructionLayersByPanelType UI option is exposed and read during simulation, but it is not included in the SimulateOptions round-trip used by ActiveSetting (the control still serializes/deserializes the older option set). As a result, users who change this checkbox lose their choice the next time the dialog opens, which can re-enable layer updates unexpectedly.

Useful? React with 👍 / 👎.

@michaldengusiak michaldengusiak merged commit b6411c0 into sow/2026-Q2 May 21, 2026
2 checks passed
@michaldengusiak michaldengusiak deleted the sam-ui/retire-winforms-stage-1 branch May 21, 2026 14:36
michaldengusiak added a commit that referenced this pull request May 21, 2026
- Path-based Simulate overload now sets Sizing=true and
  UpdateConstructionLayersByPanelType=true on the new WPF SimulateWindow,
  matching the WinForms SimulateForm defaults that were lost during the
  WinForms → WPF swap. Prevents silent regression where clicking OK
  without touching the Sizing checkbox would skip sizing.

- Persist UpdateConstructionLayersByPanelType through SimulateOptions:
  added property (default true), copy constructor entry, JSON read/write,
  and the SimulateControl.GetSimulateOptions/SetSimulateOptions round-trip.
  Users' checkbox state now survives ActiveSetting save/restore.

Codex findings on PR #7 (already merged): P1 Sizing default regression
and P2 UpdateConstructionLayersByPanelType persistence.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant