private void btnOK_Click(object sender, EventArgs e)
        {
            // изменение настроек в соответствии с элементами управления
            if (modified)
            {
                settings.PortName = cbPortName.Text;
                settings.BaudRate = int.Parse(cbBaudRate.Text);
                settings.DataBits = int.Parse(cbDataBits.Text);
                settings.Parity   = (Parity)cbParity.GetSelectedItem(new Dictionary <int, object>()
                {
                    { 0, Parity.Even }, { 1, Parity.Odd }, { 2, Parity.None }, { 3, Parity.Mark }, { 4, Parity.Space }
                });
                settings.StopBits = (StopBits)cbStopBits.GetSelectedItem(new Dictionary <int, object>()
                {
                    { 0, StopBits.One }, { 1, StopBits.OnePointFive }, { 2, StopBits.Two }
                });
                settings.DtrEnable = chkDtrEnable.Checked;
                settings.RtsEnable = chkRtsEnable.Checked;
                settings.Behavior  = cbBehavior.ParseText <CommChannelLogic.OperatingBehaviors>();

                settings.SetCommCnlParams(commCnlParams);
            }

            DialogResult = DialogResult.OK;
        }
Exemple #2
0
 /// <summary>
 /// Установить параметры канала связи по умолчанию
 /// </summary>
 public override void SetCommCnlParamsToDefault(SortedList <string, string> commCnlParams)
 {
     CommSerialLogic.Settings settings = new CommSerialLogic.Settings();
     settings.SetCommCnlParams(commCnlParams);
 }
Exemple #3
0
 /// <summary>
 /// Установить параметры канала связи по умолчанию
 /// </summary>
 public override void SetCommCnlParamsToDefault(SortedList<string, string> commCnlParams)
 {
     CommSerialLogic.Settings settings = new CommSerialLogic.Settings();
     settings.SetCommCnlParams(commCnlParams);
 }