Skip to content

Commit

Permalink
Updated logic for when the update sound is played.
Browse files Browse the repository at this point in the history
  • Loading branch information
badvectors committed Nov 2, 2024
1 parent 1ff1312 commit d89ea9c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
19 changes: 13 additions & 6 deletions Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class Plugin : IPlugin, IDisposable
public string Name => "ATIS Editor";
public static string DisplayName => "ATIS Editor";

public static readonly Version Version = new Version(2, 5);
public static readonly Version Version = new Version(2, 6);
private static readonly string VersionUrl = "https://raw.githubusercontent.com/badvectors/ATISPlugin/master/Version.json";

private static readonly string ZuluUrl = "https://raw.githubusercontent.com/badvectors/ATISPlugin/master/Zulu.json";
Expand Down Expand Up @@ -264,7 +264,7 @@ private void OnUpdate(object sender, EventArgs e)
Editor?.RefreshEvent.Invoke(this, null);
}

private void PlayUpdateSound()
private static void PlayUpdateSound()
{
var sound = Path.Combine(Helpers.GetProgramFolder(), "wav", "AIS.wav");

Expand All @@ -275,18 +275,23 @@ private void PlayUpdateSound()

private void OnMETARUpdate(int number)
{
ShowEditorWindow();
if (!IsEditorOpen())
{
ShowEditorWindow();

Editor.Change(number);

PlayUpdateSound();
}

if (Editor.Number == number)
{
Editor.RefreshEvent.Invoke(null, null);
}
else
{
Editor.Change(number);
PlayUpdateSound();
}

PlayUpdateSound();
}

private void GetData()
Expand Down Expand Up @@ -315,6 +320,8 @@ private void ATISMenu_Click(object sender, EventArgs e)
ShowEditorWindow();
}

private static bool IsEditorOpen() => Editor.Visible ? true : false;

private static void ShowEditorWindow()
{
if (ATISData == null || Sectors == null || Airspace == null)
Expand Down
2 changes: 1 addition & 1 deletion Version.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"Major": 2,
"Minor": 5
"Minor": 6
}

0 comments on commit d89ea9c

Please sign in to comment.