Skip to content

Commit

Permalink
+ Update info
Browse files Browse the repository at this point in the history
  • Loading branch information
huiyadanli committed Nov 14, 2017
1 parent f4aff39 commit ec6a47c
Show file tree
Hide file tree
Showing 11 changed files with 456 additions and 265 deletions.
22 changes: 19 additions & 3 deletions PasteEx/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace PasteEx
Expand All @@ -19,8 +20,8 @@ public static void Start()
{
DateTime last = Properties.Settings.Default.lastBootTime;
DateTime now = DateTime.Now;
int day = now.Day - last.Day;
if (day < 17) { return; }
TimeSpan interval = now.Subtract(last);
if (interval.Days < 17) { return; }
GUID = Device.Value();
string oldGUID = Properties.Settings.Default.guid;
Expand All @@ -32,11 +33,26 @@ public static void Start()
Properties.Settings.Default.lastBootTime = now;
Properties.Settings.Default.Save();
}
catch(Exception ex)
catch (Exception ex)
{
Logger.Error(ex);
}
});
}

public static Dictionary<String, String> GetUpdateInfo()
{
try
{
string json = LCHelper.GetSoftInfo();
Dictionary<String, String> dic = EasyJson.Parse(json);
return dic;
}
catch (Exception ex)
{
Logger.Error(ex);
}
return null;
}
}
}
10 changes: 10 additions & 0 deletions PasteEx/FormSetting.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions PasteEx/FormSetting.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PasteEx
Expand Down Expand Up @@ -136,5 +138,16 @@ private void linkLabels_LinkClicked(object sender, LinkLabelLinkClickedEventArgs
{
System.Diagnostics.Process.Start(e.Link.LinkData as string);
}

private async void btnGetUpdateInfo_Click(object sender, EventArgs e)
{
Task<Dictionary<String, String>> t = new Task<Dictionary<String, String>>(Client.GetUpdateInfo);
t.Start();
var dic = await t;
if (dic != null)
{
MessageBox.Show(dic["version"]);
}
}
}
}
Loading

0 comments on commit ec6a47c

Please sign in to comment.