Beispiel #1
0
        //
        // PUBLIC COM INTERFACE IFocuserV2 IMPLEMENTATION
        //

        #region Common properties and methods.

        /// <summary>
        /// Displays the Setup Dialog form.
        /// If the user clicks the OK button to dismiss the form, then
        /// the new settings are saved, otherwise the old values are reloaded.
        /// THIS IS THE ONLY PLACE WHERE SHOWING USER INTERFACE IS ALLOWED!
        /// </summary>
        public void SetupDialog()
        {
            if (MyDriverType == 0)
            {
                MySSFocuser.SetupDialog();
            }
            else
            {
                // consider only showing the setup dialog if not connected
                // or call a different dialog if connected
                if (IsConnected)
                {
                    System.Windows.Forms.MessageBox.Show("Already connected, just press OK");
                }

                using (SetupDialogForm F = new SetupDialogForm(0))//设备类型,0-ASCOM,1-Serial,2-Socket
                {
                    var result = F.ShowDialog();
                    if (result == System.Windows.Forms.DialogResult.OK)
                    {
                        WriteProfile(); // Persist device configuration values to the ASCOM Profile store
                    }
                }
            }
        }
Beispiel #2
0
        //选择设备
        private void ChooseDevice(DeviceType DevType)
        {
            byte MyDeviceType = Convert.ToByte(DevType); //设备类型转换为byte

            if (DriverConnected[MyDeviceType])           //已连接就退出不执行
            {
                return;
            }
            using (SetupDialogForm F = new SetupDialogForm(MyDeviceType))
            {
                var result = F.ShowDialog();
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    TextBoxDriverID[MyDeviceType].Text = DriverID[MyDeviceType];
                    //WriteProfile(); // Persist device configuration values to the ASCOM Profile store
                }
            }
        }