ATMLCommonLibrary.controls.trigger.TriggerPropertyForm.ControlsToData C# (CSharp) Метод

ControlsToData() защищенный Метод

protected ControlsToData ( ) : void
Результат void
        protected void ControlsToData()
        {
            if (_property != null)
            {
                _property.name = edtName.GetValue<string>();
                _property.Description = edtDescription.GetValue<string>();

                if (_property is DigitalTriggerPropertyGroup)
                {
                    var dpg = (DigitalTriggerPropertyGroup) _property;
                    if (dpg.MinPulseWidth == null)
                        dpg.MinPulseWidth = new MinPulseWidthType();
                    if (dpg.Detection == null)
                        dpg.Detection = new DetectionType();
                    dpg.MinPulseWidth.value = edtPulseValue.GetValue<double>();
                    dpg.MinPulseWidth.units = (PulseUnits)Enum.Parse(typeof(PulseUnits), (string)cmbPulseUnits.SelectedItem );
                    if (cmbEdgeDetection.SelectedIndex != -1)
                        dpg.Detection.edgeDetection =
                            (DigitalEdge) Enum.Parse(typeof (DigitalEdge), (string) cmbEdgeDetection.SelectedItem);
                    else
                        dpg.Detection.edgeDetectionSpecified = false;
                    if (cmbLevelDetection.SelectedIndex != -1)
                        dpg.Detection.levelDetection =
                            (DigitalLevel) Enum.Parse(typeof (DigitalLevel), (string) cmbLevelDetection.SelectedItem);
                    else
                        dpg.Detection.levelDetectionSpecified = false;
                }
                else if (_property is AnalogTriggerPropertyGroup)
                {
                    var apg = (AnalogTriggerPropertyGroup) _property;
                    if (apg.Level == null)
                        apg.Level = new LevelType();

                    apg.Level.value = edtLevelTypeValue.GetValue<double>();
                    apg.Level.numberOfBits = edtNumberOfBits.GetValue<int>();
                    if (cmbLevelUnits.SelectedItem != null)
                        apg.Level.units = (LevelUnits)Enum.Parse(typeof(LevelUnits), (string)cmbLevelUnits.SelectedItem);
                }
            }
        }