Пример #1
0
        /// <summary>
        /// Call this when the user selects a new PLX serial port.
        /// </summary>
        public void ChangePlxSerialPort()
        {
            if (this.plxParameterSource == null)
            {
                this.plxParameterSource = PlxParameterSource.GetInstance();
            }

            string portName = this.ui.GetSelectedPlxSerialPort();

            portName = portName ?? ExternalSensors.NullSerialPortName;
            this.Settings.DefaultPlxPort = portName;
            this.Settings.Save();

            // TODO: Make ParameterDatabase a singleton; ExternalSensors should add/remove sources
            ExternalSensors.GetInstance().SetPlxSerialPort(portName);

            if (portName == ExternalSensors.NullSerialPortName)
            {
                this.database.Remove(this.plxParameterSource);
            }
            else
            {
                this.database.Add(this.plxParameterSource);
            }

            this.ui.PopulateParameterList(this.database);
        }
Пример #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        private SawMill(
            string configurationDirectory,
            string ssmPortName,
            string plxPortName,
            IList <SawMillScreen> screens,
            Update update)
        {
            this.update   = update;
            this.screens  = screens;
            this.database = ParameterDatabase.GetInstance();

            this.CreateLogger(configurationDirectory, ssmPortName);

            if (!string.IsNullOrEmpty(plxPortName))
            {
                ExternalSensors externalSensors = ExternalSensors.GetInstance();
                externalSensors.SetPlxSerialPort(plxPortName);

                ParameterSource plxParameters = PlxParameterSource.GetInstance();
                this.database.Add(plxParameters);
            }
        }