// This method returns a new instance of PediatricSensorConfig class with the same values of all public properties
        public PediatricSensorConfig GetValueCopy()
        {
            PediatricSensorConfig config = new PediatricSensorConfig();

            foreach (PropertyInfo pi in this.GetType().GetProperties())
            {
                pi.SetValue(config, pi.GetValue(this));
            }
            return(config);
        }
        // We overload Equals method to get a value-based comparison
        // Use Reflection to iterate over all public properties
        public bool Equals(PediatricSensorConfig config)
        {
            bool result = true;

            foreach (PropertyInfo pi in this.GetType().GetProperties())
            {
                result = result && pi.GetValue(this).Equals(pi.GetValue(config));
            }
            return(result);
        }
Exemple #3
0
        // Constructors
        public TextBoxSensorConfig(PediatricSensorConfig _config, string propertyName, bool _hexString = true)
        {
            config    = _config;
            color     = new SolidColorBrush(Colors.Black);
            hexString = _hexString;

            foreach (PropertyInfo pi in config.GetType().GetProperties())
            {
                if (string.Equals(pi.Name, propertyName))
                {
                    propertyInfo = pi;
                    break;
                }
            }
        }