Skip to content

Commit a53981a

Browse files
author
Yair Aichenbaum
committed
Transfered properties to SettingsViewModel
1 parent 2bc668d commit a53981a

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

Files/Controls/RibbonArea.xaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
99
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
1010
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
11-
xmlns:local1="using:Files"
11+
xmlns:local="using:Files"
1212
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
1313
xmlns:uilib="using:Microsoft.UI.Xaml.Controls"
1414
d:DesignHeight="125"
@@ -1363,7 +1363,7 @@
13631363
<Custom:TabViewItem.Resources>
13641364
<ResourceDictionary Source="ms-appx:///Microsoft.UI.Xaml/DensityStyles/Compact.xaml" />
13651365
</Custom:TabViewItem.Resources>
1366-
<controls:RibbonPage Visibility="{x:Bind RibbonViewModel.ShowRibbonContent, Mode=OneWay}">
1366+
<controls:RibbonPage Visibility="{x:Bind local:App.AppSettings.ShowRibbonContent, Mode=OneWay}">
13671367
<controls:RibbonPage.PageContent>
13681368
<AppBarButton
13691369
x:Name="CutButton"
@@ -1392,7 +1392,7 @@
13921392
Click="{x:Bind parentPage.instanceInteraction.PasteItem_ClickAsync}"
13931393
CornerRadius="2"
13941394
Icon="Paste"
1395-
IsEnabled="{x:Bind local1:App.PS.isEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
1395+
IsEnabled="{x:Bind local:App.PS.isEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
13961396
Label="Paste"
13971397
LabelPosition="{x:Bind RibbonViewModel.ItemLabelPosition, Mode=OneWay}"
13981398
Style="{StaticResource AppBarButtonRevealStyle}" />
@@ -1507,7 +1507,7 @@
15071507
<Custom:TabViewItem.Resources>
15081508
<ResourceDictionary Source="ms-appx:///Microsoft.UI.Xaml/DensityStyles/Compact.xaml" />
15091509
</Custom:TabViewItem.Resources>
1510-
<controls:RibbonPage Visibility="{x:Bind RibbonViewModel.ShowRibbonContent, Mode=OneWay}">
1510+
<controls:RibbonPage Visibility="{x:Bind local:App.AppSettings.ShowRibbonContent, Mode=OneWay}">
15111511
<controls:RibbonPage.PageContent>
15121512
<AppBarButton
15131513
x:Name="ShareButton"
@@ -1539,7 +1539,7 @@
15391539
<Custom:TabViewItem.Resources>
15401540
<ResourceDictionary Source="ms-appx:///Microsoft.UI.Xaml/DensityStyles/Compact.xaml" />
15411541
</Custom:TabViewItem.Resources>
1542-
<controls:RibbonPage Visibility="{x:Bind RibbonViewModel.ShowRibbonContent, Mode=OneWay}">
1542+
<controls:RibbonPage Visibility="{x:Bind local:App.AppSettings.ShowRibbonContent, Mode=OneWay}">
15431543
<controls:RibbonPage.PageContent>
15441544
<AppBarButton
15451545
x:Name="LayoutButton"
@@ -1749,7 +1749,7 @@
17491749
Margin="4,0,2,0"
17501750
x:FieldModifier="public"
17511751
Background="Transparent"
1752-
Click="{x:Bind local1:NavigationActions.Back_Click}"
1752+
Click="{x:Bind local:NavigationActions.Back_Click}"
17531753
CornerRadius="2"
17541754
FontFamily="Segoe MDL2 Assets"
17551755
IsEnabled="{x:Bind parentPage.ItemDisplayFrame.CanGoBack, Mode=OneWay}"
@@ -1770,7 +1770,7 @@
17701770
Margin="2,0,2,0"
17711771
x:FieldModifier="public"
17721772
Background="Transparent"
1773-
Click="{x:Bind local1:NavigationActions.Forward_Click}"
1773+
Click="{x:Bind local:NavigationActions.Forward_Click}"
17741774
CornerRadius="2"
17751775
FontFamily="Segoe MDL2 Assets"
17761776
IsEnabled="{x:Bind parentPage.ItemDisplayFrame.CanGoForward, Mode=OneWay}"
@@ -1790,7 +1790,7 @@
17901790
Margin="2,0,2,0"
17911791
x:FieldModifier="public"
17921792
Background="Transparent"
1793-
Click="{x:Bind local1:NavigationActions.Up_Click}"
1793+
Click="{x:Bind local:NavigationActions.Up_Click}"
17941794
CornerRadius="2"
17951795
FontFamily="Segoe MDL2 Assets"
17961796
Style="{StaticResource ToolBarButtonStyle}"
@@ -1810,7 +1810,7 @@
18101810
Margin="2,0,0,0"
18111811
x:FieldModifier="public"
18121812
Background="Transparent"
1813-
Click="{x:Bind local1:NavigationActions.Refresh_Click}"
1813+
Click="{x:Bind local:NavigationActions.Refresh_Click}"
18141814
CornerRadius="2"
18151815
FontFamily="Segoe MDL2 Assets"
18161816
Style="{StaticResource ToolBarButtonStyle}">

Files/View Models/RibbonViewModel.cs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ namespace Files.Controls
77
{
88
public class RibbonViewModel : ViewModelBase
99
{
10-
private bool _ShowRibbonContent = true;
1110
private string _ToggleRibbonIcon = "";
1211
private CommandBarLabelPosition _ItemLabelPosition = CommandBarLabelPosition.Default;
1312
private Windows.UI.Xaml.Visibility _AppBarSeparatorVisibility = Windows.UI.Xaml.Visibility.Visible;
@@ -18,12 +17,6 @@ public string ToggleRibbonIcon
1817
set => Set(ref _ToggleRibbonIcon, value);
1918
}
2019

21-
public bool ShowRibbonContent
22-
{
23-
get => _ShowRibbonContent;
24-
set => Set(ref _ShowRibbonContent, value);
25-
}
26-
2720
public CommandBarLabelPosition ItemLabelPosition
2821
{
2922
get => _ItemLabelPosition;
@@ -39,25 +32,25 @@ public Windows.UI.Xaml.Visibility AppBarSeparatorVisibility
3932
private RelayCommand toggleRibbon;
4033
public RelayCommand ToggleRibbon => toggleRibbon = new RelayCommand(() =>
4134
{
42-
ShowRibbonContent = !ShowRibbonContent;
35+
App.AppSettings.ShowRibbonContent = !App.AppSettings.ShowRibbonContent;
4336

4437
UpdateToggleIcon();
4538
});
4639

4740
private RelayCommand showRibbonCommand;
4841
public RelayCommand ShowRibbonCommand => showRibbonCommand = new RelayCommand(() =>
4942
{
50-
if (ShowRibbonContent == false)
43+
if (App.AppSettings.ShowRibbonContent == false)
5144
{
52-
ShowRibbonContent = true;
45+
App.AppSettings.ShowRibbonContent = true;
5346

5447
UpdateToggleIcon();
5548
}
5649
});
5750

5851
public void UpdateToggleIcon()
5952
{
60-
if (ShowRibbonContent)
53+
if (App.AppSettings.ShowRibbonContent)
6154
{
6255
ToggleRibbonIcon = ""; //This is the hide icon
6356
}

Files/View Models/SettingsViewModel.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ private async void LoadTerminalApps()
162162
private FormFactorMode _FormFactor = FormFactorMode.Regular;
163163
private ThemeStyle _ThemeValue;
164164
private bool _AreLinuxFilesSupported = false;
165+
private bool _ShowRibbonContent = true;
165166
private string _DesktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
166167
private string _DocumentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
167168
private string _DownloadsPath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\Downloads";
@@ -254,6 +255,12 @@ public string VideosPath
254255
set => Set(ref _VideosPath, value);
255256
}
256257

258+
public bool ShowRibbonContent
259+
{
260+
get => _ShowRibbonContent;
261+
set => Set(ref _ShowRibbonContent, value);
262+
}
263+
257264
public SidebarOpacity SidebarThemeMode
258265
{
259266
get => _SidebarThemeMode;

0 commit comments

Comments
 (0)