Skip to content

Commit 506e6bf

Browse files
CopilotBornToBeRoot
andcommitted
Add config.json.example to installation and UI for policy-managed settings
Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com>
1 parent 36e595c commit 506e6bf

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

Source/NETworkManager/NETworkManager.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
</PropertyGroup>
4747
<ItemGroup>
4848
<None Remove="log4net.config" />
49+
<None Remove="config.json.example" />
4950
<None Remove="NETworkManager.ico" />
5051
<None Remove="SplashScreen.png" />
5152
<None Include="..\.editorconfig" Link=".editorconfig" />
@@ -57,6 +58,9 @@
5758
<Content Include="log4net.config">
5859
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
5960
</Content>
61+
<Content Include="config.json.example">
62+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
63+
</Content>
6064
</ItemGroup>
6165
<ItemGroup>
6266
<PackageReference Include="AirspaceFixer" Version="1.0.6" />

Source/NETworkManager/ViewModels/SettingsUpdateViewModel.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ public bool CheckForUpdatesAtStartup
2626
}
2727
}
2828

29+
/// <summary>
30+
/// Gets whether the "Check for updates at startup" setting is managed by system-wide policy.
31+
/// </summary>
32+
public bool IsUpdateCheckManagedByPolicy => PolicyManager.Current?.Update_DisableUpdateCheck.HasValue == true;
33+
2934
private bool _checkForPreReleases;
3035

3136
public bool CheckForPreReleases

Source/NETworkManager/Views/SettingsUpdateView.xaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@
66
xmlns:mah="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
77
xmlns:localization="clr-namespace:NETworkManager.Localization.Resources;assembly=NETworkManager.Localization"
88
xmlns:viewModels="clr-namespace:NETworkManager.ViewModels"
9+
xmlns:converters="clr-namespace:NETworkManager.Converters;assembly=NETworkManager.Converters"
910
mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:SettingsUpdateViewModel}">
11+
<UserControl.Resources>
12+
<converters:BooleanReverseConverter x:Key="BooleanReverseConverter" />
13+
<converters:BooleanToVisibilityCollapsedConverter x:Key="BooleanToVisibilityCollapsedConverter" />
14+
</UserControl.Resources>
1015
<StackPanel>
1116
<TextBlock Style="{StaticResource HeaderTextBlock}"
1217
Text="{x:Static localization:Strings.Update}" />
1318
<StackPanel Orientation="Horizontal" Margin="0,0,0,10">
1419
<mah:ToggleSwitch Header="{x:Static localization:Strings.CheckForUpdatesAtStartup}"
15-
IsOn="{Binding CheckForUpdatesAtStartup}" />
20+
IsOn="{Binding CheckForUpdatesAtStartup}"
21+
IsEnabled="{Binding IsUpdateCheckManagedByPolicy, Converter={StaticResource BooleanReverseConverter}}" />
1622
<Rectangle Width="24" Height="24"
1723
VerticalAlignment="Top"
1824
ToolTip="{x:Static localization:Strings.HelpMessage_CheckForUpdatesAtStartup}"
@@ -24,6 +30,10 @@
2430
</Rectangle.Resources>
2531
</Rectangle>
2632
</StackPanel>
33+
<TextBlock Text="This setting is managed by your administrator."
34+
Foreground="Orange"
35+
Margin="0,0,0,10"
36+
Visibility="{Binding IsUpdateCheckManagedByPolicy, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}" />
2737
<mah:ToggleSwitch Header="{x:Static localization:Strings.CheckForPreReleases}"
2838
IsOn="{Binding CheckForPreReleases}"
2939
Margin="0,0,0,20" />
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"Update_DisableUpdateCheck": true
3+
}

0 commit comments

Comments
 (0)