Development snapshot 2026-10-25 (4.0.0-beta1 + fixes)

This commit is contained in:
Mikael Karlsson
2026-10-25 20:04:55 +11:00
parent 7869619510
commit 325e3a6b12
88 changed files with 21308 additions and 1081 deletions
+75 -17
View File
@@ -328,10 +328,26 @@ public class AppUserModelHelper {
}
catch { }
# Setting HideConsoleWindow: hide the console once the window is up.
if((Get-SettingValue "HideConsoleWindow") -eq $true -and (Test-ConsoleWindowSupported))
{
$script:window.Add_ContentRendered({
[void](Hide-ConsoleWindow)
Update-ConsoleWindowMenu
})
}
$script:window.ShowDialog() | Out-Null
}
}
# The menu item names what a click will do, so it follows the console state.
function Update-ConsoleWindowMenu
{
$header = if(Get-ConsoleWindowVisible) { "_Hide console" } else { "_Show console" }
$script:UIProvider.SetXamlProperty($script:window, "mnuToggleConsole", "Header", $header)
}
function Get-LogViewPanel
{
$viewPanel = $script:UIProvider.GetXamlObject(($script:AppUIRootFolder + "\Xaml\LogInfo.xaml"))
@@ -974,6 +990,20 @@ public class TaskbarIconKeeper {
$script:UIProvider.AddXamlEvent($script:window, "mnuTenantSettings", "Add_Click", { Show-SettingsForm -Tenant })
$script:UIProvider.AddXamlEvent($script:window, "mnuUpdates", "Add_Click", { Show-UpdatesDialog })
$script:UIProvider.AddXamlEvent($script:window, "mnuAbout", "Add_Click", { Show-AboutDialog })
# File > Hide console / Show console. Windows, classic console host only
# (Internal/ConsoleWindow.ps1); where it cannot work the item is not shown.
if(Test-ConsoleWindowSupported)
{
$script:UIProvider.AddXamlEvent($script:window, "mnuToggleConsole", "Add_Click", {
[void](Switch-ConsoleWindow)
Update-ConsoleWindowMenu
})
Update-ConsoleWindowMenu
}
else
{
$script:UIProvider.SetXamlProperty($script:window, "mnuToggleConsole", "Visibility", "Collapsed")
}
$script:UIProvider.AddXamlEvent($script:window, "mnuExit", "Add_Click", {
if([System.Windows.MessageBox]::Show("Are you sure you want to exit?", "Exit?", "YesNo", "Question") -eq "Yes")
{
@@ -1003,7 +1033,10 @@ public class TaskbarIconKeeper {
$script:window.Add_Closed({
$grdViewPanel = $script:window.FindName("grdViewPanel")
$grdViewPanel.Children.Clear()
})
# Give the console back on exit: Start.cmd ends in `pause`, which would
# otherwise wait for a key in a window nobody can see.
if((Test-ConsoleWindowSupported) -and -not (Get-ConsoleWindowVisible)) { [void](Show-ConsoleWindow) }
})
$script:window.add_Loaded({
$script:SplashScreen.Hide()
@@ -1793,6 +1826,8 @@ function Show-AboutDialog
}
$script:UIProvider.SetXamlProperty($script:dlgAbout, "txtTitle", "Text", "Intune Management")
# From the manifest (Internal/AppInfo.ps1), not the XAML - see the comment there.
$script:UIProvider.SetXamlProperty($script:dlgAbout, "txtCopyright", "Text", (Get-AppCopyright))
$script:UIProvider.SetXamlProperty($script:dlgAbout, "txtViewTitle", "Text", ("Current view: " + $script:ActiveView.Title))
if($script:ActiveView.Description)
{
@@ -1825,23 +1860,48 @@ function Show-UpdatesDialog
}
else {
$fileContent = [IO.File]::ReadAllText($localReleaseNotes)
try
{
$tmp = $fileContent.Replace("`r`n","`n")
$mystring = ("blob $($tmp.Length)`0" + $tmp)
$mystream = [IO.MemoryStream]::new([byte[]][char[]]$mystring)
$curHash = Get-FileHash -InputStream $mystream -Algorithm SHA1
}
finally
{
if($mystream) { $mystream.Dispose() }
}
# One implementation of the git blob sha, in Internal/AppUpdateCheck.ps1, shared
# with the raw fallback that has to compute the published sha itself. The copy
# that used to live here counted CHARACTERS for the length prefix and cast
# chars to bytes, so a single non-ASCII character in the notes produced a sha
# GitHub never reports and the two copies always read as different.
$curHash = [PSCustomObject]@{ Hash = Get-AppGitBlobSha $fileContent }
}
# Fetch via Internal/AppUpdateCheck.ps1 so both backends share one
# implementation (R10). Sha is the blob hash used below to decide whether the
# published notes differ from the local copy.
$content = Get-AppRemoteReleaseNotes
# The local notes are rendered whenever the file exists, independently of what
# GitHub returned. They used to be written only on the "remote OK but the shas
# differ" path, so any other outcome - notably a failed fetch - left the Local
# tab visible (it has no Visibility in the XAML, so it defaults to Visible) and
# completely empty.
if($fileContent)
{
Set-WpfMarkdownText $script:dlgUpdates.FindName("txtReleaseNotesLocal") $fileContent
}
if(-not $content)
{
# Say why, in the dialog. Get-AppRemoteReleaseNotes has already logged it, but
# a reader looking at an empty Release Notes tab has no reason to go to the log
# - and "unreachable" is the wrong conclusion when the real answer is a shared
# API rate limit that resets in an hour.
$reason = Get-AppUpdateLastError
$message = if($reason) { "Could not read the published release notes.`n`n$reason" }
else { "Could not read the published release notes. See the log for details." }
Set-WpfMarkdownText $script:dlgUpdates.FindName("txtReleaseNotes") $message
# Nothing to compare against, so neither verdict applies. Keep the local tab
# only when there is something in it.
$script:UIProvider.SetXamlProperty($script:dlgUpdates, "txtReleaseNotesMatch", "Visibility", "Collapsed")
$script:UIProvider.SetXamlProperty($script:dlgUpdates, "txtReleaseNotesNoMatch", "Visibility", "Collapsed")
$visibility = if($fileContent) { "Visible" } else { "Collapsed" }
$script:UIProvider.SetXamlProperty($script:dlgUpdates, "tabLocalReleaseNotes", "Visibility", $visibility)
}
if($content)
{
# Rendered rather than dumped as raw text: Set-WpfMarkdownText turns the
@@ -1861,12 +1921,10 @@ function Show-UpdatesDialog
}
elseif($content.sha -ne $curHash.Hash)
{
# ReleaseNotes.md not matching - show the local copy alongside.
# This used to write $fileContent into txtReleaseNotes, overwriting the
# GitHub notes with the local ones while the Local tab it had just made
# visible stayed empty. The local text belongs in txtReleaseNotesLocal.
# ReleaseNotes.md not matching - show the local copy alongside. The text
# itself is rendered once, above, for every outcome; this only decides
# that the tab is worth showing.
$script:UIProvider.SetXamlProperty($script:dlgUpdates, "tabLocalReleaseNotes", "Visibility", "Visible")
Set-WpfMarkdownText $script:dlgUpdates.FindName("txtReleaseNotesLocal") $fileContent
$script:UIProvider.SetXamlProperty($script:dlgUpdates, "txtReleaseNotesMatch", "Visibility", "Collapsed")
}
else
@@ -118,7 +118,18 @@ function Show-GraphBulkImportForm
-ImportType $importType
$unknownNote = Get-IntuneUnknownSelectorSummary $summary.UnknownSelectors
if($summary.Imported -eq 0)
$approvalNote = Get-MSGraphApprovalPendingSummary $summary.PendingApproval
if($approvalNote)
{
# Held writes are queued, not failed - "no objects were imported,
# verify the folder" would send the user looking for a non-problem.
$msg = $approvalNote
if($summary.Imported -gt 0) { $msg = "Imported $($summary.Imported) object(s).`n`n$msg" }
if($unknownNote) { $msg += "`n`n$unknownNote" }
$script:UIProvider.ShowMessageBox($msg, "Import", "OK", "Information") | Out-Null
if($summary.Imported -gt 0) { Invoke-IntuneActivateObject $script:IntuneManagerSelectedObject | Out-Null }
}
elseif($summary.Imported -eq 0)
{
$msg = "No objects were imported.`nVerify the import folder and exported files."
if($unknownNote) { $msg += "`n`n$unknownNote" }
+33 -2
View File
@@ -8,7 +8,8 @@ function Update-IntuneImportMatchInfo
$importType = $script:importForm.DataContext.ImportType
$sameTenant = $script:importForm.DataContext.SameTenant
$existingPolicies = @($script:dgIntuneManagerObjects.ItemsSource)
$files = @($script:DGObjectsToImport.ItemsSource | ForEach-Object { if($_) { $_.Object } })
$existingPolicies = Get-IntuneManagerImportExistingPolicies -ImportPolicies $files -ImportType $importType -SameTenant $sameTenant
foreach($item in @($script:DGObjectsToImport.ItemsSource)) {
if(-not $item -or -not $item.Object) { continue }
@@ -23,8 +24,36 @@ function Update-IntuneImportMatchInfo
try { $script:DGObjectsToImport.Items.Refresh() } catch { }
}
function Get-IntuneManagerImportExistingPolicies
{
# Candidates for the skip / update / replace match (#384). Two things hid
# existing objects from it: pages the view had not loaded yet, and the filter
# box - the grid binds a CollectionView, which only enumerates the rows it
# shows. So: the unfiltered backing collection, plus whatever
# Get-IntuneImportCandidates (Internal/IntuneManager.ps1) finds in Graph for
# these files. It never loads every page. Cached for the dialog: the import
# type changing does not change what exists.
param($ImportPolicies, [string]$ImportType, [bool]$SameTenant)
$source = $script:dgIntuneManagerObjects.ItemsSource
if($source -is [System.Windows.Data.CollectionView]) { $source = $source.SourceCollection }
$loaded = @($source | Where-Object { $_ })
if($ImportType -eq "alwaysImport") { return $loaded }
$files = @($ImportPolicies | Where-Object { $_ })
$allLoaded = -not $script:GraphPagingCache
$key = "$SameTenant|$allLoaded|$($loaded.Count)|" + (($files | ForEach-Object { "$($_.PolicyType.Id)/$($_.Id)/$($_.Name)" }) -join '|')
if($script:_importCandidateCache -and $script:_importCandidateCache.Key -eq $key) { return $script:_importCandidateCache.Value }
$value = @(Get-IntuneImportCandidates -ImportPolicies $files -LoadedPolicies $loaded -ImportType $ImportType -SameTenant $SameTenant -AllLoaded:$allLoaded)
$script:_importCandidateCache = @{ Key = $key; Value = $value }
return $value
}
function Show-IntuneManagerImportForm
{
# A new dialog looks candidates up afresh: an earlier import may have created some.
$script:_importCandidateCache = $null
$policyTypes = Get-IntuneManagerSelectedPolicyTypes
if(($policyTypes | Measure-Object).Count -eq 0) {
@@ -163,11 +192,13 @@ function Show-IntuneManagerImportForm
$updatedPolicies = @()
Update-IntuneImportMatchInfo
$allFiles = @($script:DGObjectsToImport.ItemsSource | ForEach-Object { if($_) { $_.Object } })
$existingPolicies = Get-IntuneManagerImportExistingPolicies -ImportPolicies $allFiles -ImportType $importType -SameTenant $script:importForm.DataContext.SameTenant
foreach ($selectedPolicy in @($selectedPolicies))
{
$importPolicy = $selectedPolicy.Object
$match = Resolve-IntuneImportUpdateTarget -ImportPolicy $importPolicy -ExistingPolicies $script:dgIntuneManagerObjects.ItemsSource -SameTenant $script:importForm.DataContext.SameTenant -ImportType $importType
$match = Resolve-IntuneImportUpdateTarget -ImportPolicy $importPolicy -ExistingPolicies $existingPolicies -SameTenant $script:importForm.DataContext.SameTenant -ImportType $importType
if($match.Action -eq "Update" -and $importType -eq "update")
{
+3 -1
View File
@@ -501,7 +501,9 @@ function Show-SelectedGraphPolicies
$bindingProp,$colHeader = $columnInfo.Split('=')
if(-not $colHeader) { $colHeader = $bindingProp.Split(".")[-1] }
$dgIntuneManagerObjects.Columns.Add((New-GridTextColumn -Path $bindingProp -Header $colHeader -FirstLineOnly:$firstLineOnly -MaxLength $maxCellLength))
# The Name column is exempt from the cap (Get-GridCellMaxLength, issue #437).
$cellMax = Get-GridCellMaxLength -Path $bindingProp -Default $maxCellLength
$dgIntuneManagerObjects.Columns.Add((New-GridTextColumn -Path $bindingProp -Header $colHeader -FirstLineOnly:$firstLineOnly -MaxLength $cellMax))
}
}
else {
+17
View File
@@ -98,6 +98,23 @@ public class FirstLineConverter : IValueConverter
# first line (capped at -MaxLength characters when that is above 0) and carries
# the full text as a tooltip. Sorting and the grid filter still use the
# underlying value: both read the binding path, not what is displayed.
# The character cap (setting ObjectListMaxCellLength) exists for long free-text
# cells - a store app description - so one value cannot widen its column until
# the others leave the screen. It must never apply to the column that identifies
# the row: with the default cap of 50, every policy name in a list that shares a
# long prefix ended in an ellipsis, whatever the column width (issue #437). The
# Name column is trimmed at its edge by TextTrimming instead, like any grid.
function Get-GridCellMaxLength
{
param(
[Parameter(Mandatory = $true)][string]$Path,
[int]$Default = 0
)
if($Path -eq 'Name') { return 0 }
return $Default
}
function New-GridTextColumn
{
param(