public override bool RunSetupDialog()
 {
     _oat = new ASCOM.DriverAccess.Telescope("ASCOM.OpenAstroTracker.Telescope");
     _oat.SetupDialog();
     _oat.Dispose();
     _oat = null;
     return(true);
 }
Example #2
0
        private void buttonChoose_Click(object sender, EventArgs e)
        {
            string choice = ASCOM.DriverAccess.Telescope.Choose(Properties.Settings.Default.DriverId);

            if (choice != Properties.Settings.Default.DriverId)
            {
                Properties.Settings.Default.DriverId = choice;
                if (driver != null)
                {
                    driver.Dispose();
                    driver = null;
                }
            }
            SetUIState();
        }
Example #3
0
        public static void FreeMount()
        {
            lock (lockObject)
            {
                Debug.Assert(MountUseCnt == 0);

                if (s_mount != null)
                {
                    s_mount.Dispose();
                    s_mount = null;
                }

                if (s_switch != null)
                {
                    s_switch.Dispose();
                    s_switch = null;
                }
            }
        }
Example #4
0
        private static void InstantiateMount()
        {
            string mountDriverId, switchDriverId;
            short  switchIdx;

            GetMountDriverIds(out mountDriverId, out switchDriverId, out switchIdx);

            if (mountDriverId.Length == 0)
            {
                throw new InvalidOperationException("Missing mount selection");
            }

            ASCOM.DriverAccess.Telescope mount = null;
            ASCOM.DriverAccess.Switch    sw    = null;
            try
            {
                mount = new ASCOM.DriverAccess.Telescope(mountDriverId);
                if (switchDriverId.Length > 0)
                {
                    sw = new ASCOM.DriverAccess.Switch(switchDriverId);
                }
            }
            catch (Exception)
            {
                mount.Dispose();
                if (sw != null)
                {
                    sw.Dispose();
                }
                throw;
            }

            s_mount     = mount;
            s_switch    = sw;
            s_switchIdx = switchIdx;
        }
 public void tearDown()
 {
     device.Dispose();
     device = null;
 }