mirror of
https://github.com/ZuneDev/MicrosoftIris.git
synced 2026-07-27 13:13:29 -07:00
Merge branch 'master' of https://github.com/ZuneDev/MicrosoftIris
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Microsoft.Iris;
|
||||||
|
|
||||||
|
public interface IHasCanonicalInstances
|
||||||
|
{
|
||||||
|
string GetCanonicalName();
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@ using Microsoft.Iris.Render;
|
|||||||
|
|
||||||
namespace Microsoft.Iris.Animations
|
namespace Microsoft.Iris.Animations
|
||||||
{
|
{
|
||||||
public class RelativeTo
|
public class RelativeTo : IHasCanonicalInstances
|
||||||
{
|
{
|
||||||
private IAnimatable _sourceObject;
|
private IAnimatable _sourceObject;
|
||||||
private int _sourceId;
|
private int _sourceId;
|
||||||
@@ -125,6 +125,12 @@ namespace Microsoft.Iris.Animations
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return GetCanonicalName()
|
||||||
|
?? $"[Object = {_sourceObject ?? (object)_sourceId}, Property = {_sourceProperty}]";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetCanonicalName()
|
||||||
{
|
{
|
||||||
if (this == s_absolute)
|
if (this == s_absolute)
|
||||||
return "Absolute";
|
return "Absolute";
|
||||||
@@ -132,7 +138,10 @@ namespace Microsoft.Iris.Animations
|
|||||||
return "Current";
|
return "Current";
|
||||||
if (this == s_currentSnapshotOnLoop)
|
if (this == s_currentSnapshotOnLoop)
|
||||||
return "CurrentSnapshotOnLoop";
|
return "CurrentSnapshotOnLoop";
|
||||||
return this == s_final ? "Final" : string.Format("[Object = {0}, Property = {1}]", _sourceObject != null ? _sourceObject : (object)_sourceId, _sourceProperty);
|
if (this == s_final)
|
||||||
|
return "Final";
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using Microsoft.Iris.Library;
|
|||||||
|
|
||||||
namespace Microsoft.Iris.Layouts
|
namespace Microsoft.Iris.Layouts
|
||||||
{
|
{
|
||||||
internal class DockLayoutInput : ILayoutInput, IStringEncodable
|
internal class DockLayoutInput : ILayoutInput, IStringEncodable, IHasCanonicalInstances
|
||||||
{
|
{
|
||||||
public static readonly DockLayoutInput Left = new DockLayoutInput();
|
public static readonly DockLayoutInput Left = new DockLayoutInput();
|
||||||
public static readonly DockLayoutInput Top = new DockLayoutInput();
|
public static readonly DockLayoutInput Top = new DockLayoutInput();
|
||||||
@@ -35,12 +35,17 @@ namespace Microsoft.Iris.Layouts
|
|||||||
return "Top";
|
return "Top";
|
||||||
if (this == Right)
|
if (this == Right)
|
||||||
return "Right";
|
return "Right";
|
||||||
return this == Bottom ? "Bottom" : "Client";
|
if (this == Bottom)
|
||||||
|
return "Bottom";
|
||||||
|
|
||||||
|
return "Client";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString() => InvariantString.Format("{0}(Position={1})", GetType().Name, PositionString);
|
public override string ToString() => InvariantString.Format("{0}(Position={1})", GetType().Name, PositionString);
|
||||||
|
|
||||||
public string EncodeString() => PositionString;
|
public string EncodeString() => PositionString;
|
||||||
|
|
||||||
|
public string GetCanonicalName() => PositionString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
namespace Microsoft.Iris.Layouts
|
namespace Microsoft.Iris.Layouts
|
||||||
{
|
{
|
||||||
internal class PlacementMode
|
internal class PlacementMode : IHasCanonicalInstances
|
||||||
{
|
{
|
||||||
private PopupPosition[] _popupPositions;
|
private PopupPosition[] _popupPositions;
|
||||||
private MouseTarget _mouseTarget;
|
private MouseTarget _mouseTarget;
|
||||||
@@ -50,7 +50,9 @@ namespace Microsoft.Iris.Layouts
|
|||||||
|
|
||||||
internal bool UsesTargetSize => _usesTargetSize;
|
internal bool UsesTargetSize => _usesTargetSize;
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString() => GetCanonicalName() ?? base.ToString();
|
||||||
|
|
||||||
|
public string GetCanonicalName()
|
||||||
{
|
{
|
||||||
if (this == s_origin)
|
if (this == s_origin)
|
||||||
return "Origin";
|
return "Origin";
|
||||||
@@ -70,7 +72,10 @@ namespace Microsoft.Iris.Layouts
|
|||||||
return "MouseBottom";
|
return "MouseBottom";
|
||||||
if (this == s_followMouseOrigin)
|
if (this == s_followMouseOrigin)
|
||||||
return "FollowMouseOrigin";
|
return "FollowMouseOrigin";
|
||||||
return this == s_followMouseBottom ? "FollowMouseBottom" : base.ToString();
|
if (this == s_followMouseBottom)
|
||||||
|
return "FollowMouseBottom";
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlacementMode Origin
|
public static PlacementMode Origin
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ using System.Reflection;
|
|||||||
|
|
||||||
namespace Microsoft.Iris.Markup
|
namespace Microsoft.Iris.Markup
|
||||||
{
|
{
|
||||||
internal class AssemblyTypeSchema : TypeSchema
|
internal class AssemblyTypeSchema : TypeSchema, ITypeSchemaWithInternalType
|
||||||
{
|
{
|
||||||
private Type _type;
|
private Type _type;
|
||||||
private TypeSchema _baseType;
|
private TypeSchema _baseType;
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Microsoft.Iris.Markup;
|
||||||
|
|
||||||
|
public interface ITypeSchemaWithInternalType
|
||||||
|
{
|
||||||
|
Type InternalType { get; }
|
||||||
|
}
|
||||||
@@ -93,6 +93,8 @@ namespace Microsoft.Iris.Markup
|
|||||||
|
|
||||||
public abstract bool SupportsBinaryEncoding { get; }
|
public abstract bool SupportsBinaryEncoding { get; }
|
||||||
|
|
||||||
|
public virtual bool SupportsCanonicalInstance => false;
|
||||||
|
|
||||||
public abstract object PerformOperation(object left, object right, OperationType op);
|
public abstract object PerformOperation(object left, object right, OperationType op);
|
||||||
|
|
||||||
public abstract bool SupportsOperation(OperationType op);
|
public abstract bool SupportsOperation(OperationType op);
|
||||||
|
|||||||
@@ -43,17 +43,18 @@ namespace Microsoft.Iris.Markup.UIX
|
|||||||
out object instance)
|
out object instance)
|
||||||
{
|
{
|
||||||
instance = Construct();
|
instance = Construct();
|
||||||
object valueObj1;
|
var horizontalResult = UIXLoadResult.ValidateStringAsValue(splitString[0], BooleanSchema.Type, null, out object horizontalValue);
|
||||||
Result result1 = UIXLoadResult.ValidateStringAsValue(splitString[0], BooleanSchema.Type, null, out valueObj1);
|
if (horizontalResult.Failed)
|
||||||
if (result1.Failed)
|
return Result.Fail("Problem converting '{0}' ({1})", "AnchorLayout", horizontalResult.Error);
|
||||||
return Result.Fail("Problem converting '{0}' ({1})", "AnchorLayout", result1.Error);
|
|
||||||
SetSizeToHorizontalChildren(ref instance, valueObj1);
|
SetSizeToHorizontalChildren(ref instance, horizontalValue);
|
||||||
object valueObj2;
|
|
||||||
Result result2 = UIXLoadResult.ValidateStringAsValue(splitString[1], BooleanSchema.Type, null, out valueObj2);
|
var verticalResult = UIXLoadResult.ValidateStringAsValue(splitString[1], BooleanSchema.Type, null, out object verticalValue);
|
||||||
if (result2.Failed)
|
if (verticalResult.Failed)
|
||||||
return Result.Fail("Problem converting '{0}' ({1})", "AnchorLayout", result2.Error);
|
return Result.Fail("Problem converting '{0}' ({1})", "AnchorLayout", verticalResult.Error);
|
||||||
SetSizeToVerticalChildren(ref instance, valueObj2);
|
SetSizeToVerticalChildren(ref instance, verticalValue);
|
||||||
return result2;
|
|
||||||
|
return verticalResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool IsConversionSupported(TypeSchema fromType) => StringSchema.Type.IsAssignableFrom(fromType);
|
private static bool IsConversionSupported(TypeSchema fromType) => StringSchema.Type.IsAssignableFrom(fromType);
|
||||||
|
|||||||
@@ -234,6 +234,8 @@ namespace Microsoft.Iris.Markup
|
|||||||
|
|
||||||
public override bool SupportsBinaryEncoding => _encodeBinary != null;
|
public override bool SupportsBinaryEncoding => _encodeBinary != null;
|
||||||
|
|
||||||
|
public override bool SupportsCanonicalInstance => _findCanonicalInstance != null;
|
||||||
|
|
||||||
public override int FindTypeHint => _typeID;
|
public override int FindTypeHint => _typeID;
|
||||||
|
|
||||||
public override object PerformOperation(object left, object right, OperationType op)
|
public override object PerformOperation(object left, object right, OperationType op)
|
||||||
|
|||||||
Reference in New Issue
Block a user