Skip to content

Commit c2ff41f

Browse files
committed
Fix: Fixed issue where Open on Startup didn't display a message when disabled (#13625)
1 parent 5afe9e2 commit c2ff41f

File tree

2 files changed

+40
-17
lines changed

2 files changed

+40
-17
lines changed

src/Files.App/Strings/en-US/Resources.resw

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3587,4 +3587,7 @@
35873587
<data name="NoFileOperations" xml:space="preserve">
35883588
<value>No ongoing file operations</value>
35893589
</data>
3590+
<data name="OpenOnStartupDisabled" xml:space="preserve">
3591+
<value>The option to open Files on Windows Startup is not available due to your system settings or group policy. To re-enable, open the startup page in Task Manager.</value>
3592+
</data>
35903593
</root>

src/Files.App/Views/Settings/AdvancedPage.xaml

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
x:Class="Files.App.Views.Settings.AdvancedPage"
44
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
55
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
6+
xmlns:converters="using:CommunityToolkit.WinUI.UI.Converters"
67
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
78
xmlns:helpers="using:Files.App.Helpers"
89
xmlns:i="using:Microsoft.Xaml.Interactivity"
@@ -13,7 +14,13 @@
1314
mc:Ignorable="d">
1415

1516
<Page.Resources>
16-
<ResourceDictionary Source="/ResourceDictionaries/RightAlignedToggleSwitchStyle.xaml" />
17+
<ResourceDictionary>
18+
<ResourceDictionary.MergedDictionaries>
19+
<ResourceDictionary Source="/ResourceDictionaries/RightAlignedToggleSwitchStyle.xaml" />
20+
</ResourceDictionary.MergedDictionaries>
21+
22+
<converters:BoolNegationConverter x:Key="BoolNegationConverter" />
23+
</ResourceDictionary>
1724
</Page.Resources>
1825

1926
<Page.DataContext>
@@ -81,22 +88,35 @@
8188
</local:SettingsBlockControl>
8289

8390
<!-- Open on Windows startup -->
84-
<local:SettingsBlockControl Title="{helpers:ResourceString Name=SettingsOpenInLogin}" HorizontalAlignment="Stretch">
85-
<local:SettingsBlockControl.Icon>
86-
<FontIcon Glyph="&#xE7E8;" />
87-
</local:SettingsBlockControl.Icon>
88-
<ToggleSwitch
89-
AutomationProperties.Name="{helpers:ResourceString Name=SettingsOpenInLogin}"
90-
IsEnabled="{x:Bind ViewModel.CanOpenOnWindowsStartup, Mode=OneWay}"
91-
IsOn="{x:Bind ViewModel.OpenOnWindowsStartup, Mode=TwoWay}"
92-
Style="{StaticResource RightAlignedToggleSwitchStyle}">
93-
<i:Interaction.Behaviors>
94-
<icore:EventTriggerBehavior EventName="Toggled">
95-
<icore:InvokeCommandAction Command="{x:Bind ViewModel.OpenFilesOnWindowsStartupCommand, Mode=OneWay}" />
96-
</icore:EventTriggerBehavior>
97-
</i:Interaction.Behaviors>
98-
</ToggleSwitch>
99-
</local:SettingsBlockControl>
91+
<StackPanel>
92+
<!-- Startup disabled InfoBar -->
93+
<InfoBar
94+
x:Name="OpenOnStartupInfoBar"
95+
x:Load="{x:Bind ViewModel.CanOpenOnWindowsStartup, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}"
96+
IsClosable="False"
97+
IsIconVisible="True"
98+
IsOpen="True"
99+
Message="{helpers:ResourceString Name=OpenOnStartupDisabled}"
100+
Severity="Warning" />
101+
102+
<!-- Setting block -->
103+
<local:SettingsBlockControl Title="{helpers:ResourceString Name=SettingsOpenInLogin}" HorizontalAlignment="Stretch">
104+
<local:SettingsBlockControl.Icon>
105+
<FontIcon Glyph="&#xE7E8;" />
106+
</local:SettingsBlockControl.Icon>
107+
<ToggleSwitch
108+
AutomationProperties.Name="{helpers:ResourceString Name=SettingsOpenInLogin}"
109+
IsEnabled="{x:Bind ViewModel.CanOpenOnWindowsStartup, Mode=OneWay}"
110+
IsOn="{x:Bind ViewModel.OpenOnWindowsStartup, Mode=TwoWay}"
111+
Style="{StaticResource RightAlignedToggleSwitchStyle}">
112+
<i:Interaction.Behaviors>
113+
<icore:EventTriggerBehavior EventName="Toggled">
114+
<icore:InvokeCommandAction Command="{x:Bind ViewModel.OpenFilesOnWindowsStartupCommand, Mode=OneWay}" />
115+
</icore:EventTriggerBehavior>
116+
</i:Interaction.Behaviors>
117+
</ToggleSwitch>
118+
</local:SettingsBlockControl>
119+
</StackPanel>
100120

101121
<!-- Leave App Running -->
102122
<local:SettingsBlockControl Title="{helpers:ResourceString Name=SettingsLeaveAppRunning}" HorizontalAlignment="Stretch">

0 commit comments

Comments
 (0)