Skip to content

Commit c122bd3

Browse files
authored
Fixed an issue where changing a setting wouldn't save the setting correctly the first time the value was changed (#2649)
1 parent a53cc5e commit c122bd3

File tree

8 files changed

+17
-35
lines changed

8 files changed

+17
-35
lines changed

Files/Dialogs/PropertiesDialog.xaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<ContentDialog.Background>
1313
<AcrylicBrush
1414
Windows10version1903:TintLuminosityOpacity="0.9"
15-
AlwaysUseFallback="{x:Bind AppSettings.AcrylicEnabled, Mode=OneWay}"
15+
AlwaysUseFallback="{x:Bind AppSettings.IsAcrylicDisabled, Mode=OneWay}"
1616
BackgroundSource="HostBackdrop"
1717
FallbackColor="{x:Bind AppSettings.AcrylicTheme.FallbackColor, Mode=OneWay}"
1818
TintColor="{x:Bind AppSettings.AcrylicTheme.TintColor, Mode=OneWay}"

Files/Enums/SidebarOpacity.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
public enum SidebarOpacity
44
{
55
Opaque = 0,
6-
AcrylicEnabled = 1
6+
IsAcrylicDisabled = 1
77
}
88
}

Files/UserControls/MultitaskingControl/HorizontalMultitaskingControl.xaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@
771771
<AcrylicBrush
772772
x:Key="TabViewBackground"
773773
Windows10version1903:TintLuminosityOpacity="0.75"
774-
AlwaysUseFallback="{x:Bind AppSettings.AcrylicEnabled, Mode=OneWay}"
774+
AlwaysUseFallback="{x:Bind AppSettings.IsAcrylicDisabled, Mode=OneWay}"
775775
BackgroundSource="HostBackdrop"
776776
FallbackColor="#FFF3F2F1"
777777
TintColor="{x:Bind AppSettings.AcrylicTheme.TintColor, Mode=OneWay}"
@@ -781,7 +781,7 @@
781781
<AcrylicBrush
782782
x:Key="TabViewBackground"
783783
Windows10version1903:TintLuminosityOpacity="0.75"
784-
AlwaysUseFallback="{x:Bind AppSettings.AcrylicEnabled, Mode=OneWay}"
784+
AlwaysUseFallback="{x:Bind AppSettings.IsAcrylicDisabled, Mode=OneWay}"
785785
BackgroundSource="HostBackdrop"
786786
FallbackColor="#161514"
787787
TintColor="{x:Bind AppSettings.AcrylicTheme.TintColor, Mode=OneWay}"

Files/UserControls/SidebarControl.xaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<AcrylicBrush
2121
x:Key="NavigationViewExpandedPaneBackground"
2222
Windows10version1903:TintLuminosityOpacity="0.9"
23-
AlwaysUseFallback="{x:Bind AppSettings.AcrylicEnabled, Mode=OneWay}"
23+
AlwaysUseFallback="{x:Bind AppSettings.IsAcrylicDisabled, Mode=OneWay}"
2424
BackgroundSource="HostBackdrop"
2525
FallbackColor="{x:Bind AppSettings.AcrylicTheme.FallbackColor, Mode=OneWay}"
2626
TintColor="{x:Bind AppSettings.AcrylicTheme.TintColor, Mode=OneWay}"
@@ -30,7 +30,7 @@
3030
<AcrylicBrush
3131
x:Key="NavigationViewExpandedPaneBackground"
3232
Windows10version1903:TintLuminosityOpacity="0.9"
33-
AlwaysUseFallback="{x:Bind AppSettings.AcrylicEnabled, Mode=OneWay}"
33+
AlwaysUseFallback="{x:Bind AppSettings.IsAcrylicDisabled, Mode=OneWay}"
3434
BackgroundSource="HostBackdrop"
3535
FallbackColor="{x:Bind AppSettings.AcrylicTheme.FallbackColor, Mode=OneWay}"
3636
TintColor="{x:Bind AppSettings.AcrylicTheme.TintColor, Mode=OneWay}"

Files/View Models/SettingsViewModel.cs

+6-24
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ public SettingsViewModel()
4141
{
4242
_roamingSettings = ApplicationData.Current.RoamingSettings;
4343

44-
DetectAcrylicPreference();
4544
DetectDateTimeFormat();
4645
PinSidebarLocationItems();
4746
DetectRecycleBinPreference();
@@ -58,7 +57,7 @@ public SettingsViewModel()
5857
Analytics.TrackEvent("PinRecycleBinToSideBar " + PinRecycleBinToSideBar.ToString());
5958
Analytics.TrackEvent("ShowFileExtensions " + ShowFileExtensions.ToString());
6059
Analytics.TrackEvent("ShowConfirmDeleteDialog " + ShowConfirmDeleteDialog.ToString());
61-
Analytics.TrackEvent("AcrylicSidebar " + AcrylicEnabled.ToString());
60+
Analytics.TrackEvent("IsAcrylicDisabled " + IsAcrylicDisabled.ToString());
6261
Analytics.TrackEvent("ShowFileOwner " + ShowFileOwner.ToString());
6362
Analytics.TrackEvent("IsHorizontalTabStripEnabled " + IsHorizontalTabStripEnabled.ToString());
6463
Analytics.TrackEvent("IsVerticalTabFlyoutEnabled " + IsVerticalTabFlyoutEnabled.ToString());
@@ -510,28 +509,10 @@ public bool ListAndSortDirectoriesAlongsideFiles
510509
set => Set(value);
511510
}
512511

513-
private void DetectAcrylicPreference()
512+
public bool IsAcrylicDisabled
514513
{
515-
if (localSettings.Values["AcrylicEnabled"] == null)
516-
{
517-
localSettings.Values["AcrylicEnabled"] = true;
518-
}
519-
AcrylicEnabled = (bool)localSettings.Values["AcrylicEnabled"];
520-
}
521-
522-
private bool _AcrylicEnabled = true;
523-
524-
public bool AcrylicEnabled
525-
{
526-
get => _AcrylicEnabled;
527-
set
528-
{
529-
if (value != _AcrylicEnabled)
530-
{
531-
SetProperty(ref _AcrylicEnabled, value);
532-
localSettings.Values["AcrylicEnabled"] = value;
533-
}
534-
}
514+
get => Get(true);
515+
set => Set(value);
535516
}
536517

537518
public bool ShowAllContextMenuItems
@@ -772,10 +753,11 @@ public TValue Get<TValue>(TValue defaultValue, [CallerMemberName] string propert
772753
Set(tValue, propertyName); // Put the corrected value in settings.
773754
return tValue;
774755
}
775-
776756
return tValue;
777757
}
778758

759+
_roamingSettings.Values[propertyName] = defaultValue;
760+
779761
return defaultValue;
780762
}
781763

Files/Views/Pages/Properties.xaml.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private void AppSettings_PropertyChanged(object sender, System.ComponentModel.Pr
7575
{
7676
switch (e.PropertyName)
7777
{
78-
case "AcrylicEnabled":
78+
case "IsAcrylicDisabled":
7979
case "FallbackColor":
8080
case "TintColor":
8181
case "TintOpacity":
@@ -90,7 +90,7 @@ await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
9090
{
9191
var backgroundBrush = new AcrylicBrush()
9292
{
93-
AlwaysUseFallback = AppSettings.AcrylicEnabled,
93+
AlwaysUseFallback = AppSettings.IsAcrylicDisabled,
9494
BackgroundSource = AcrylicBackgroundSource.HostBackdrop,
9595
FallbackColor = AppSettings.AcrylicTheme.FallbackColor,
9696
TintColor = AppSettings.AcrylicTheme.TintColor,

Files/Views/Settings.xaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<AcrylicBrush
1818
x:Key="NavigationViewExpandedPaneBackground"
1919
Windows10version1903:TintLuminosityOpacity="0.9"
20-
AlwaysUseFallback="{x:Bind AppSettings.AcrylicEnabled, Mode=OneWay}"
20+
AlwaysUseFallback="{x:Bind AppSettings.IsAcrylicDisabled, Mode=OneWay}"
2121
BackgroundSource="HostBackdrop"
2222
FallbackColor="{x:Bind AppSettings.AcrylicTheme.FallbackColor, Mode=OneWay}"
2323
TintColor="{x:Bind AppSettings.AcrylicTheme.TintColor, Mode=OneWay}"
@@ -27,7 +27,7 @@
2727
<AcrylicBrush
2828
x:Key="NavigationViewExpandedPaneBackground"
2929
Windows10version1903:TintLuminosityOpacity="0.9"
30-
AlwaysUseFallback="{x:Bind AppSettings.AcrylicEnabled, Mode=OneWay}"
30+
AlwaysUseFallback="{x:Bind AppSettings.IsAcrylicDisabled, Mode=OneWay}"
3131
BackgroundSource="HostBackdrop"
3232
FallbackColor="{x:Bind AppSettings.AcrylicTheme.FallbackColor, Mode=OneWay}"
3333
TintColor="{x:Bind AppSettings.AcrylicTheme.TintColor, Mode=OneWay}"

Files/Views/SettingsPages/Appearance.xaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
x:Uid="SettingsAppearanceAcrylicSidebar"
6969
Header="Acrylic sidebar"
7070
HeaderTemplate="{StaticResource CustomHeaderStyle}"
71-
IsOn="{x:Bind AppSettings.AcrylicEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BoolNegationConverter}}" />
71+
IsOn="{x:Bind AppSettings.IsAcrylicDisabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BoolNegationConverter}}" />
7272
</StackPanel>
7373
</ScrollViewer>
7474
</Grid>

0 commit comments

Comments
 (0)