File tree Expand file tree Collapse file tree 4 files changed +25
-6
lines changed Expand file tree Collapse file tree 4 files changed +25
-6
lines changed Original file line number Diff line number Diff line change 207
207
<Compile Include =" Search.xaml.cs" >
208
208
<DependentUpon >Search.xaml</DependentUpon >
209
209
</Compile >
210
+ <Compile Include =" Settings.cs" />
210
211
<Compile Include =" Settings.xaml.cs" >
211
212
<DependentUpon >Settings.xaml</DependentUpon >
212
213
</Compile >
Original file line number Diff line number Diff line change @@ -42,7 +42,8 @@ public static string GetFriendlyDate(DateTimeOffset d)
42
42
{
43
43
Windows . Storage . ApplicationDataContainer localSettings = Windows . Storage . ApplicationData . Current . LocalSettings ;
44
44
var elapsed = DateTimeOffset . Now - d ;
45
- string returnformat = Enum . Parse < TimeStyle > ( localSettings . Values [ "datetimeformat" ] . ToString ( ) ) == TimeStyle . Application ? "D" : "g" ;
45
+
46
+ string returnformat = Enum . Parse < TimeStyle > ( localSettings . Values [ LocalSettings . DateTimeFormat ] . ToString ( ) ) == TimeStyle . Application ? "D" : "g" ;
46
47
47
48
if ( elapsed . TotalDays > 7 )
48
49
{
Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using System . Collections . Generic ;
3
+ using System . Linq ;
4
+ using System . Text ;
5
+ using System . Threading . Tasks ;
6
+
7
+ namespace Files
8
+ {
9
+ public static class LocalSettings
10
+ {
11
+ public const string DateTimeFormat = "datetimeformat" ;
12
+ }
13
+ }
Original file line number Diff line number Diff line change @@ -53,17 +53,21 @@ private void DetectSidebarOpacity()
53
53
54
54
private void DetectDateTimeFormat ( )
55
55
{
56
- if ( localSettings . Values [ "datetimeformat" ] != null )
56
+ if ( localSettings . Values [ LocalSettings . DateTimeFormat ] != null )
57
57
{
58
- if ( localSettings . Values [ "datetimeformat" ] . ToString ( ) == "Application" )
58
+ if ( localSettings . Values [ LocalSettings . DateTimeFormat ] . ToString ( ) == "Application" )
59
59
{
60
60
DisplayedTimeStyle = TimeStyle . Application ;
61
61
}
62
- else if ( localSettings . Values [ "datetimeformat" ] . ToString ( ) == "System" )
62
+ else if ( localSettings . Values [ LocalSettings . DateTimeFormat ] . ToString ( ) == "System" )
63
63
{
64
64
DisplayedTimeStyle = TimeStyle . System ;
65
65
}
66
66
}
67
+ else
68
+ {
69
+ localSettings . Values [ LocalSettings . DateTimeFormat ] = "System" ;
70
+ }
67
71
}
68
72
69
73
private async void DetectCustomLocations ( )
@@ -243,11 +247,11 @@ public TimeStyle DisplayedTimeStyle
243
247
Set ( ref _DisplayedTimeStyle , value ) ;
244
248
if ( value . Equals ( TimeStyle . Application ) )
245
249
{
246
- localSettings . Values [ "datetimeformat" ] = "Application" ;
250
+ localSettings . Values [ LocalSettings . DateTimeFormat ] = "Application" ;
247
251
}
248
252
else if ( value . Equals ( TimeStyle . System ) )
249
253
{
250
- localSettings . Values [ "datetimeformat" ] = "System" ;
254
+ localSettings . Values [ LocalSettings . DateTimeFormat ] = "System" ;
251
255
}
252
256
}
253
257
}
You can’t perform that action at this time.
0 commit comments