Source

main / Source / Excel / Excel.AddIn / Excel.AddIn / ViewModels / ParameterMetadataViewModel.cs


namespace DataUp.Excel.Addin
{
    public class ParameterMetadataViewModel : ViewModelBase
    {
        private string name;
        private string description;
        private string type;
        private string units;

        private bool enableUnits;

        public string Name
        {
            get
            {
                return this.name;
            }
            set
            {
                this.name = value;
                OnNotifyPropertyChanged("Name");
            }
        }

        public string Description
        {
            get
            {
                return this.description;
            }
            set
            {
                this.description = value;
                OnNotifyPropertyChanged("Description");
            }
        }

        public string Type
        {
            get
            {
                return this.type;
            }
            set
            {
                this.type = value;
                OnNotifyPropertyChanged("Type");
                this.EnableUnits = string.Compare(this.type, "Numeric", true) == 0;
                if (!this.EnableUnits)
                {
                    this.Units = string.Empty;
                }
            }
        }

        public string Units
        {
            get
            {
                return this.units;
            }
            set
            {
                this.units = value;
                OnNotifyPropertyChanged("Units");
            }
        }

        public bool EnableUnits
        {
            get
            {
                return this.enableUnits;
            }
            set
            {
                this.enableUnits = value;
                OnNotifyPropertyChanged("EnableUnits");
            }
        }
    }
}