Show the what's new after connect if not seen yet

This commit is contained in:
Lars Brubaker 2018-04-26 16:41:51 -07:00
parent 65c76fa0f9
commit 8ad0dd293c
3 changed files with 32 additions and 14 deletions

View file

@ -1,6 +1,10 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using MatterHackers.Agg.UI;
using MatterHackers.MatterControl.DataStorage;
using Newtonsoft.Json;
namespace MatterHackers.MatterControl
{
@ -83,6 +87,8 @@ namespace MatterHackers.MatterControl
this.Language = this.get("Language");
}
public event EventHandler Changed;
public static UserSettings Instance
{
get
@ -103,6 +109,21 @@ namespace MatterHackers.MatterControl
}
}
public bool HasLookedAtWhatsNew()
{
// If the last time what's new link was clicked is older than the main application show the button
string filePath = Assembly.GetExecutingAssembly().Location;
DateTime installTime = new FileInfo(filePath).LastWriteTime;
var lastReadWhatsNew = UserSettings.Instance.get(UserSettingsKey.LastReadWhatsNew);
DateTime whatsNewReadTime = installTime;
if (lastReadWhatsNew != null)
{
whatsNewReadTime = JsonConvert.DeserializeObject<DateTime>(lastReadWhatsNew);
}
return whatsNewReadTime > installTime;
}
public string Language { get; private set; }
public UserSettingsFields Fields { get; private set; } = new UserSettingsFields();
@ -140,6 +161,8 @@ namespace MatterHackers.MatterControl
setting.Value = value;
setting.Commit();
Changed?.Invoke(this, null);
}
public double LibraryViewWidth