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:
@@ -8,7 +8,7 @@ using Microsoft.Iris.Render;
|
||||
|
||||
namespace Microsoft.Iris.Animations
|
||||
{
|
||||
public class RelativeTo
|
||||
public class RelativeTo : IHasCanonicalInstances
|
||||
{
|
||||
private IAnimatable _sourceObject;
|
||||
private int _sourceId;
|
||||
@@ -125,6 +125,12 @@ namespace Microsoft.Iris.Animations
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return GetCanonicalName()
|
||||
?? $"[Object = {_sourceObject ?? (object)_sourceId}, Property = {_sourceProperty}]";
|
||||
}
|
||||
|
||||
public string GetCanonicalName()
|
||||
{
|
||||
if (this == s_absolute)
|
||||
return "Absolute";
|
||||
@@ -132,7 +138,10 @@ namespace Microsoft.Iris.Animations
|
||||
return "Current";
|
||||
if (this == s_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
|
||||
{
|
||||
internal class DockLayoutInput : ILayoutInput, IStringEncodable
|
||||
internal class DockLayoutInput : ILayoutInput, IStringEncodable, IHasCanonicalInstances
|
||||
{
|
||||
public static readonly DockLayoutInput Left = new DockLayoutInput();
|
||||
public static readonly DockLayoutInput Top = new DockLayoutInput();
|
||||
@@ -35,12 +35,17 @@ namespace Microsoft.Iris.Layouts
|
||||
return "Top";
|
||||
if (this == 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 string EncodeString() => PositionString;
|
||||
|
||||
public string GetCanonicalName() => PositionString;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace Microsoft.Iris.Layouts
|
||||
{
|
||||
internal class PlacementMode
|
||||
internal class PlacementMode : IHasCanonicalInstances
|
||||
{
|
||||
private PopupPosition[] _popupPositions;
|
||||
private MouseTarget _mouseTarget;
|
||||
@@ -50,7 +50,9 @@ namespace Microsoft.Iris.Layouts
|
||||
|
||||
internal bool UsesTargetSize => _usesTargetSize;
|
||||
|
||||
public override string ToString()
|
||||
public override string ToString() => GetCanonicalName() ?? base.ToString();
|
||||
|
||||
public string GetCanonicalName()
|
||||
{
|
||||
if (this == s_origin)
|
||||
return "Origin";
|
||||
@@ -70,7 +72,10 @@ namespace Microsoft.Iris.Layouts
|
||||
return "MouseBottom";
|
||||
if (this == s_followMouseOrigin)
|
||||
return "FollowMouseOrigin";
|
||||
return this == s_followMouseBottom ? "FollowMouseBottom" : base.ToString();
|
||||
if (this == s_followMouseBottom)
|
||||
return "FollowMouseBottom";
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static PlacementMode Origin
|
||||
|
||||
@@ -12,7 +12,7 @@ using System.Reflection;
|
||||
|
||||
namespace Microsoft.Iris.Markup
|
||||
{
|
||||
internal class AssemblyTypeSchema : TypeSchema
|
||||
internal class AssemblyTypeSchema : TypeSchema, ITypeSchemaWithInternalType
|
||||
{
|
||||
private Type _type;
|
||||
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 virtual bool SupportsCanonicalInstance => false;
|
||||
|
||||
public abstract object PerformOperation(object left, object right, OperationType op);
|
||||
|
||||
public abstract bool SupportsOperation(OperationType op);
|
||||
|
||||
@@ -43,17 +43,18 @@ namespace Microsoft.Iris.Markup.UIX
|
||||
out object instance)
|
||||
{
|
||||
instance = Construct();
|
||||
object valueObj1;
|
||||
Result result1 = UIXLoadResult.ValidateStringAsValue(splitString[0], BooleanSchema.Type, null, out valueObj1);
|
||||
if (result1.Failed)
|
||||
return Result.Fail("Problem converting '{0}' ({1})", "AnchorLayout", result1.Error);
|
||||
SetSizeToHorizontalChildren(ref instance, valueObj1);
|
||||
object valueObj2;
|
||||
Result result2 = UIXLoadResult.ValidateStringAsValue(splitString[1], BooleanSchema.Type, null, out valueObj2);
|
||||
if (result2.Failed)
|
||||
return Result.Fail("Problem converting '{0}' ({1})", "AnchorLayout", result2.Error);
|
||||
SetSizeToVerticalChildren(ref instance, valueObj2);
|
||||
return result2;
|
||||
var horizontalResult = UIXLoadResult.ValidateStringAsValue(splitString[0], BooleanSchema.Type, null, out object horizontalValue);
|
||||
if (horizontalResult.Failed)
|
||||
return Result.Fail("Problem converting '{0}' ({1})", "AnchorLayout", horizontalResult.Error);
|
||||
|
||||
SetSizeToHorizontalChildren(ref instance, horizontalValue);
|
||||
|
||||
var verticalResult = UIXLoadResult.ValidateStringAsValue(splitString[1], BooleanSchema.Type, null, out object verticalValue);
|
||||
if (verticalResult.Failed)
|
||||
return Result.Fail("Problem converting '{0}' ({1})", "AnchorLayout", verticalResult.Error);
|
||||
SetSizeToVerticalChildren(ref instance, verticalValue);
|
||||
|
||||
return verticalResult;
|
||||
}
|
||||
|
||||
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 SupportsCanonicalInstance => _findCanonicalInstance != null;
|
||||
|
||||
public override int FindTypeHint => _typeID;
|
||||
|
||||
public override object PerformOperation(object left, object right, OperationType op)
|
||||
|
||||
Reference in New Issue
Block a user