Skip to content

Commit c1b3257

Browse files
committed
Tweaked Settings Layout
1 parent ad1960d commit c1b3257

File tree

7 files changed

+287
-16
lines changed

7 files changed

+287
-16
lines changed

Files UWP/FilesUWP.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@
134134
<DependentUpon>PhotoAlbum.xaml</DependentUpon>
135135
</Compile>
136136
<Compile Include="ProgressBoxSystem.cs" />
137+
<Compile Include="ProHome.xaml.cs">
138+
<DependentUpon>ProHome.xaml</DependentUpon>
139+
</Compile>
137140
<Compile Include="Properties\AssemblyInfo.cs" />
138141
<Compile Include="Settings.xaml.cs">
139142
<DependentUpon>Settings.xaml</DependentUpon>
@@ -194,6 +197,10 @@
194197
<SubType>Designer</SubType>
195198
<Generator>MSBuild:Compile</Generator>
196199
</Page>
200+
<Page Include="ProHome.xaml">
201+
<SubType>Designer</SubType>
202+
<Generator>MSBuild:Compile</Generator>
203+
</Page>
197204
<Page Include="Settings.xaml">
198205
<SubType>Designer</SubType>
199206
<Generator>MSBuild:Compile</Generator>

Files UWP/ProHome.xaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<Page
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="using:Files"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7+
xmlns:Custom="using:Microsoft.Toolkit.Uwp.UI.Controls"
8+
x:Class="Files.ProHome"
9+
mc:Ignorable="d"
10+
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
11+
12+
<Grid Padding="0,0,0,0">
13+
<Custom:TabView SelectionChanged="TabView_SelectionChanged" CanCloseTabs="True" ItemsSource="{x:Bind local:ProHome.TabList}" CanDragItems="False" TabWidthBehavior="Actual">
14+
<Custom:TabView.TabActionHeader>
15+
<Button Background="Transparent" Width="30" Padding="2" Height="30">
16+
<Button.Content>
17+
<FontIcon FontSize="12" Glyph="&#xE710;"/>
18+
</Button.Content>
19+
</Button>
20+
</Custom:TabView.TabActionHeader>
21+
22+
23+
24+
25+
<Custom:TabView.ItemTemplate>
26+
<DataTemplate>
27+
<Custom:TabViewItem Width="300" Header="{Binding TabName}">
28+
<Frame SourcePageType="{Binding TabContent}" Name="contentFrame"/>
29+
</Custom:TabViewItem>
30+
</DataTemplate>
31+
</Custom:TabView.ItemTemplate>
32+
33+
</Custom:TabView>
34+
35+
36+
</Grid>
37+
</Page>

Files UWP/ProHome.xaml.cs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using Microsoft.Toolkit.Uwp.UI.Controls;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Collections.ObjectModel;
5+
using System.IO;
6+
using System.Linq;
7+
using System.Runtime.InteropServices.WindowsRuntime;
8+
using Windows.Foundation;
9+
using Windows.Foundation.Collections;
10+
using Windows.UI.Xaml;
11+
using Windows.UI.Xaml.Controls;
12+
using Windows.UI.Xaml.Controls.Primitives;
13+
using Windows.UI.Xaml.Data;
14+
using Windows.UI.Xaml.Input;
15+
using Windows.UI.Xaml.Media;
16+
using Windows.UI.Xaml.Navigation;
17+
18+
namespace Files
19+
{
20+
/// <summary>
21+
/// This is not finished yet. This is the work that was started on having multiple Tabs
22+
/// </summary>
23+
public sealed partial class ProHome : Page
24+
{
25+
ObservableCollection<Tab> tabList = new ObservableCollection<Tab>();
26+
public static ObservableCollection<Tab> TabList { get; set; } = new ObservableCollection<Tab>();
27+
public ProHome()
28+
{
29+
this.InitializeComponent();
30+
TabList.Clear();
31+
TabList.Add(new Tab() { TabName = "Home", TabContent = "local:MainPage" });
32+
}
33+
34+
private void TabView_SelectionChanged(object sender, SelectionChangedEventArgs e)
35+
{
36+
var selectedTab = e.AddedItems as TabViewItem;
37+
38+
}
39+
}
40+
41+
public class Tab
42+
{
43+
public string TabName { get; set; }
44+
public string TabContent { get; set; }
45+
}
46+
}

Files UWP/SettingsPages/About.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
mc:Ignorable="d"
99
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
1010

11-
<Grid Padding="24,35,24,0">
11+
<Grid Padding="24,24,24,0">
1212

1313
<ScrollViewer>
1414
<StackPanel Orientation="Vertical" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
15-
<TextBlock x:Name="Header" Text="About Files" Margin="0,0,0,25" FontFamily="Segoe UI Black" FontWeight="Bold" FontSize="48" HorizontalAlignment="Left" VerticalAlignment="Top" />
15+
<TextBlock x:Name="Header" Text="About Files" Margin="0,0,0,5" FontFamily="Segoe UI Black" FontWeight="Bold" FontSize="40" HorizontalAlignment="Left" VerticalAlignment="Top" />
1616
<TextBlock Margin="0,0,0,10" FontFamily="Segoe UI" FontSize="24" Text="Product Information"/>
1717
<TextBlock FontSize="18" Text="Edition: Files Pre-Release"/>
1818
<TextBlock FontSize="18" Text="Version: 0.4.9"/>

Files UWP/SettingsPages/Personalization.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
1010

1111

12-
<Grid Padding="24,35,24,0">
12+
<Grid Padding="24,24,24,0">
1313

1414
<ScrollViewer HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
1515
<StackPanel>
16-
<TextBlock x:Name="Header" Text="Personalization" Margin="0,0,0,25" FontFamily="Segoe UI Black" FontWeight="Bold" FontSize="48" HorizontalAlignment="Left" VerticalAlignment="Top" />
16+
<TextBlock x:Name="Header" Text="Personalization" Margin="0,0,0,10" FontFamily="Segoe UI Black" FontWeight="Bold" FontSize="40" HorizontalAlignment="Left" VerticalAlignment="Top" />
1717
<Grid Margin="0,0,0,25" HorizontalAlignment="Left" VerticalAlignment="Top">
18-
<Rectangle Name="VisualRect" Fill="{ThemeResource SystemControlAcrylicElementBrush}" Width="384" Height="216" HorizontalAlignment="Center" VerticalAlignment="Center" Canvas.ZIndex="2" />
19-
<Image HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" Source="ms-appx:///Assets/abstract_HeroImage.jpg" Stretch="UniformToFill" Width="480" Height="270"/>
18+
<Rectangle Name="VisualRect" Fill="{ThemeResource SystemControlAcrylicElementBrush}" Width="350" Height="200" HorizontalAlignment="Center" VerticalAlignment="Center" Canvas.ZIndex="2" />
19+
<Image HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" Source="ms-appx:///Assets/abstract_HeroImage.jpg" Stretch="UniformToFill" Width="450" Height="300"/>
2020
</Grid>
2121
<TextBlock Margin="0,0,0,15" HorizontalAlignment="Left" Text="Choose your color scheme" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="18"/>
2222
<ComboBox SelectionChanged="ThemeChooser_SelectionChanged" Name="ThemeChooser" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Center" Width="300">

Files UWP/SettingsPages/Preferences.xaml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,39 @@
88
mc:Ignorable="d"
99
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
1010

11-
<Grid Padding="24,35,24,0">
11+
<Grid Padding="24,24,24,0">
1212
<ScrollViewer>
13-
<StackPanel Spacing="25" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
14-
<TextBlock x:Name="Header" Text="Preferences" Margin="0,0,0,0" FontFamily="Segoe UI Black" FontWeight="Bold" FontSize="48" HorizontalAlignment="Left" VerticalAlignment="Top" />
13+
<StackPanel Spacing="5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
14+
<TextBlock x:Name="Header" Text="Preferences" Margin="0,0,0,0" FontFamily="Segoe UI Black" FontWeight="Bold" FontSize="40" HorizontalAlignment="Left" VerticalAlignment="Top" />
1515
<Grid Name="CustomLibraries">
1616
<StackPanel Orientation="Vertical">
1717
<TextBlock FontSize="24" Text="Custom Locations - In Development"/>
1818
<TextBlock Text="Replaces common locations with those of your choice"/>
19-
<ToggleSwitch IsEnabled="False" VerticalAlignment="Top"/>
19+
<ToggleSwitch IsEnabled="False" Toggled="ToggleSwitch_Toggled" Name="CustomLocationToggle" VerticalAlignment="Top"/>
2020
<Grid Margin="0, 0, 0, 12.5">
2121
<TextBlock Text="Downloads" VerticalAlignment="Center" Margin="0,0,25,0" HorizontalAlignment="Left"/>
22-
<TextBox BorderThickness="1" PlaceholderText="Custom Downloads Location" HorizontalAlignment="Left" Margin="125,0,0,0" Width="500" IsEnabled="False"/>
22+
<TextBox Name="DownloadsL" PlaceholderText="Custom Downloads Location" HorizontalAlignment="Left" Margin="125,0,0,0" Width="500" />
2323
</Grid>
2424
<Grid Margin="0, 0, 0, 12.5">
2525
<TextBlock Text="Documents" VerticalAlignment="Center" Margin="0,0,25,0" HorizontalAlignment="Left"/>
26-
<TextBox BorderThickness="1" PlaceholderText="Custom Documents Location" HorizontalAlignment="Left" Margin="125,0,0,0" Width="500" IsEnabled="False"/>
26+
<TextBox Name="DocumentsL" PlaceholderText="Custom Documents Location" HorizontalAlignment="Left" Margin="125,0,0,0" Width="500" />
2727
</Grid>
2828
<Grid Margin="0, 0, 0, 12.5">
2929
<TextBlock Text="Pictures" VerticalAlignment="Center" Margin="0,0,25,0" HorizontalAlignment="Left"/>
30-
<TextBox BorderThickness="1" PlaceholderText="Custom Pictures Location" HorizontalAlignment="Left" Margin="125,0,0,0" Width="500" IsEnabled="False"/>
30+
<TextBox Name="PictureL" PlaceholderText="Custom Pictures Location" HorizontalAlignment="Left" Margin="125,0,0,0" Width="500"/>
3131
</Grid>
3232
<Grid Margin="0, 0, 0, 12.5">
3333
<TextBlock Text="Music" VerticalAlignment="Center" Margin="0,0,25,0" HorizontalAlignment="Left"/>
34-
<TextBox BorderThickness="1" PlaceholderText="Custom Music Location" HorizontalAlignment="Left" Margin="125,0,0,0" Width="500" IsEnabled="False"/>
34+
<TextBox Name="MusicL" PlaceholderText="Custom Music Location" HorizontalAlignment="Left" Margin="125,0,0,0" Width="500"/>
3535
</Grid>
3636
<Grid Margin="0, 0, 0, 12.5">
3737
<TextBlock Text="Videos" VerticalAlignment="Center" Margin="0,0,25,0" HorizontalAlignment="Left"/>
38-
<TextBox BorderThickness="1" PlaceholderText="Custom Videos Location" HorizontalAlignment="Left" Margin="125,0,0,0" Width="500" IsEnabled="False"/>
38+
<TextBox Name="VideosL" PlaceholderText="Custom Videos Location" HorizontalAlignment="Left" Margin="125,0,0,0" Width="500"/>
3939
</Grid>
40+
<StackPanel Orientation="Horizontal">
41+
<Button Content="Save Locations" Name="SaveCustomL" HorizontalAlignment="Left" Click="SaveCustomL_Click" />
42+
<FontIcon Glyph="&#xE73E;" Name="SuccessMark" Margin="25,0,0,0"/>
43+
</StackPanel>
4044
</StackPanel>
4145
</Grid>
4246
<Grid Visibility="Collapsed" Name="AutoRefreshSetting">

Files UWP/SettingsPages/Preferences.xaml.cs

Lines changed: 178 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
using Windows.Storage;
22
using Windows.UI.Xaml.Controls;
3-
3+
using System;
4+
using Windows.UI.Xaml.Media;
5+
using Windows.UI;
6+
using System.IO;
47

58
namespace Files.SettingsPages
69
{
@@ -28,6 +31,40 @@ public Preferences()
2831
AutoRefreshSwitch.IsOn = false;
2932
}
3033

34+
if (localSettings.Values["customLocationsSetting"] != null)
35+
{
36+
if (localSettings.Values["customLocationsSetting"].Equals(true))
37+
{
38+
CustomLocationToggle.IsOn = true;
39+
DownloadsL.IsEnabled = true;
40+
DocumentsL.IsEnabled = true;
41+
PictureL.IsEnabled = true;
42+
MusicL.IsEnabled = true;
43+
VideosL.IsEnabled = true;
44+
SaveCustomL.IsEnabled = true;
45+
}
46+
else
47+
{
48+
CustomLocationToggle.IsOn = false;
49+
DownloadsL.IsEnabled = false;
50+
DocumentsL.IsEnabled = false;
51+
PictureL.IsEnabled = false;
52+
MusicL.IsEnabled = false;
53+
VideosL.IsEnabled = false;
54+
SaveCustomL.IsEnabled = false;
55+
}
56+
}
57+
else
58+
{
59+
CustomLocationToggle.IsOn = false;
60+
DownloadsL.IsEnabled = false;
61+
DocumentsL.IsEnabled = false;
62+
PictureL.IsEnabled = false;
63+
MusicL.IsEnabled = false;
64+
VideosL.IsEnabled = false;
65+
SaveCustomL.IsEnabled = false;
66+
}
67+
SuccessMark.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
3168
}
3269

3370
private void AutoRefreshSwitch_Toggled(object sender, Windows.UI.Xaml.RoutedEventArgs e)
@@ -42,5 +79,145 @@ private void AutoRefreshSwitch_Toggled(object sender, Windows.UI.Xaml.RoutedEven
4279
localSettings.Values["autoRefreshEnabledSetting"] = false;
4380
}
4481
}
82+
83+
private void ToggleSwitch_Toggled(object sender, Windows.UI.Xaml.RoutedEventArgs e)
84+
{
85+
if ((sender as ToggleSwitch).IsOn)
86+
{
87+
localSettings.Values["customLocationsSetting"] = true;
88+
DownloadsL.IsEnabled = true;
89+
DocumentsL.IsEnabled = true;
90+
PictureL.IsEnabled = true;
91+
MusicL.IsEnabled = true;
92+
VideosL.IsEnabled = true;
93+
SaveCustomL.IsEnabled = true;
94+
}
95+
else
96+
{
97+
localSettings.Values["customLocationsSetting"] = false;
98+
DownloadsL.IsEnabled = false;
99+
DocumentsL.IsEnabled = false;
100+
PictureL.IsEnabled = false;
101+
MusicL.IsEnabled = false;
102+
VideosL.IsEnabled = false;
103+
SaveCustomL.IsEnabled = false;
104+
}
105+
}
106+
107+
private async void SaveCustomL_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
108+
{
109+
StorageFolder newLocationSetting;
110+
if(DownloadsL.Text != null)
111+
{
112+
try
113+
{
114+
newLocationSetting = await StorageFolder.GetFolderFromPathAsync(DownloadsL.Text);
115+
localSettings.Values["DownloadsLocation"] = DownloadsL.Text;
116+
}
117+
catch (UnauthorizedAccessException)
118+
{
119+
await MainPage.permissionBox.ShowAsync();
120+
return;
121+
}
122+
catch (ArgumentException)
123+
{
124+
DownloadsL.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0));
125+
}
126+
catch (FileNotFoundException)
127+
{
128+
DownloadsL.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0));
129+
}
130+
}
131+
132+
if (DocumentsL.Text != null)
133+
{
134+
try
135+
{
136+
newLocationSetting = await StorageFolder.GetFolderFromPathAsync(DocumentsL.Text);
137+
localSettings.Values["DocumentsLocation"] = DocumentsL.Text;
138+
}
139+
catch (UnauthorizedAccessException)
140+
{
141+
await MainPage.permissionBox.ShowAsync();
142+
return;
143+
}
144+
catch (ArgumentException)
145+
{
146+
DocumentsL.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0));
147+
}
148+
catch (FileNotFoundException)
149+
{
150+
DocumentsL.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0));
151+
}
152+
}
153+
154+
if (PictureL.Text != null)
155+
{
156+
try
157+
{
158+
newLocationSetting = await StorageFolder.GetFolderFromPathAsync(PictureL.Text);
159+
localSettings.Values["PicturesLocation"] = PictureL.Text;
160+
}
161+
catch (UnauthorizedAccessException)
162+
{
163+
await MainPage.permissionBox.ShowAsync();
164+
return;
165+
}
166+
catch (ArgumentException)
167+
{
168+
PictureL.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0));
169+
}
170+
catch (FileNotFoundException)
171+
{
172+
PictureL.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0));
173+
}
174+
}
175+
176+
if (MusicL.Text != null)
177+
{
178+
try
179+
{
180+
newLocationSetting = await StorageFolder.GetFolderFromPathAsync(MusicL.Text);
181+
localSettings.Values["MusicLocation"] = MusicL.Text;
182+
}
183+
catch (UnauthorizedAccessException)
184+
{
185+
await MainPage.permissionBox.ShowAsync();
186+
return;
187+
}
188+
catch (ArgumentException)
189+
{
190+
MusicL.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0));
191+
}
192+
catch (FileNotFoundException)
193+
{
194+
MusicL.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0));
195+
}
196+
}
197+
198+
if (VideosL.Text != null)
199+
{
200+
try
201+
{
202+
newLocationSetting = await StorageFolder.GetFolderFromPathAsync(VideosL.Text);
203+
localSettings.Values["VideosLocation"] = VideosL.Text;
204+
}
205+
catch (UnauthorizedAccessException)
206+
{
207+
await MainPage.permissionBox.ShowAsync();
208+
return;
209+
}
210+
catch (ArgumentException)
211+
{
212+
VideosL.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0));
213+
}
214+
catch (FileNotFoundException)
215+
{
216+
VideosL.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0));
217+
}
218+
}
219+
220+
SuccessMark.Visibility = Windows.UI.Xaml.Visibility.Visible;
221+
}
45222
}
46223
}

0 commit comments

Comments
 (0)