Added feature where setup dialog controls are disabled when the telescope or focuser is attached

This commit is contained in:
2019-08-25 19:45:54 +01:00
parent 5a0b3bba25
commit 2cc27788c8
2 changed files with 33 additions and 2 deletions
+15 -1
View File
@@ -1,6 +1,5 @@
using System;
using System.ComponentModel;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows.Forms;
@@ -116,5 +115,20 @@ namespace ASCOM.Meade.net
{
UpdateOKButton();
}
public void SetReadOnlyMode()
{
foreach (Control control in Controls)
{
control.Enabled = false;
}
cmdCancel.Enabled = true;
//cmdOK.Enabled = false;
//comboBoxComPort.Enabled = false;
//chkTrace.Enabled = false;
//txtGuideRate.Enabled = false;
//cboPrecision.Enabled = false;
}
}
}
+17
View File
@@ -15,6 +15,7 @@
//
using System;
using System.Collections.Generic;
using System.Linq;
using ASCOM.Utilities;
namespace ASCOM.Meade.net
@@ -227,6 +228,11 @@ namespace ASCOM.Meade.net
{
f.SetProfile(profileProperties);
if (IsConnected())
{
f.SetReadOnlyMode();
}
var result = f.ShowDialog();
if (result == System.Windows.Forms.DialogResult.OK)
{
@@ -332,6 +338,17 @@ namespace ASCOM.Meade.net
}
}
public static bool IsConnected()
{
foreach (var device in _connectedDevices)
{
if (device.Value.Count > 0)
return true;
}
return false;
}
public static bool IsConnected(string deviceId)
{
if (_connectedDevices.ContainsKey(deviceId))