Exemplo n.º 1
0
        public override bool Setup()
        {
            using (SetupDialog setupDialog = new SetupDialog(_moduleData)) {
                if (setupDialog.ShowDialog() == DialogResult.OK)
                {
                    _serialPort  = setupDialog.SelectedPort;
                    _acOperation = setupDialog.ACOperation;
                    _holdPort    = setupDialog.HoldPort;

                    _moduleData.PortName     = setupDialog.SelectedPort.PortName;
                    _moduleData.BaudRate     = setupDialog.SelectedPort.BaudRate;
                    _moduleData.Parity       = setupDialog.SelectedPort.Parity;
                    _moduleData.DataBits     = setupDialog.SelectedPort.DataBits;
                    _moduleData.StopBits     = setupDialog.SelectedPort.StopBits;
                    _moduleData.HoldPortOpen = setupDialog.HoldPort;
                    _moduleData.AcOperation  = setupDialog.ACOperation;

                    for (int i = 0; i < 4; i++)
                    {
                        _modules[i] = setupDialog.Modules[i];
                    }
                    _moduleData.Modules = _modules;
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 2
0
        public override bool Setup()
        {
            using (SetupDialog setupDialog = new SetupDialog(_moduleData))
            {
                if (setupDialog.ShowDialog() == DialogResult.OK)
                {
                    _serialPort = setupDialog.SelectedPort;
                    _acOperation = setupDialog.ACOperation;
                    _holdPort = setupDialog.HoldPort;

                    _moduleData.PortName = setupDialog.SelectedPort.PortName;
                    _moduleData.BaudRate = setupDialog.SelectedPort.BaudRate;
                    _moduleData.Parity = setupDialog.SelectedPort.Parity;
                    _moduleData.DataBits = setupDialog.SelectedPort.DataBits;
                    _moduleData.StopBits = setupDialog.SelectedPort.StopBits;
                    _moduleData.HoldPortOpen = setupDialog.HoldPort;
                    _moduleData.AcOperation = setupDialog.ACOperation;

                    for (int i = 0; i < 4; i++)
                    {
                        _modules[i] = setupDialog.Modules[i];
                    }
                    _moduleData.Modules = _modules;
                    return true;
                }
            }
            return false;
        }