Exemplo n.º 1
0
        public frmModel(GeminiProperties props)
        {
            InitializeComponent();

            // copy current profile, in case we need to restore it on Cancel:
            mBkupProfile = (SerializableDictionary<string, object>)props.Profile.Clone();

            geminiPropertiesBindingSource.Add(props);
            geminiPropertiesBindingSource.ResetBindings(false);

            GeminiHardware.Instance.OnConnect += new ConnectDelegate(OnConnectChange);

            OnConnectChange(false, 1);

        }
        public frmSafetyLimits(GeminiProperties props)
        {

            InitializeComponent();
            // copy current profile, in case we need to restore it on Cancel:
            mBkupProfile = (SerializableDictionary<string, object>)props.Profile.Clone();

            geminiPropertiesBindingSource.Add(props);
            geminiPropertiesBindingSource.ResetBindings(false);
            SetControlColor(this.groupBox1);
            SetControlColor(this.groupBox2);
            SetControlColor(this.groupBox3);
            chkNudge.Checked = GeminiHardware.Instance.NudgeFromSafety;

            GeminiHardware.Instance.OnConnect += new ConnectDelegate(OnConnectChange);
        }
        public frmAdvancedSettings()
        {
            this.UseWaitCursor = true;

            InitializeComponent();

            if (GeminiHardware.Instance.Connected && GeminiHardware.Instance.GeminiLevel >= 5)
            {
                // divisor values are up to a maximum 4 byte integer size starting in L5
                numericUpDown1.Maximum = numericUpDown2.Maximum = new decimal(new int[] { int.MaxValue, 0, 0, 0 });
                numericUpDown1.Minimum = new decimal(new int[] { 256, 0, 0, 0 });
                numericUpDown2.Minimum = numericUpDown2.Minimum = new decimal(new int[] { 0, 0, 0, 0 });
            }
            
            if (GeminiHardware.Instance.dVersion < 5.2)
            {
                // PEC enabled at start-up in L5.2
                checkBox8.Enabled = false;
                checkBox8.Checked = false;
            }

            if (GeminiHardware.Instance.dVersion < 5.1)
                cbGeometry.Enabled = false;

            comboBox1.Items.AddRange(GeminiProperties.Brightness_names);
            comboBox2.Items.AddRange(GeminiProperties.HandController_names);
            comboBox3.Items.AddRange(GeminiProperties.TrackingRate_names);
            cbMountType.Items.AddRange(GeminiProperties.Mount_names);
            cbGeometry.Items.AddRange(GeminiProperties.Geometry_names);

            GeminiProperties props = new GeminiProperties();

            bool bDefaultLoaded = false;

            // read default profile
            if (props.Serialize(false, null))
            {
                this.Text = Cap + " (" + SharedResources.DEAULT_PROFILE + ")";
                bDefaultLoaded = true;
            }

            if (props.SyncWithGemini(false))    // read all the properties from the mount
                this.Text = Cap + " " + Resources.SettingsFromGemini;
            else if (!bDefaultLoaded)
            {
                MessageBox.Show(Resources.EthernetError, SharedResources.TELESCOPE_DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                //this.Close();
                //this.UseWaitCursor = false;
                //return;
            }

            this.geminiPropertiesBindingSource.Add(props);

            chkSendSettings.Checked = GeminiHardware.Instance.SendAdvancedSettings;

            OnConnectChange(true, 1);

            GeminiHardware.Instance.OnConnect += new ConnectDelegate(OnConnectChangeAsync);

            this.UseWaitCursor = false;
        }