Example #1
0
        private void ConfigureDevideProperiesInternal(IWin32Window ownerForm)
        {
            if (frmImageSettings != null)
            {
                try
                {
                    frmImageSettings.Show();
                }
                catch (Exception)
                {
                    try
                    {
                        frmImageSettings.Close();
                    }
                    catch
                    { }
                    finally
                    {
                        frmImageSettings = null;
                    }
                }
            }

            if (frmImageSettings == null)
            {
                frmImageSettings               = new frmImageSettings();
                frmImageSettings.Camera        = camera;
                frmImageSettings.StartPosition = FormStartPosition.CenterParent;
                frmImageSettings.Show(ownerForm);
            }
            else
            {
                frmImageSettings.Show();
            }
        }
        ///	<exception cref="T:ASCOM.NotConnectedException">Must throw an exception if the camera is not connected.</exception>
        ///	<exception cref="T:ASCOM.PropertyNotImplementedException">Must throw an exception if ConfigureImage is not supported.</exception>
        public void ConfigureDeviceProperties()
        {
            AssertConnected();

            if (frmImageSettings != null)
            {
                try
                {
                    frmImageSettings.Show();
                }
                catch (Exception)
                {
                    try
                    {
                        frmImageSettings.Close();
                    }
                    catch
                    { }
                    finally
                    {
                        frmImageSettings = null;
                    }
                }
            }

            if (frmImageSettings == null)
            {
                frmImageSettings        = new frmImageSettings();
                frmImageSettings.Camera = camera;


                Form ownerForm = Application.OpenForms.Cast <Form>().FirstOrDefault(x => x != null && x.Owner == null);

                frmImageSettings.StartPosition = FormStartPosition.CenterParent;

                frmImageSettings.Show(ownerForm);
            }
            else
            {
                frmImageSettings.Show();
            }
        }