Skip to content

Commit adb6ebb

Browse files
committed
bugs fixed
1 parent b97ea41 commit adb6ebb

File tree

3 files changed

+26
-29
lines changed

3 files changed

+26
-29
lines changed

Classes/MyAppData.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public string StoragePath
155155
/// </summary>
156156
public void Save()
157157
{
158-
string savePath = StoragePath + (StoragePath.EndsWith("//") ? "" : "//") + DateTime.Today.ToString("yyyyMMdd") + ".json";
158+
string savePath = StoragePath + (StoragePath.EndsWith("\\") ? "" : "\\") + DateTime.Today.ToString("yyyyMMdd") + ".json";
159159
string Content = MyDataHelper.CoverObjectToJson(AllDays[DateTime.Today]);
160160

161161
MyDataHelper.WriteFile(savePath, Content);
@@ -169,7 +169,7 @@ public void Load(DateTime LoadDate)
169169
{
170170
try
171171
{
172-
string loadPath = StoragePath + (StoragePath.EndsWith("//") ? "" : "//") + LoadDate.ToString("yyyyMMdd") + ".json";
172+
string loadPath = StoragePath + (StoragePath.EndsWith("\\") ? "" : "\\") + LoadDate.ToString("yyyyMMdd") + ".json";
173173
string Json = MyDataHelper.ReadFile(loadPath);
174174

175175
if (!AllDays.ContainsKey(LoadDate))

Classes/MyDay.cs

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,37 +25,34 @@ public class MyDay
2525
/// 获取今日小结,即为时间线内相同软件使用时间合并后的列表
2626
/// </summary>
2727
/// <returns>今日小结 - Dictionary<string, TimeSpan></returns>
28-
public Dictionary<string, Software> OverView
29-
{
30-
get
28+
public Dictionary<string, Software> GetOverView()
29+
{
30+
Dictionary<string, Software> overView = new Dictionary<string, Software>();
31+
32+
foreach (MyTimeDuration item in TimeLine)
3133
{
32-
Dictionary<string, Software> overView = new Dictionary<string, Software>();
34+
string nowAppName = item.TimeDurationTask.ApplicationName;
35+
if (string.IsNullOrEmpty(nowAppName)) continue;
36+
37+
TimeSpan duration = item.Duration;
3338

34-
foreach (MyTimeDuration item in TimeLine)
39+
if (overView.ContainsKey(nowAppName))
40+
overView[nowAppName].Duration += duration;
41+
else
3542
{
36-
string nowAppName = item.TimeDurationTask.ApplicationName;
37-
if (string.IsNullOrEmpty(nowAppName)) continue;
38-
39-
TimeSpan duration = item.Duration;
40-
41-
if (overView.ContainsKey(nowAppName))
42-
overView[nowAppName].Duration += duration;
43-
else
44-
{
45-
Software result =
46-
new Software()
47-
{
48-
Duration = item.Duration,
49-
Name = nowAppName,
50-
Icon = MyDataHelper.BitmapToBitmapImage(
51-
MyDataHelper.Base64StringToImage(item.TimeDurationTask.ApplicationIcon_Base64))
52-
};
53-
overView.Add(nowAppName, result);
54-
}
43+
Software result =
44+
new Software()
45+
{
46+
Duration = item.Duration,
47+
Name = nowAppName,
48+
Icon = MyDataHelper.BitmapToBitmapImage(
49+
MyDataHelper.Base64StringToImage(item.TimeDurationTask.ApplicationIcon_Base64))
50+
};
51+
overView.Add(nowAppName, result);
5552
}
56-
57-
return overView;
5853
}
54+
55+
return overView;
5956
}
6057
}
6158

ViewModels/MainPageViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ private void Timer_Tick(object sender, EventArgs e)
8181
if (!((App)Application.Current).appData.AllDays.ContainsKey(displayDate))
8282
((App)Application.Current).appData.Load(displayDate);
8383

84-
Overview = PrintOverview(((App)Application.Current).appData.AllDays[displayDate].OverView);
84+
Overview = PrintOverview(((App)Application.Current).appData.AllDays[displayDate].GetOverView());
8585
SourceData = PrintSourceData(((App)Application.Current).appData.AllDays[displayDate].TimeLine);
8686
}
8787

0 commit comments

Comments
 (0)