internal void SetSource(LayoutSourceType sourceType, string name) { string headerText = "Layout source"; string sourceText = ""; switch (sourceType) { case LayoutSourceType.R3E: sourceText = "R3E"; break; case LayoutSourceType.BACKUP: sourceText = "Backup"; break; case LayoutSourceType.PROFILE: sourceText = "Profile"; break; case LayoutSourceType.DELETED_PROFILE: sourceText = "Deleted profile"; break; } Text = $"{headerText}: {sourceText} \"{TroncateText(name)}\""; }
public SourceLayout(LayoutSourceType sourceType, String name, List <PlaceholderModel> layout, int backgroundId, int motecId) { SourceType = sourceType; Name = name; Layout = CloneLayout(layout); BackgroundId = backgroundId; MotecId = motecId; }
private List <PlaceholderModel> LoadLayout(LayoutSourceType type, string name, string path, int backgroundId = -1, int motecId = -1) { // TODO quand on recharge l'original on devrait comparer le layout actuel avec le R3E et non l'original. if (!saveStatus.IsSaved(collection.Items, source, currentR3eLayout, screenModel, assetFactory)) { UnsavedChangesEventArgs args = new UnsavedChangesEventArgs(EVENT_UNSAVED_CHANGES, ToUnsavedType(source.SourceType), source.Name); DispatchEvent(args); if (args.IsLoadingCancelled) { return(null); } } return(SetSource(type, name, parser.Parse(path), backgroundId, motecId)); }
private UnsavedChangeType ToUnsavedType(LayoutSourceType sourceType) { switch (sourceType) { case LayoutSourceType.PROFILE: return(UnsavedChangeType.PROFILE); case LayoutSourceType.R3E: case LayoutSourceType.BACKUP: case LayoutSourceType.DELETED_PROFILE: return(UnsavedChangeType.R3E); default: throw new Exception("Unsupported type."); } }
// 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 LayoutSourceEventArgs(int eventId, LayoutSourceType sourceType, string sourceName) : base(eventId) { SourceType = sourceType; SourceName = sourceName; }