Exemple #1
0
 public void SlewToCoordinatesAsync(double RightAscension, double Declination)
 {
     CheckConnected();
     if (Platform.IsTracking)
     {
         throw new InvalidOperationException("cannot SlewToCoordinatesAsync when platform is tracking");
     }
     m_mount.SlewToCoordinatesAsync(RightAscension, Declination);
 }
 private void SlewButton_Click(object sender, EventArgs e)
 {
     try
     {
         driver.SlewToCoordinatesAsync(double.Parse(RATextBox.Text), double.Parse(DecTextBox.Text));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 private void btnSlewToCoords_Click(object sender, EventArgs e)
 {
     if (IsConnected)
     {
         try
         {
             driver.SlewToCoordinatesAsync(0.0, 0.0);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }
Exemple #4
0
 private void btnGoto_Click(object sender, EventArgs e)
 {
     driver.SlewToCoordinatesAsync(Convert.ToDouble(tbNewRA.Text), Convert.ToDouble(tbNewDE.Text));
 }
        public void Test_Goto_NoMovement()
        {
            Assert.IsFalse(device.Connected);
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SlewToCoordinates(-0.1, 0));
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SlewToCoordinates(+24.1, 0));
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SlewToCoordinates(0, -91));
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SlewToCoordinates(0, +91));
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SlewToCoordinatesAsync(-0.1, 0));
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SlewToCoordinatesAsync(+24.1, 0));
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SlewToCoordinatesAsync(0, -91));
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SlewToCoordinatesAsync(0, +91));
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.TargetRightAscension = -0.1);
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.TargetRightAscension = +24.1);
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.TargetDeclination    = -91);
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.TargetDeclination    = +91);

            device.Connected = true;
            Assert.IsTrue(device.Connected);
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SlewToCoordinates(-0.1, 0));
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SlewToCoordinates(+24.1, 0));
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SlewToCoordinates(0, -91));
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SlewToCoordinates(0, +91));
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SlewToCoordinatesAsync(-0.1, 0));
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SlewToCoordinatesAsync(+24.1, 0));
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SlewToCoordinatesAsync(0, -91));
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SlewToCoordinatesAsync(0, +91));
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.TargetRightAscension = -0.1);
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.TargetRightAscension = +24.1);
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.TargetDeclination    = -91);
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.TargetDeclination    = +91);

            Assert.AreEqual(PierSide.pierWest, device.SideOfPier);
            double target_ra = device.RightAscension, target_dec = device.Declination;

            device.SlewToCoordinatesAsync(target_ra, target_dec);
            Assert.AreEqual(target_ra, device.TargetRightAscension);
            Assert.AreEqual(target_dec, device.TargetDeclination);
            Assert.IsTrue(device.Slewing);
            for (int i = 0; i < 10; i++)
            {
                System.Threading.Thread.Sleep(200);
                Assert.AreEqual(target_ra, device.TargetRightAscension);
                Assert.AreEqual(target_dec, device.TargetDeclination);
                if (device.Tracking)
                {
                    break;
                }
                Assert.IsTrue(device.Slewing);
                Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0));
            }
            Assert.IsTrue(device.Tracking);
            Assert.AreEqual(PierSide.pierWest, device.SideOfPier);

            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SlewToCoordinates(-24.1, 0));
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SlewToCoordinates(+24.1, 0));
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SlewToCoordinates(0, -91));
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SlewToCoordinates(0, +91));
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SlewToCoordinatesAsync(-24.1, 0));
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SlewToCoordinatesAsync(+24.1, 0));
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SlewToCoordinatesAsync(0, -91));
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SlewToCoordinatesAsync(0, +91));
        }