-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainPage.xaml.cs
60 lines (58 loc) · 2.38 KB
/
MainPage.xaml.cs
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
using Microsoft.Toolkit.Uwp.UI.Helpers;
using System;
using System.IO;
using Windows.Storage;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
// https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x804 上介绍了“空白页”项模板
namespace CountDown_Day {
/// <summary>
/// Can be used on itself or to navigate to a blank page inside the Frame.
/// </summary>
public sealed partial class MainPage : Page {
StorageFolder localfolder;
public static bool tcolor = false;
ThemeListener Listener = new ThemeListener();
public MainPage() {
this.InitializeComponent();
Listener.ThemeChanged += Listener_ThemeChanged;
localfolder = ApplicationData.Current.LocalFolder;
}
private void Grid_Num_Loaded(object sender, RoutedEventArgs e) {
}
private void Page_SizeChanged(object sender, SizeChangedEventArgs e) {
this.ReLoadItems(nowid);
}
private void TTime_Tapped(object sender, TappedRoutedEventArgs e) {
if (tcolor) {
this.TextDarkToLight.Begin();
}
else {
this.TextLightToDark.Begin();
}
tcolor = !tcolor;
if (!File.Exists(localfolder.Path + "\\global.ini")) {
try {
localfolder.CreateFileAsync("global.ini", CreationCollisionOption.FailIfExists);
}
catch (Exception ex) {
var dialog = new MessageDialog("Cannot Create File:" + localfolder.Path + "\\global.ini\n" + ex.ToString(), ex.Message);
dialog.Options = MessageDialogOptions.AcceptUserInputAfterDelay;
dialog.ShowAsync();
}
return;
}
string[] glb = File.ReadAllLines(localfolder.Path + "\\global.ini");
File.Delete(localfolder.Path + "\\global.ini");
foreach (var v in glb) {
if (v.ToLower().Contains("tcolor"))
continue;
else
File.AppendAllText(localfolder.Path + "\\global.ini", v);
}
File.AppendAllText(localfolder.Path + "\\global.ini", "TColor=" + Convert.ToString(tcolor));
}
}
}