From 0d08c7b5b390efa45355bc88c0dcde39e4876b4f Mon Sep 17 00:00:00 2001 From: Jonas Rapp Date: Sun, 24 Nov 2024 18:20:59 +0100 Subject: [PATCH] Showing release notes when going into a new version --- LCG-UDG/LCG-UDG-Common.csproj | 1 + LCG-UDG/LCG.cs | 21 +++++++++++++++++++-- LCG-UDG/Settings/GlobalSettings.cs | 7 +++++++ 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 LCG-UDG/Settings/GlobalSettings.cs diff --git a/LCG-UDG/LCG-UDG-Common.csproj b/LCG-UDG/LCG-UDG-Common.csproj index 45b7447..0231952 100644 --- a/LCG-UDG/LCG-UDG-Common.csproj +++ b/LCG-UDG/LCG-UDG-Common.csproj @@ -239,6 +239,7 @@ + diff --git a/LCG-UDG/LCG.cs b/LCG-UDG/LCG.cs index aee0463..b50e5b6 100644 --- a/LCG-UDG/LCG.cs +++ b/LCG-UDG/LCG.cs @@ -38,6 +38,7 @@ public partial class LCG : PluginControlBase, IGitHubPlugin, IPayPalPlugin, IAbo private readonly AppInsights ai2; private readonly string commonsettingsfile = "[Common]"; + private readonly string globalsettingsfile = "[Global]"; private object checkedrow; private List entities; private Dictionary groupBoxHeights; @@ -59,8 +60,7 @@ public partial class LCG : PluginControlBase, IGitHubPlugin, IPayPalPlugin, IAbo public string Version => Assembly.GetExecutingAssembly().GetName().Version.ToString(); - // public string HelpUrl => isUML ? "https://jonasr.app/UML" : "https://github.com/rappen/LCG-UDG/blob/master/README.md"; - public string HelpUrl => templFormat != TemplateFormat.Constants ? "https://jonasr.app/UML" : "https://github.com/rappen/LCG-UDG/blob/master/README.md"; + public string HelpUrl => isUML ? "https://jonasr.app/UML" : "https://jonasr.app/LCG"; public event EventHandler OnOutgoingMessage; @@ -330,6 +330,7 @@ private void LCG_ConnectionUpdated(object sender, ConnectionUpdatedEventArgs e) private void LCG_Load(object sender, EventArgs e) { + LoadGlobalSetting(); if (settings.TemplateSettings == null) { LoadCommonSettings(); @@ -1527,6 +1528,22 @@ private void LoadEntities() }); } + private void LoadGlobalSetting() + { + var version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); + if (!SettingsManager.Instance.TryLoad(GetType(), out GlobalSettings globalsettings, SettingsFileName(isUML, globalsettingsfile))) + { + globalsettings = new GlobalSettings(); + } + if (!version.Equals(globalsettings.CurrentVersion)) + { + // Reset some settings when new version is deployed + globalsettings.CurrentVersion = version; + SettingsManager.Instance.Save(GetType(), globalsettings, SettingsFileName(isUML, globalsettingsfile)); + UrlUtils.OpenUrl($"{HelpUrl}/releases/#{version}"); + } + } + private void CountingCompleted() { UpdateUI(() => diff --git a/LCG-UDG/Settings/GlobalSettings.cs b/LCG-UDG/Settings/GlobalSettings.cs new file mode 100644 index 0000000..6e6bae8 --- /dev/null +++ b/LCG-UDG/Settings/GlobalSettings.cs @@ -0,0 +1,7 @@ +namespace Rappen.XTB.LCG +{ + public class GlobalSettings + { + public string CurrentVersion { get; set; } + } +} \ No newline at end of file