Exemple #1
0
        private void Dispose(bool disposing)
        {
            if (disposed)
            {
                return;
            }

            if (disposing)
            {
                // cleanup managed resources (none to cleanup for now)
            }

            // Clean up the tracelogger and util objects
            if (m_mount != null)
            {
                SharedResources.DisconnectMount();
                m_mount  = null;
                m_camera = null;
            }

            SharedResources.PutTraceLogger();
            tl = null;

            utilities.Dispose();
            utilities = null;
            astroUtilities.Dispose();
            astroUtilities = null;
            transform.Dispose();
            transform = null;

            disposed = true;
        }
Exemple #2
0
 private void clearSwitch_Click(object sender, EventArgs e)
 {
     settings.Set("switchDriverId", String.Empty);
     switchDriverName.Text = DeviceName("Switch", String.Empty);
     SharedResources.FreeMount();
     LoadSwitches();
 }
Exemple #3
0
 private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (m_tl != null)
     {
         SharedResources.PutTraceLogger();
         m_tl = null;
     }
 }
Exemple #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EqPlatformAdapter"/> class.
        /// Must be public for COM registration.
        /// </summary>
        public Camera()
        {
            driverID = Marshal.GenerateProgIdForType(this.GetType());

            tl = SharedResources.GetTraceLogger();
            tl.LogMessage("Camera", "Starting initialisation");
            tl.LogMessage("Camera", "Completed initialisation");
        }
Exemple #5
0
 private void switchSetup_Click(object sender, EventArgs e)
 {
     try
     {
         SharedResources.SetupSwitch();
     }
     catch (Exception ex)
     {
         m_tl.LogMessage("MainForm", ex.ToString());
         string msg = String.Format("Could not open switch setup:\n\n{0}\n\nPlease resolve the problem and try again.", ex.Message);
         MessageBox.Show(msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemple #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EqPlatformAdapter"/> class.
        /// Must be public for COM registration.
        /// </summary>
        public Telescope()
        {
            driverID = Marshal.GenerateProgIdForType(this.GetType());

            tl = SharedResources.GetTraceLogger();

            tl.LogMessage("Telescope", "Starting initialisation");

            utilities      = new Util();       //Initialise util object
            astroUtilities = new AstroUtils(); // Initialise astro utilities object
            transform      = new Transform();

            tl.LogMessage("Telescope", "Completed initialisation");
        }
Exemple #7
0
        private void chooseSwitch_Click(object sender, EventArgs e)
        {
            string switchDriverId = settings.Get("switchDriverId");

            using (ASCOM.Utilities.Chooser chooser = new Utilities.Chooser())
            {
                chooser.DeviceType = "Switch";
                string val = chooser.Choose(switchDriverId);
                if (!String.IsNullOrEmpty(val) && val != switchDriverId)
                {
                    settings.Set("switchDriverId", val);
                    switchDriverName.Text = DeviceName("Switch", val);
                    SharedResources.FreeMount();
                }
            }

            LoadSwitches();
        }
Exemple #8
0
        private void chooseCam_Click(object sender, EventArgs e)
        {
            string camId = settings.Get("cameraId");

            using (ASCOM.Utilities.Chooser chooser = new Utilities.Chooser())
            {
                chooser.DeviceType = "Camera";
                string val = chooser.Choose(camId);
                if (!String.IsNullOrEmpty(val) && val != camId)
                {
                    if (val == SharedResources.CamDriverId)
                    {
                        return; // reject choice of this driver!
                    }
                    settings.Set("cameraId", val);
                    camName.Text = DeviceName("Camera", val);
                    SharedResources.FreeCamera();
                }
            }
        }
Exemple #9
0
        private void chooseMount_Click(object sender, EventArgs e)
        {
            string scopeId = settings.Get("scopeId");

            using (ASCOM.Utilities.Chooser chooser = new Utilities.Chooser())
            {
                chooser.DeviceType = "Telescope";
                string val = chooser.Choose(scopeId);
                if (!String.IsNullOrEmpty(val) && val != scopeId)
                {
                    if (val == SharedResources.ScopeDriverId)
                    {
                        return; // reject choice of this driver!
                    }
                    settings.Set("scopeId", val);
                    mountName.Text = DeviceName("Telescope", val);
                    SharedResources.FreeMount();
                }
            }
        }
Exemple #10
0
        private void Dispose(bool disposing)
        {
            if (disposed)
            {
                return;
            }

            if (disposing)
            {
                // free managed resources here
            }

            if (m_camera != null)
            {
                SharedResources.DisconnectCamera();
                m_camera = null;
            }

            SharedResources.PutTraceLogger();
            tl = null;

            disposed = true;
        }
Exemple #11
0
        private void cbTrace_CheckedChanged(object sender, EventArgs e)
        {
            bool enable = cbTrace.Checked;

            SharedResources.EnableLogging(enable);
        }
Exemple #12
0
 public MainForm()
 {
     InitializeComponent();
     expand.Text = "Settings ▼";
     m_tl        = SharedResources.GetTraceLogger();
 }