Пример #1
0
        //
        // PUBLIC COM INTERFACE ICameraV2 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)
            {
                MySSCamera.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
                    }
                }
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            // Uncomment the code that's required
#if UseChooser
            // choose the device
            string id = ASCOM.DriverAccess.Camera.Choose("");
            if (string.IsNullOrEmpty(id))
            {
                return;
            }
            // create this device
            ASCOM.DriverAccess.Camera device = new ASCOM.DriverAccess.Camera(id);
#else
            // this can be replaced by this code, it avoids the chooser and creates the driver class directly.
            ASCOM.DriverAccess.Camera device = new ASCOM.DriverAccess.Camera("ASCOM.SonyMirrorless.Camera");
#endif

            device.Connected = true;
            device.SetupDialog();
            // now run some tests, adding code to your driver so that the tests will pass.
            // these first tests are common to all drivers.
            Console.WriteLine("name " + device.Name);
            Console.WriteLine("description " + device.Description);
            Console.WriteLine("DriverInfo " + device.DriverInfo);
            Console.WriteLine("driverVersion " + device.DriverVersion);
            //            Console.WriteLine("sensorName " + device.SensorName);

            // TODO add more code to test the driver.
            int count = 0;

            ArrayList modes = device.ReadoutModes;

            device.FastReadout = true;

            Console.WriteLine(device.Gain);
            device.Gain = 10;
            Console.WriteLine(device.Gains.ToString());

/*            while (true)
 *          {
 *              device.StartExposure(0.1, true);
 *
 *              for (int i = 0; i < 100 && !device.ImageReady; i++)
 *                  Thread.Sleep(250);
 *
 *              object o = device.ImageArray;
 *              count++;
 *              Console.WriteLine("Got an image #" + count.ToString());
 *              GC.Collect();
 *          }
 */
            device.Connected = false;
            Console.WriteLine("Press Enter to finish");
            Console.ReadLine();
        }
Пример #3
0
 public static void SetupCamera()
 {
     lock (lockObject)
     {
         if (s_camera == null)
         {
             InstantiateCamera();
         }
         s_camera.SetupDialog();
     }
 }
Пример #4
0
        public OperationResult OpenSetupDialog()
        {
            try
            {
                _camera.SetupDialog();
            }
            catch (Exception ex)
            {
                return(new OperationResult {
                    IsError = true, ErrorMessage = ex.Message
                });
            }

            return(OperationResult.Ok);
        }