Moved IsGuiding to SharedResourcesWrapper
This commit is contained in:
@@ -145,6 +145,8 @@ namespace Meade.net.Telescope.UnitTests
|
||||
_sharedResourcesWrapperMock.SetupGet(x => x.IsParked).Returns(() => _isParked);
|
||||
_sharedResourcesWrapperMock.SetupGet(x => x.ParkedPosition).Returns(() => _parkedPosition);
|
||||
|
||||
_sharedResourcesWrapperMock.SetupProperty(x => x.IsGuiding);
|
||||
|
||||
_astroMathsMock
|
||||
.Setup(x => x.ConvertHozToEq(It.IsAny<DateTime>(), It.IsAny<double>(), It.IsAny<double>(),
|
||||
It.IsAny<HorizonCoordinates>())).Returns(() => new EquatorialCoordinates { Declination = _testProperties.declination, RightAscension = _testProperties.rightAscension });
|
||||
|
||||
@@ -140,8 +140,6 @@ namespace ASCOM.Meade.net
|
||||
Initialise(nameof(Telescope));
|
||||
}
|
||||
|
||||
private bool _isGuiding;
|
||||
|
||||
//
|
||||
// PUBLIC COM INTERFACE ITelescopeV3 IMPLEMENTATION
|
||||
//
|
||||
@@ -1607,7 +1605,7 @@ namespace ASCOM.Meade.net
|
||||
switch (rate.Compare(0))
|
||||
{
|
||||
case ComparisonResult.Equals:
|
||||
if (!_isGuiding)
|
||||
if (!SharedResourcesWrapper.IsGuiding)
|
||||
{
|
||||
SetSlewingMinEndTime();
|
||||
}
|
||||
@@ -1638,7 +1636,7 @@ namespace ASCOM.Meade.net
|
||||
switch (rate.Compare(0))
|
||||
{
|
||||
case ComparisonResult.Equals:
|
||||
if (!_isGuiding)
|
||||
if (!SharedResourcesWrapper.IsGuiding)
|
||||
{
|
||||
SetSlewingMinEndTime();
|
||||
}
|
||||
@@ -1731,7 +1729,7 @@ namespace ASCOM.Meade.net
|
||||
if (IsSlewingToTarget())
|
||||
throw new InvalidOperationException("Unable to PulseGuide whilst slewing to target.");
|
||||
|
||||
_isGuiding = true;
|
||||
SharedResourcesWrapper.IsGuiding = true;
|
||||
try
|
||||
{
|
||||
if (SharedResourcesWrapper.MovingPrimary &&
|
||||
@@ -1814,7 +1812,7 @@ namespace ASCOM.Meade.net
|
||||
}
|
||||
finally
|
||||
{
|
||||
_isGuiding = false;
|
||||
SharedResourcesWrapper.IsGuiding = false;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -2306,7 +2304,7 @@ namespace ASCOM.Meade.net
|
||||
|
||||
private bool MovingAxis()
|
||||
{
|
||||
if (_isGuiding)
|
||||
if (SharedResourcesWrapper.IsGuiding)
|
||||
return false;
|
||||
|
||||
return SharedResourcesWrapper.MovingPrimary || SharedResourcesWrapper.MovingSecondary;
|
||||
@@ -2358,7 +2356,7 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
CheckConnected("IsSlewingToTarget");
|
||||
|
||||
if (_isGuiding)
|
||||
if (SharedResourcesWrapper.IsGuiding)
|
||||
return false;
|
||||
|
||||
string result;
|
||||
|
||||
@@ -583,5 +583,12 @@ namespace ASCOM.Meade.net
|
||||
get => _isTargetCoordinateInitRequired;
|
||||
internal set => _isTargetCoordinateInitRequired.Set(value);
|
||||
}
|
||||
|
||||
private static readonly ThreadSafeValue<bool> _isGuiding = false;
|
||||
public static bool IsGuiding
|
||||
{
|
||||
get => _isGuiding;
|
||||
internal set => _isGuiding.Set(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,8 @@ namespace ASCOM.Meade.net.Wrapper
|
||||
DateTime EarliestNonSlewingTime { get; set; }
|
||||
|
||||
bool IsTargetCoordinateInitRequired { get; set; }
|
||||
|
||||
bool IsGuiding { get; set; }
|
||||
}
|
||||
|
||||
public class SharedResourcesWrapper : ISharedResourcesWrapper
|
||||
@@ -189,5 +191,11 @@ namespace ASCOM.Meade.net.Wrapper
|
||||
get => SharedResources.IsTargetCoordinateInitRequired;
|
||||
set => SharedResources.IsTargetCoordinateInitRequired = value;
|
||||
}
|
||||
|
||||
public bool IsGuiding
|
||||
{
|
||||
get => SharedResources.IsGuiding;
|
||||
set => SharedResources.IsGuiding = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user