Exemplo n.º 1
0
        public SetupDialogForm()
        {
            InitializeComponent();
            // Initialise current values of user settings from the ASCOM Profile

            InitUI();

            MySCP = new SSFocuserSerialCommandProtocol();

            SlewStatue = 0; i = 0;

            if (!Focuser.connectedState)//用一个定时器执行第一次串口初始化,避免界面打开缓慢
            {
                tabControl1.SelectedIndex = 0;
                UartUninitial();
                UartInitial();
                t           = new System.Timers.Timer(500);                      //500毫秒执行一次;
                t.Elapsed  += new System.Timers.ElapsedEventHandler(TimerEvent); //到达时间的时候执行事件;
                t.AutoReset = true;                                              //设置是执行一次(false)还是一直执行(true);
                t.Enabled   = true;                                              //是否执行System.Timers.Timer.Elapsed事件;
            }
        }
Exemplo n.º 2
0
        //internal static byte TimeCount = 0;
        //internal static byte TimeOut = 60;//60秒超时
        //private String ErrorInfo;

        /// <summary>
        /// Initializes a new instance of the <see cref="SSFocuser"/> class.
        /// Must be public for COM registration.
        /// </summary>
        public Focuser()
        {
            tl = new TraceLogger("", "SSFocuser");

            ReadProfile(); // Read device configuration from the ASCOM Profile store

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

            connectedState = false;            // Initialise connected to false
            utilities      = new Util();       //Initialise util object
            astroUtilities = new AstroUtils(); // Initialise astro utilities object
            //TODO: Implement your additional construction here

            tl.LogMessage("Focuser", "Completed initialisation");
            //这里是setupdialog后才初始化

            MySCP = new SSFocuserSerialCommandProtocol();

            m_Position = ReadPosition();
            //m_IsMoving = false;
            m_TempComp = false;
            //m_TempCompAvailable = true;
        }