Skip to content

Add back button #528#529

Open
chlaplan wants to merge 10 commits into
MicrosoftDocs:mainfrom
chlaplan:Add-back-button-#528
Open

Add back button #528#529
chlaplan wants to merge 10 commits into
MicrosoftDocs:mainfrom
chlaplan:Add-back-button-#528

Conversation

@chlaplan
Copy link
Copy Markdown
Contributor

@chlaplan chlaplan commented Jun 4, 2026

#528

This pull request introduces a "Back" button to the application's workflow navigation, allowing users to return to the previous step in the wizard. The implementation includes UI updates, event handling, and logic to manage the button's visibility and behavior, ensuring a consistent and user-friendly experience.

Navigation Enhancements:

  • Added a new button_Back to the form, including its initialization, properties, and addition to the controls collection in MainForm.Designer.cs. [1] [2] [3] [4]
  • Implemented the Button_Back_Click handler to navigate to the previous page, handle custom rule abandonment, clear error state, and manage page transitions without rebuilding.
  • Provided an UpdateBackButtonVisibility method to show or hide the Back button based on the current workflow state, and called it in relevant places such as after navigation and in the control panel display logic. [1] [2] [3]

UI Consistency:

  • Updated the SetNextButtonUI method to apply consistent styling to the new Back button for both dark and light modes, matching the appearance of the Next button. [1] [2]

Workflow Behavior Adjustments:

  • Ensured that both the Next and Back buttons are hidden when navigating to the Home or Settings pages, maintaining appropriate navigation options for the user. [1] [2]

chlaplan and others added 10 commits May 4, 2026 17:44
• FolderHashScanForm.cs — New dialog for folder-based hash file scanning with browse, subfolder toggle, file checklist, and hash type selection
Modified Files
CustomRuleConditionsPanel.cs
• Added hash mode panel with Single File, Multiple Files radio buttons and Folder Scan... button
• "Folder Scan..." button directly opens FolderHashScanForm dialog
• Multi-file and folder scan modes batch files into a single FolderScan-type rule using New-CIPolicy -ScanPath (instead of one PowerShell call per file)
• Selected files are copied to a temp folder preserving subfolder structure from the source
• Stores SourceFolderPath and HashTypesToKeep on the rule for downstream processing
FolderHashScanForm.cs
• Browse folder with optional Include subfolders checkbox
• Scan Folder button enumerates files by common PE/script extensions
• Select All / Deselect All for the file checklist
• Hash type checkboxes: Hash SHA1, Hash SHA256, Hash Page SHA1, Hash Page SHA256, and All (toggle)
• Exposes SelectedFiles, SelectedHashTypes, SourceFolderPath, IncludeSubfolders, AllFilesSelected
• Dark mode support
SigningRules_Control.cs
• Added AddRuleToTableWithoutClosing() method to support batch rule insertion without closing the custom rules panel
Policy.cs (PolicyCustomRules class)
• Added HashTypesToKeep property (HashSet<string>) — hash types to retain when filtering generated policy XML
• Added SourceFolderPath property (string) — original folder path for FriendlyName correction
MainForm.cs
• Added using System.Linq
• FriendlyName fix: after scan, replaces temp folder path in each rule's FriendlyName with the original source folder path (preserving subfolders)
• Hash type filtering: removes unwanted hash types (Hash SHA1, Hash Page SHA256, etc.) from generated policy based on user's checkbox selections
• Progress bar improvements:
• ProcessCustomValueRules(BackgroundWorker, SiPolicy) now reports incremental progress 0–25% per rule
• ProcessSignerRules(BackgroundWorker, SiPolicy) shows "Processing rule X of Y ..." with accurate counts
• FolderScan shows phased status: "Scanning folder: ...", "Scan complete. Applying hash type filters ...", "Filtered: kept X of Y hash rules.", "Merging scanned policy rules ..."
• ProgressChanged handler respects custom UserState messages
This reverts commit 162dd88.
• Added -NoLogo -NonInteractive flags to PowerShell invocation to reduce startup overhead
• Fixed potential deadlock: moved StandardOutput.ReadToEnd() and StandardError.ReadToEnd() before WaitForExit() to prevent buffer-full hang

MainForm.cs
• Fixed progress bar stalling at 25% during Folder Scan by reporting progress after skipping non-applicable rules
• Added mid-scan progress report (~55%) before CreateScannedPolicyFromPS(PolicyCustomRules, string, string) so UI shows activity during long scans
• Updated progress status text: "Scanning and processing rules (this may take a few minutes) ..." for the 25-80% range
• No-ops on the home page or first workflow page.
• Confirms abandoning an in-progress custom rule.
• Clears ErrorOnPage/ErrorMsg, decrements CurrentPage, re-shows the Next button (in case the previous page hid it, e.g. build page), and re-runs PageController so the existing user control is brought back to front (existing pages are reused via PageList, so user state on those pages is preserved).
• Added UpdateBackButtonVisibility() that shows the Back button only when Next is visible and CurrentPage > 1. Called at the end of ShowControlPanel so visibility is updated on every navigation.
• Added button_Back to Controls and brought it to front inside ShowControlPanel.
• Hid button_Back when Home_Button_Click and Settings_Button_Click hide button_Next.
• Extended SetNextButtonUI() to apply matching dark/light styling to button_Back.
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