Skip to content

Commit

Permalink
Showing release notes when going into a new version
Browse files Browse the repository at this point in the history
  • Loading branch information
rappen committed Nov 24, 2024
1 parent 74f3a15 commit 0d08c7b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
1 change: 1 addition & 0 deletions LCG-UDG/LCG-UDG-Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@
</Compile>
<Compile Include="Generation\GenerationUtils.cs" />
<Compile Include="Metadata\EntityMetadataProxy.cs" />
<Compile Include="Settings\GlobalSettings.cs" />
<Compile Include="Settings\TemplateSettings.cs" />
<Compile Include="Generation\Extensions.cs" />
<Compile Include="Generation\IConstantFileWriter.cs" />
Expand Down
21 changes: 19 additions & 2 deletions LCG-UDG/LCG.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<EntityMetadataProxy> entities;
private Dictionary<string, int> groupBoxHeights;
Expand All @@ -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<MessageBusEventArgs> OnOutgoingMessage;

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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(() =>
Expand Down
7 changes: 7 additions & 0 deletions LCG-UDG/Settings/GlobalSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Rappen.XTB.LCG
{
public class GlobalSettings
{
public string CurrentVersion { get; set; }
}
}

0 comments on commit 0d08c7b

Please sign in to comment.