void OnUnitTypeChanged(UnitType unitType) { var viewmodel = (from vm in AllUnitTypes where vm.Id == unitType.Id select vm).FirstOrDefault(); if (viewmodel == null) { viewmodel = new SingleUnitTypeViewModel(unitType); AllUnitTypes.Add(viewmodel); } else viewmodel.ExchangeData(unitType); OnPropertyChanged("ItemSelected"); OnPropertyChanged("ItemsSelected"); }
public SingleUnitTypeViewModel(UnitType unitType) { _unitType = unitType; base.DisplayName = unitType.Name; }
private static UnitType SetId(UnitType unitType, int id) { var field = typeof(UnitType).GetProperty("Id"); //, BindingFlags.Instance | BindingFlags.SetProperty); if (field != null) field.SetValue(unitType, id, null); return unitType; }
public void ExchangeData(UnitType unitType) { _unitType = unitType; }
public EditUnitType(UnitType unitType) { UnitType = unitType; }