public LayoutIOModel(HudOptionsParser parser, LocationModel location, PlaceHolderCollectionModel collection, ScreenModel screenModel, GraphicalAssetFactory assetFactory) { this.parser = parser; this.location = location; this.collection = collection; this.screenModel = screenModel; this.assetFactory = assetFactory; saveStatus = new SaveStatus(); currentR3eLayout = new SourceLayout(LayoutSourceType.R3E, location.HudOptionsFile, parser.Parse(location.HudOptionsFile), -1, -1); }
// TODO nullable backgroundId private List <PlaceholderModel> SetSource(LayoutSourceType sourceType, String name, List <PlaceholderModel> list, int backgroundId, int motecId) { if (sourceType == LayoutSourceType.R3E) { currentR3eLayout.UpdateLayout(list); //currentR3eLayout.UpdateBackgroundId(backgroundId); source = currentR3eLayout; } else { source = new SourceLayout(sourceType, name, list, backgroundId, motecId); } DispatchEvent(new LayoutSourceEventArgs(EVENT_SOURCE_CHANGED, sourceType, name)); return(list); }
public bool IsSaved(List <PlaceholderModel> currentLayout, SourceLayout source, SourceLayout r3eLayout, ScreenModel screenModel, GraphicalAssetFactory assetFactory) { if (source == null) { return(true); } if (source.SourceType == LayoutSourceType.PROFILE && (source.BackgroundId != screenModel.Background.Id || source.MotecId != assetFactory.SelectedMotec.Id)) { return(false); } if (source.SourceType == LayoutSourceType.BACKUP) { return(AreLayoutEquals(currentLayout, source.Layout) || AreLayoutEquals(currentLayout, r3eLayout.Layout)); } if (source.SourceType == LayoutSourceType.R3E) { return(AreLayoutEquals(currentLayout, source.Layout)); // TODO ici on pourrait éventuellement comparer avec le backup } return(AreLayoutEquals(currentLayout, source.Layout)); }