public PressureList() { foreach (PressureParameter item in Enum.GetValues(typeof(PressureParameter))) { Items.Add(new PressureViewModel(item)); } foreach (var item in Items) { item.PropertyChanged += Item_PropertyChanged; } MainValue = Pressure.FromAtm(1); }
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; } }
private static void AddOilSystemInfo(SimulatorDataSet simData, AssettoCorsaShared acData) { simData.PlayerInfo.CarInfo.TurboPressure = Pressure.FromAtm(acData.AcsPhysics.turboBoost); simData.PlayerInfo.CarInfo.OilSystemInfo.OptimalOilTemperature.ActualQuantity = Temperature.FromCelsius(100); }