-
Notifications
You must be signed in to change notification settings - Fork 4
/
SettingsView.xaml
146 lines (140 loc) · 9.08 KB
/
SettingsView.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<Page
x:Class="SoftdocMusicPlayer.Views.SettingsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:helper="using:SoftdocMusicPlayer.Helpers"
xmlns:local="using:SoftdocMusicPlayer"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Style="{StaticResource PageStyle}"
xmlns:xaml="using:Windows.UI.Xaml"
xmlns:converters="using:Microsoft.Toolkit.Uwp.UI.Converters"
mc:Ignorable="d">
<Page.Resources>
<helper:EnumToBooleanConverter x:Key="EnumToBooleanConverter" EnumType="ElementTheme" />
<converters:BoolToVisibilityConverter x:Name="ReverseBoolToVisibility" FalseValue="Visible" TrueValue="Collapsed" />
</Page.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!--Settings title block-->
<TextBlock Grid.Row="0" x:Uid="Settings_Title" Style="{StaticResource PageTitleStyle}" Margin="{StaticResource MediumLeftRightMargin}" />
<ScrollViewer Grid.Row="1">
<Grid>
<StackPanel Grid.Row="1" x:Name="ContentArea" Margin="{StaticResource MediumLeftTopRightBottomMargin}" Padding="0,0,0,90">
<!--Add source section-->
<StackPanel>
<TextBlock x:Uid="Settings_Sources" Style="{StaticResource SubtitleTextBlockStyle}" />
<TextBlock x:Uid="Settings_Sources_Subtitle" Margin="{StaticResource XSmallTopMargin}" />
<HyperlinkButton x:Uid="Settings_ChooseFolder" Click="ChooseFolderButton_Click">
<HyperlinkButton.ContentTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" />
</DataTemplate>
</HyperlinkButton.ContentTemplate>
</HyperlinkButton>
</StackPanel>
<!--User Login Section-->
<StackPanel Margin="{StaticResource MediumTopMargin}">
<!--Title-->
<TextBlock x:Uid="Settings_User" Style="{ThemeResource SubtitleTextBlockStyle}" />
<!--User profile-->
<StackPanel Margin="{StaticResource SmallTopMargin}" Visibility="{x:Bind ViewModel.IsLoggedIn, Mode=OneWay}" Orientation="Horizontal">
<Ellipse Width="64" Height="64">
<Ellipse.Fill>
<ImageBrush ImageSource="{x:Bind ViewModel.User.Photo, Mode=OneWay}" Stretch="UniformToFill" />
</Ellipse.Fill>
</Ellipse>
<StackPanel Margin="{StaticResource SmallLeftMargin}">
<TextBlock Text="{x:Bind ViewModel.User.Name, Mode=OneWay}" Style="{ThemeResource BodyTextBlockStyle}" />
<TextBlock Text="{x:Bind ViewModel.User.UserPrincipalName, Mode=OneWay}" Style="{ThemeResource BodyTextBlockStyle}" Margin="{StaticResource XSmallTopMargin}" />
</StackPanel>
</StackPanel>
<!--Logout link-->
<HyperlinkButton x:Uid="Settings_LogOut"
Command="{x:Bind ViewModel.LogOutCommand}"
Visibility="{x:Bind ViewModel.IsLoggedIn, Mode=OneWay}"
Margin="{StaticResource XSmallTopMargin}">
<HyperlinkButton.ContentTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" />
</DataTemplate>
</HyperlinkButton.ContentTemplate>
</HyperlinkButton>
<!--Message-->
<TextBlock x:Uid="Settings_NoUserLoggedIn"
Margin="{StaticResource XSmallTopMargin}"
Style="{ThemeResource BodyTextBlockStyle}"
Visibility="{x:Bind ViewModel.IsLoggedIn, Mode=OneWay, Converter={StaticResource ReverseBoolToVisibility}}" />
<!--Login link-->
<HyperlinkButton x:Uid="Settings_LogIn"
Command="{x:Bind ViewModel.LogInCommand}"
Visibility="{x:Bind ViewModel.IsLoggedIn, Mode=OneWay, Converter={StaticResource ReverseBoolToVisibility}}"
Margin="{StaticResource XSmallTopMargin}">
<HyperlinkButton.ContentTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" />
</DataTemplate>
</HyperlinkButton.ContentTemplate>
</HyperlinkButton>
</StackPanel>
<!--End Login section-->
<!--Personalization section-->
<StackPanel Margin="{StaticResource MediumTopMargin}">
<!--Title-->
<TextBlock x:Uid="Settings_Personalization" Style="{ThemeResource SubtitleTextBlockStyle}" />
<!--Subtitle-->
<TextBlock x:Uid="Settings_Theme" Margin="{StaticResource SmallTopMargin}" />
<!--Theme selector-->
<StackPanel>
<!--Theme Light-->
<RadioButton x:Uid="Settings_Theme_Light"
Command="{x:Bind ViewModel.SwitchThemeCommand}"
IsChecked="{x:Bind ViewModel.ElementTheme, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Light, Mode=OneWay}"
Margin="{StaticResource SmallTopMargin}"
GroupName="AppTheme">
<RadioButton.CommandParameter>
<xaml:ElementTheme>Light</xaml:ElementTheme>
</RadioButton.CommandParameter>
</RadioButton>
<!--Theme Dark-->
<RadioButton x:Uid="Settings_Theme_Dark"
Command="{x:Bind ViewModel.SwitchThemeCommand}"
IsChecked="{x:Bind ViewModel.ElementTheme, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Dark, Mode=OneWay}"
Margin="{StaticResource XSmallTopMargin}"
GroupName="AppTheme">
<RadioButton.CommandParameter>
<xaml:ElementTheme>Dark</xaml:ElementTheme>
</RadioButton.CommandParameter>
</RadioButton>
<!--Theme Default-->
<RadioButton x:Uid="Settings_Theme_Default"
Command="{x:Bind ViewModel.SwitchThemeCommand}"
IsChecked="{x:Bind ViewModel.ElementTheme, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Default, Mode=OneWay}"
Margin="{StaticResource XSmallTopMargin}"
GroupName="AppTheme">
<RadioButton.CommandParameter>
<xaml:ElementTheme>Default</xaml:ElementTheme>
</RadioButton.CommandParameter>
</RadioButton>
</StackPanel>
</StackPanel>
<!--End Personalization section-->
<!--About section-->
<StackPanel Margin="{StaticResource MediumTopMargin}">
<!--Title-->
<TextBlock x:Uid="Settings_About" Style="{ThemeResource SubtitleTextBlockStyle}" />
<!--App version and description-->
<StackPanel Margin="{StaticResource SmallTopMargin}">
<TextBlock Style="{ThemeResource BodyTextBlockStyle}" Text="{x:Bind ViewModel.VersionDescription, Mode=OneWay}" />
<TextBlock x:Uid="Settings_AboutDescription" Margin="{StaticResource XSmallTopMargin}" Style="{ThemeResource BodyTextBlockStyle}" HorizontalAlignment="Left" />
</StackPanel>
</StackPanel>
<!--End About section-->
</StackPanel>
</Grid>
</ScrollViewer>
</Grid>
</Page>