예제 #1
0
 /// <summary>
 /// Store SerialConnectionManagerSettings
 /// </summary>
 /// <param name="serialConnectionManagerSettings">SerialConnectionManagerSettings</param>
 public void StoreSettings(SerialConnectionManagerSettings serialConnectionManagerSettings)
 {
     var fileStream = System.IO.File.Create(_settingsFileName);
     var serializer = new BinaryFormatter();
     serializer.Serialize(fileStream, serialConnectionManagerSettings);
     fileStream.Close();
 }
 protected override sealed void ReadSettings()
 {
     if (!PersistentSettings)
     {
         return;
     }
     _serialConnectionManagerSettings = _serialConnectionStorer.RetrieveSettings();
 }
예제 #3
0
        /// <summary>
        /// Store SerialConnectionManagerSettings
        /// </summary>
        /// <param name="serialConnectionManagerSettings">SerialConnectionManagerSettings</param>
        public void StoreSettings(SerialConnectionManagerSettings serialConnectionManagerSettings)
        {
            var fileStream = File.Create(_settingsFileName);
            var serializer = new BinaryFormatter();

            serializer.Serialize(fileStream, serialConnectionManagerSettings);
            fileStream.Close();
        }
예제 #4
0
 /// <summary>
 /// Retreive SerialConnectionManagerSettings
 /// </summary>
 /// <returns>SerialConnectionManagerSettings</returns>
 public SerialConnectionManagerSettings RetrieveSettings()
 {
     var serialConnectionManagerSettings = new SerialConnectionManagerSettings();
     if (System.IO.File.Exists(_settingsFileName))
     {
         var fileStream = System.IO.File.OpenRead(_settingsFileName);
         var deserializer = new BinaryFormatter();
         serialConnectionManagerSettings = (SerialConnectionManagerSettings)deserializer.Deserialize(fileStream);
         fileStream.Close();
     }
     return serialConnectionManagerSettings;
 }
예제 #5
0
        /// <summary>
        /// Retreive SerialConnectionManagerSettings
        /// </summary>
        /// <returns>SerialConnectionManagerSettings</returns>
        public SerialConnectionManagerSettings RetrieveSettings()
        {
            var serialConnectionManagerSettings = new SerialConnectionManagerSettings();

            if (File.Exists(_settingsFileName))
            {
                var fileStream   = File.OpenRead(_settingsFileName);
                var deserializer = new BinaryFormatter();
                serialConnectionManagerSettings = (SerialConnectionManagerSettings)deserializer.Deserialize(fileStream);
                fileStream.Close();
            }
            return(serialConnectionManagerSettings);
        }
        /// <summary>
        /// Connection manager for serial port connection
        /// </summary>
        public SerialConnectionManager(SerialTransport serialTransport, CmdMessenger cmdMessenger, int watchdogCommandId = 0, string uniqueDeviceId = null, ISerialConnectionStorer serialConnectionStorer = null)
            : base(cmdMessenger, watchdogCommandId, uniqueDeviceId)
        {
            if (serialTransport == null)
                throw new ArgumentNullException("serialTransport", "Transport is null.");

            _serialTransport = serialTransport;
            _serialConnectionStorer = serialConnectionStorer;
            PersistentSettings = (_serialConnectionStorer != null);

            DeviceScanBaudRateSelection = true;

            UpdateAvailablePorts();

            _serialConnectionManagerSettings = new SerialConnectionManagerSettings();
            ReadSettings();
        }
        /// <summary>
        /// Connection manager for serial port connection
        /// </summary>
        public SerialConnectionManager(SerialTransport serialTransport, CmdMessenger cmdMessenger, int watchdogCommandId = 0, string uniqueDeviceId = null, ISerialConnectionStorer serialConnectionStorer = null) :
            base(cmdMessenger, watchdogCommandId, uniqueDeviceId)
        {
            if (serialTransport == null)
            {
                throw new ArgumentNullException("serialTransport", "Transport is null.");
            }

            _serialTransport        = serialTransport;
            _serialConnectionStorer = serialConnectionStorer;
            PersistentSettings      = (_serialConnectionStorer != null);

            DeviceScanBaudRateSelection = true;

            UpdateAvailablePorts();

            _serialConnectionManagerSettings = new SerialConnectionManagerSettings();
            ReadSettings();
        }
 protected override sealed void ReadSettings()
 {
     if (!PersistentSettings) return;
     _serialConnectionManagerSettings = _serialConnectionStorer.RetrieveSettings();
 }