Beispiel #1
0
        private void AddNextBtn_Click(object sender, EventArgs e)
        {
            SelectorPanel.Visible        = false;
            AddDetectorTypePanel.Visible = false;

            // Create new detector with default parameters for the selected type
            DataSourceIdentifier did = new DataSourceIdentifier();

            did.DetectorName = AddDetectorNameTextBox.Text;
            InstrType dt;

            INCCDB.Descriptor desc = (INCCDB.Descriptor)AddDetectorTypeComboBox.SelectedItem;
            System.Enum.TryParse <InstrType>(desc.Name, out dt);
            did.SRType       = dt;
            did.FullConnInfo = new LMConnectionInfo();
            Multiplicity mkey = new Multiplicity(InstrTypeExtensions.DefaultFAFor(did.SRType));

            det = new Detector(did, mkey, null);

            // Jump to an edit panel for the parameters of the appropriate type
            if (det != null)
            {
                if (det.Id.SRType == InstrType.MCA527)
                {
                    PopulateMCA527ParamFields();
                }
                else
                {
                    PopulateLMMM_PTR32ParamFields();
                }
            }
            AddingNew = true;
        }
Beispiel #2
0
        private void ShiftRegisterTypeComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            InstrType t = InstrType.AMSR;

            /* JFL added, type changes within the SR/LM families are supported */
            if (det.Id.SRType.IsListMode())
            {
                System.Enum.TryParse <InstrType>((string)ShiftRegisterTypeComboBox.SelectedItem, true, out t);
            }
            else
            {
                t = InstrTypeExtensions.INCC5ComboBoxStringToType((string)ShiftRegisterTypeComboBox.SelectedItem);
            }
            if (det.Id.SRType != t)
            {
                det.Id.modified = true;
            }
            det.Id.SRType = t;

            SecondGateLengthLabel.Visible   = (t == InstrType.DGSR);
            SecondGateLengthTextBox.Visible = (t == InstrType.DGSR);
            SetBaudRateSelectorVisibility(t.IsSRWithVariableBaudRate());
        }
Beispiel #3
0
        public IDDShiftRegisterSetup(Detector d)
        {
            InitializeComponent();
            bauds = new int[] { 75, 110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, 115200, 128000, 256000 };

            for (int i = 0; i < bauds.Length; i++)
            {
                BaudCombo.Items.Add(bauds[i].ToString());
            }
            det = d;

            ShiftRegisterTypeComboBox.Items.Clear();

            /* JFL added */
            if (det.ListMode)
            {
                foreach (INCCDB.Descriptor dt in NC.App.DB.DetectorTypes.GetList())
                {
                    InstrType dty;
                    Enum.TryParse <InstrType>(dt.Name, out dty);
                    if (dty.IsListMode())
                    {
                        ShiftRegisterTypeComboBox.Items.Add(dty.ToString());
                    }
                }
                ShiftRegisterTypeComboBox.SelectedItem = det.Id.SRType.ToString();
            }
            else
            {
                foreach (INCCDB.Descriptor dt in NC.App.DB.DetectorTypes.GetINCC5SRList())
                {
                    ShiftRegisterTypeComboBox.Items.Add(dt.Name);
                }
                ShiftRegisterTypeComboBox.SelectedItem = InstrTypeExtensions.INCC5ComboBoxString(det.Id.SRType);
            }

            EditBtn.Visible = false;
            if (det.Id.SRType < InstrType.NPOD)
            {
                Refre_Click(null, null);
                SetBaudRateSelectorVisibility(det.Id.SRType.IsSRWithVariableBaudRate());
            }
            else if (det.ListMode)
            {
                ShiftRegisterSerialPortComboBox.Visible        = false;
                ShiftRegisterSerialPortLabel.Visible           = false;
                ShiftRegisterSerialPortComboBox.Visible        = false;
                ShiftRegisterSerialPortLabel.Visible           = false;
                ShiftRegisterSerialPortComboBoxRefresh.Visible = false;
                SetBaudRateSelectorVisibility(false);
                EditBtn.Visible = true;
                EditBtn.Enabled = true;
            }

            SetLMVSRFATypeAndVis();

            InitializeNumericBoxes();

            ShiftRegisterTypeComboBox.SelectedItem = det.Id.SRType.ToString();
            BaudCombo.SelectedIndex = BaudCombo.FindStringExact(d.Id.BaudRate.ToString());
            BaudCombo.Refresh();

            this.Text += (" for " + det.Id.DetectorName);
        }