Beispiel #1
0
        private void Item_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            var i = sender as PressureViewModel;

            switch (i.Parameter)
            {
            case PressureParameter.Atm:
                MainValue = Pressure.FromAtm(i.Value);
                break;

            case PressureParameter.CmHg:
                MainValue = Pressure.FromCmHg(i.Value);
                break;

            case PressureParameter.Hpa:
                MainValue = Pressure.FromHPa(i.Value);
                break;

            case PressureParameter.Torr:
                MainValue = Pressure.FromTorr(i.Value);
                break;

            default:
                break;
            }
            foreach (var item in Items)
            {
                item.PropertyChanged -= Item_PropertyChanged;
                switch (item.Parameter)
                {
                case PressureParameter.Atm:
                    item.Value = MainValue.Atm;
                    break;

                case PressureParameter.CmHg:
                    item.Value = MainValue.CmHg;
                    break;

                case PressureParameter.Hpa:
                    item.Value = MainValue.HPa;
                    break;

                case PressureParameter.Torr:
                    item.Value = MainValue.Torr;
                    break;

                default:
                    break;
                }
                item.PropertyChanged += Item_PropertyChanged;
            }
        }