public void Execute() { foreach (var motec in collection.Items) { if (motec.Id == args.Value) { assetsFactory.SetMotec(motec); break; } } }
public void Execute() { ProfileModel profile = profileCollection.Get(args.ItemId); List <PlaceholderModel> placeholders = layoutIO.LoadProfileLayout(profile); if (placeholders == null) { return; } // TODO gestion des erreurs, chargemetn de fichiers, bitmaps... BackgroundModel background = backgroundCollection.Get(profile.BackgroundId); selectionModel.Unselect(); screen.SetBackground(background); placeholderCollection.Clear(); placeholderCollection.AddRange(placeholders); assetFactory.SetMotec(motecCollection.Get(profile.MotecId)); selectedProfile.SelectProfile(profile); layoutIO.DispatchSaveStatus(); }
public void Execute() { List <MotecModel> motecs = parser.Parse(location.MotecXmlFile); List <int> carIds = new List <int>(); // List the cars we need to load in DB. foreach (var motec in motecs) { foreach (var carId in motec.CarIds) { if (carIds.Contains(carId)) { throw new Exception("Two different motecs can't contain same car id."); } else { carIds.Add(carId); } } } Dictionary <int, Car> cars = r3EDatabase.GetCars(carIds.ToArray()); List <Car> motecCars = new List <Car>(); // Apply the cars to each motec. foreach (var motec in motecs) { foreach (var carId in motec.CarIds) { motecCars.Add(cars[carId]); } motec.SetCars(motecCars.ToArray()); motecCars.Clear(); } collection.AddRange(motecs); assetFactory.SetMotec(collection.Items.First()); }