Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e2abda2d14 | |||
| 97810b5575 | |||
| 1185770a94 | |||
| 25d88b0609 | |||
| 85c77787ce |
@@ -215,6 +215,17 @@ namespace Meade.net.Telescope.UnitTests
|
||||
Assert.That(exception.Message, Is.EqualTo($"Site {parameters} not allowed, must be between 1 and 4"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Action_Site_Count_WhenCalling_ThenReturnsFour()
|
||||
{
|
||||
ConnectTelescope();
|
||||
|
||||
string parameters = "Count";
|
||||
var result = _telescope.Action("site", parameters);
|
||||
|
||||
Assert.That(result, Is.EqualTo("4"));
|
||||
}
|
||||
|
||||
[TestCase("1", "#:SMHome#", "Home")]
|
||||
[TestCase("2", "#:SNClub#", "Club")]
|
||||
[TestCase("3", "#:SOGPS Site#", "GPS Site")]
|
||||
|
||||
@@ -18,7 +18,7 @@ using System.Runtime.InteropServices;
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(true)]
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("8b9fccb9-87ae-42f7-90af-079e13de6efb")]
|
||||
|
||||
@@ -5,6 +5,8 @@ using System.Collections;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using ASCOM.Astrometry;
|
||||
using ASCOM.Astrometry.AstroUtils;
|
||||
using ASCOM.Astrometry.NOVAS;
|
||||
@@ -35,6 +37,7 @@ namespace ASCOM.Meade.net
|
||||
[ProgId("ASCOM.MeadeGeneric.Telescope")]
|
||||
[ServedClassName("Meade Generic")]
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
[ComVisible(true)]
|
||||
public class Telescope : ReferenceCountedObjectBase, ITelescopeV3
|
||||
{
|
||||
/// <summary>
|
||||
@@ -77,6 +80,8 @@ namespace ASCOM.Meade.net
|
||||
/// Must be public for COM registration.
|
||||
/// </summary>
|
||||
public Telescope()
|
||||
{
|
||||
try
|
||||
{
|
||||
//todo move this out to IOC
|
||||
var util = new Util(); //Initialise util object
|
||||
@@ -88,6 +93,34 @@ namespace ASCOM.Meade.net
|
||||
|
||||
Initialise();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
var currentException = e;
|
||||
|
||||
while (currentException != null)
|
||||
{
|
||||
AppendException(sb, currentException);
|
||||
|
||||
currentException = currentException.InnerException;
|
||||
|
||||
if (currentException != null)
|
||||
sb.AppendLine("-----");
|
||||
}
|
||||
|
||||
MessageBox.Show(sb.ToString());
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private void AppendException(StringBuilder sb, Exception currentException)
|
||||
{
|
||||
sb.AppendLine(currentException.Message);
|
||||
sb.AppendLine();
|
||||
sb.AppendLine(currentException.StackTrace);
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
public Telescope( IUtil util, IUtilExtra utilExtra, IAstroUtils astroUtilities, ISharedResourcesWrapper sharedResourcesWrapper, IAstroMaths astroMaths)
|
||||
{
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace ASCOM.Meade.net
|
||||
[ProgId("ASCOM.MeadeGeneric.focuser")]
|
||||
[ServedClassName("Meade Generic")]
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
[ComVisible(true)]
|
||||
public class Focuser : ReferenceCountedObjectBase, IFocuserV3
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -18,7 +18,7 @@ using System.Runtime.InteropServices;
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(true)]
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("4ad7a6d4-6d54-4a9a-bbf3-895353e318f8")]
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace ASCOM.Meade.net
|
||||
driverProfile.DeviceType = "Telescope";
|
||||
driverProfile.WriteValue(DriverId, TraceStateProfileName, profileProperties.TraceLogger.ToString());
|
||||
driverProfile.WriteValue(DriverId, ComPortProfileName, profileProperties.ComPort);
|
||||
driverProfile.WriteValue(DriverId, GuideRateProfileName, profileProperties.GuideRateArcSecondsPerSecond.ToString(CultureInfo.CurrentCulture));
|
||||
driverProfile.WriteValue(DriverId, GuideRateProfileName, profileProperties.GuideRateArcSecondsPerSecond.ToString(CultureInfo.InvariantCulture));
|
||||
driverProfile.WriteValue(DriverId, PrecisionProfileName, profileProperties.Precision);
|
||||
}
|
||||
}
|
||||
@@ -170,7 +170,7 @@ namespace ASCOM.Meade.net
|
||||
driverProfile.DeviceType = "Telescope";
|
||||
profileProperties.ComPort = driverProfile.GetValue(DriverId, ComPortProfileName, string.Empty, ComPortDefault);
|
||||
profileProperties.TraceLogger = Convert.ToBoolean(driverProfile.GetValue(DriverId, TraceStateProfileName, string.Empty, TraceStateDefault));
|
||||
profileProperties.GuideRateArcSecondsPerSecond = double.Parse(driverProfile.GetValue(DriverId, GuideRateProfileName, string.Empty, GuideRateProfileNameDefault));
|
||||
profileProperties.GuideRateArcSecondsPerSecond = double.Parse(driverProfile.GetValue(DriverId, GuideRateProfileName, string.Empty, GuideRateProfileNameDefault), NumberFormatInfo.InvariantInfo);
|
||||
profileProperties.Precision = driverProfile.GetValue(DriverId, PrecisionProfileName, string.Empty, PrecisionDefault);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user