1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Profile editor - Fixed layer copy with databindings

Shows how thoroughly tested it was :)
This commit is contained in:
SpoinkyNL 2020-11-08 23:13:16 +01:00
parent f80a7d658c
commit c0d0e421c7
2 changed files with 9 additions and 4 deletions

View File

@ -128,13 +128,17 @@ namespace Artemis.Core
}
/// <summary>
/// Creates a deep copy of the layer
/// Creates a deep copy of the folder
/// </summary>
/// <returns>The newly created copy</returns>
public Folder CreateCopy()
{
FolderEntity entityCopy = JsonConvert.DeserializeObject<FolderEntity>(JsonConvert.SerializeObject(FolderEntity));
JsonSerializerSettings settings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All };
FolderEntity entityCopy = JsonConvert.DeserializeObject<FolderEntity>(JsonConvert.SerializeObject(FolderEntity, settings), settings)!;
entityCopy.Id = Guid.NewGuid();
entityCopy.Name += " - Copy";
// TODO Children
return new Folder(Profile, Parent, entityCopy);
}

View File

@ -122,9 +122,10 @@ namespace Artemis.Core
/// <returns>The newly created copy</returns>
public Layer CreateCopy()
{
LayerEntity entityCopy = JsonConvert.DeserializeObject<LayerEntity>(JsonConvert.SerializeObject(LayerEntity));
JsonSerializerSettings settings = new JsonSerializerSettings {TypeNameHandling = TypeNameHandling.All};
LayerEntity entityCopy = JsonConvert.DeserializeObject<LayerEntity>(JsonConvert.SerializeObject(LayerEntity, settings), settings)!;
entityCopy.Id = Guid.NewGuid();
entityCopy.Name = entityCopy.Name + " - Copy";
entityCopy.Name += " - Copy";
Layer copy = new Layer(Profile, Parent, entityCopy);
copy.ChangeLayerBrush(LayerBrush.Descriptor);