Skip to content

Commit

Permalink
Project Templates - Add check that they are running on Platform 7.
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter-Simpson committed Aug 1, 2024
1 parent 970daac commit b071b32
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ public partial class LocalServerForm : Form
public LocalServerForm(TraceLogger TLSupplied)
{
InitializeComponent();

TL = TLSupplied; // Make sure we use the trace logger that has been created by the calling method

TL.LogMessage("LocalServerForm", $"Initialising ASCOM classes.");
InitASCOMClasses();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Windows.Forms;
using EnvDTE;
using System.IO;
using ASCOM.Utilities;

namespace ASCOM.Setup
{
Expand Down Expand Up @@ -60,10 +61,26 @@ public void RunStarted(object automationObject, Dictionary<string, string> repla
DialogResult dialogResult = DialogResult.Cancel;
try
{
// Display a form to the user. The form collects
// input for the custom message.
inputForm = new LocalServerForm(TL); // Pass our trace logger into the form so all Wizard trace goes into one file
dialogResult = inputForm.ShowDialog();
// Check whether we are on Platform 7, if not, say this template requires Platform 7

Util util = new Util();
TL.LogMessage("RunStarted", $"Utilities created, Major version: {util.MajorVersion}, Platform version: {util.PlatformVersion}.");

if (util.MajorVersion < 7) // Platform 7 or later is not installed
{
TL.LogMessage("RunStarted", $"Showing wrong Platform dialogue.");
MessageBox.Show($"This template requires Platform 7 or later, you are running Platform {util.PlatformVersion}.", "Incompatible ASCOM Platform version", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

TL.LogMessage("RunStarted", $"Ending application.");
}
else // Platform 7 or later is installed
{
// Display a form to the user. The form collects input for the custom message.
TL.LogMessage("RunStarted", $"Creating form...");
inputForm = new LocalServerForm(TL); // Pass our trace logger into the form so all Wizard trace goes into one file
TL.LogMessage("RunStarted", $"Showing form...");
dialogResult = inputForm.ShowDialog();
}
}
catch (Exception ex)
{
Expand Down

0 comments on commit b071b32

Please sign in to comment.