Fix DockLayout and UIImage string encoding

This commit is contained in:
Yoshi Askharoun
2024-02-19 00:09:33 -06:00
parent 2e5eaedcdc
commit b0d5209f07
2 changed files with 21 additions and 2 deletions
+20 -1
View File
@@ -12,7 +12,7 @@ using Microsoft.Iris.Session;
namespace Microsoft.Iris.Drawing namespace Microsoft.Iris.Drawing
{ {
public abstract class UIImage : NotifyObjectBase public abstract class UIImage : NotifyObjectBase, IStringEncodable
{ {
private static Size s_sizeMaximumSurface = new Size(-1, -1); private static Size s_sizeMaximumSurface = new Size(-1, -1);
protected string _source; protected string _source;
@@ -192,5 +192,24 @@ namespace Microsoft.Iris.Drawing
public event ContentLoadCompleteHandler LoadComplete; public event ContentLoadCompleteHandler LoadComplete;
public override string ToString() => $"{{UIImage {RenderImage?.ToString() ?? "null"}}}"; public override string ToString() => $"{{UIImage {RenderImage?.ToString() ?? "null"}}}";
public string EncodeString()
{
System.Collections.Generic.List<string> props = new(5)
{
Source,
};
if (NineGrid != default)
props.Add(NineGrid.EncodeString());
if (MaximumSize != default)
props.Add(MaximumSize.EncodeString());
if (Flippable != default)
props.Add(Flippable.ToString());
if (AntialiasEdges != default)
props.Add(AntialiasEdges.ToString());
return string.Join(", ", props);
}
} }
} }
+1 -1
View File
@@ -126,7 +126,7 @@ namespace Microsoft.Iris.Layouts
if (other is not DockLayout o) return false; if (other is not DockLayout o) return false;
return DefaultChildAlignment == o.DefaultChildAlignment return DefaultChildAlignment == o.DefaultChildAlignment
&& DefaultLayoutInput.ToString() == other.DefaultChildAlignment.ToString(); && DefaultLayoutInput?.ToString() == o.DefaultLayoutInput?.ToString();
} }
} }
} }