Ejemplo n.º 1
0
        private void tmrMain_Tick(object sender, EventArgs e)
        {
            RotatorHardware.UpdateState();                                                      // Pump the machine
            //
            // Read the state of the rotator machine. No shortcuts, it's state
            // is also affected by ASCOM clients via the IRotator interface!
            //
            this.chkConnected.Checked = RotatorHardware.Connected;
            if (RotatorHardware.Connected)
            {
                this.lblPosition.Text      = RotatorHardware.Position.ToString("000.0");
                this.lblPosition.ForeColor = Color.White;
            }
            else
            {
                this.lblPosition.Text      = "---.-";
                this.lblPosition.ForeColor = Color.FromArgb(128, 4, 4);
            }

            this.cmdSetup.Enabled = !RotatorHardware.Connected;
            this.cmdMove.Enabled  = RotatorHardware.Connected && !RotatorHardware.Moving;
            this.cmdHalt.Enabled  = RotatorHardware.Connected && RotatorHardware.Moving;

            this.lblREV.ForeColor = (RotatorHardware.Reverse ? Color.Cyan : Color.FromArgb(128, 4, 4));
            this.lblCON.ForeColor = (RotatorHardware.Connected ? Color.LightGreen : Color.FromArgb(128, 4, 4));
            if (RotatorHardware.Connected && RotatorHardware.Moving && m_bFlasher)
            {
                this.lblMOVE.ForeColor = Color.Yellow;
            }
            else
            {
                this.lblMOVE.ForeColor = Color.FromArgb(128, 4, 4);
            }
            m_bFlasher = !m_bFlasher;
        }
Ejemplo n.º 2
0
 private void cmdMove_Click(object sender, EventArgs e)
 {
     if (float.TryParse(this.txtPosition.Text, out float newPA))
     {
         RotatorHardware.MoveAbsolute(newPA);
     }
 }
Ejemplo n.º 3
0
        public void SetupDialog()
        {
            if (RotatorHardware.Connected)
            {
                throw new DriverException("The rotator is connected, cannot do SetupDialog()", unchecked (ErrorCodes.DriverBase + 4));
            }

            RotatorHardware.SetupDialog();
        }
Ejemplo n.º 4
0
        public void SetupDialog()
        {
            if (RotatorHardware.Connected)
            {
                throw new DriverException("The rotator is connected, cannot do SetupDialog()",
                                          unchecked (ErrorCodes.DriverBase + 4));
            }
            RotatorHardware.SetupDialog();

            //RotatorSimulator.m_MainForm.DoSetupDialog();			// Kinda sleazy
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            if (!LoadComObjectAssemblies())
            {
                return;                                                                                 // Load served COM class assemblies, get types
            }
            if (!ProcessArguments(args))
            {
                return;                                                                                 // Register/Unregister
            }
            // Initialize critical member variables.
            m_iObjsInUse              = 0;
            m_iServerLocks            = 0;
            m_uiMainThreadId          = GetCurrentThreadId();
            Thread.CurrentThread.Name = "Main Thread";

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            m_MainForm = new frmMain();
            //if (m_bComStart) m_MainForm.WindowState = FormWindowState.Minimized;
            m_MainForm.Visible = true;

            // Initialize hardware layer
            RotatorHardware.Initialize();

            // Start up the garbage collection thread.
            GarbageCollection GarbageCollector = new GarbageCollection(1000);
            Thread            GCThread         = new Thread(new ThreadStart(GarbageCollector.GCWatch));

            GCThread.Name = "Garbage Collection Thread";
            GCThread.Start();

            // Register the class factories of the served objects
            RegisterClassFactories();

            //
            // Start the message loop. This serializes incoming calls to our
            // served COM objects, making this act like the VB6 equivalent!
            //
            Application.Run(m_MainForm);

            // Exiting... Revoke the class factories immediately.
            // Don't wait until the thread has stopped before
            // we perform revocation!!!
            RevokeClassFactories();

            // Now stop the Garbage Collector thread.
            GarbageCollector.StopThread();
            GarbageCollector.WaitForThreadToStop();

            // And finally save the hardware state for next time
            RotatorHardware.Finalize_();
        }
Ejemplo n.º 6
0
 public void MoveMechanical(float position)
 {
     RotatorHardware.MoveMechanical(position);
 }
Ejemplo n.º 7
0
 public void Sync(float position)
 {
     RotatorHardware.Sync(position);
 }
Ejemplo n.º 8
0
 public void MoveAbsolute(float position)
 {
     RotatorHardware.MoveAbsolute(position);
 }
Ejemplo n.º 9
0
 public void Halt()
 {
     RotatorHardware.Halt();
 }
Ejemplo n.º 10
0
 private void cmdHalt_Click(object sender, EventArgs e)
 {
     RotatorHardware.Halt();
 }