public void PropertyReferenceConstructor_WithNoSlashes_ShouldOnlySetPropertyName()
 {
     const string fullPath = "X";
     var target = new PropertyReference(fullPath);
     Assert.AreEqual(string.Empty, target.Path);
     Assert.AreEqual("X", target.PropertyName);
 }
 public void PropertyReferenceConstructor_WithTwoSlashes_ShouldSetPathAndPropertyName()
 {
     const string fullPath = "X/Y/Z";
     var target = new PropertyReference(fullPath);
     Assert.AreEqual("X/Y", target.Path);
     Assert.AreEqual("Z", target.PropertyName);
 }
Esempio n. 3
0
    void InjectPropertyGetterGuard(MethodBody getBody, SequencePoint seqPoint, PropertyReference property)
    {
        var guardInstructions = new List<Instruction>();

        var returnPoints = getBody.Instructions
            .Select((o, i) => new { o, i })
            .Where(a => a.o.OpCode == OpCodes.Ret)
            .Select(a => a.i)
            .OrderByDescending(i => i);

        foreach (var ret in returnPoints)
        {
            var returnInstruction = getBody.Instructions[ret];
            var errorMessage = string.Format(CultureInfo.InvariantCulture, ReturnValueOfPropertyIsNull, property.FullName);

            guardInstructions.Clear();

            if (isDebug)
            {
                InstructionPatterns.DuplicateReturnValue(guardInstructions, property.PropertyType);

                InstructionPatterns.CallDebugAssertInstructions(guardInstructions, errorMessage);
            }

            InstructionPatterns.DuplicateReturnValue(guardInstructions, property.PropertyType);

            InstructionPatterns.IfNull(guardInstructions, returnInstruction, i =>
            {
                // Clean up the stack since we're about to throw up.
                i.Add(Instruction.Create(OpCodes.Pop));

                InstructionPatterns.LoadInvalidOperationException(i, errorMessage);

                // Throw the top item off the stack
                i.Add(Instruction.Create(OpCodes.Throw));
            });

            guardInstructions[0].HideLineFromDebugger(seqPoint);

            getBody.Instructions.Insert(ret, guardInstructions);
        }
    }
        public static DocumentNodePath ResolveNodePathForTemplateWithinExistingStyle(SceneElement targetElement, PropertyReference targetPropertyReference)
        {
            DocumentNodePath documentNodePath = ControlStylingOperations.ProvideStyleOrTemplateNodePath(targetElement, targetPropertyReference);

            if (documentNodePath != null)
            {
                SceneView defaultView = targetElement.ViewModel.DefaultView;
                ICollection <IViewObject> instantiatedElements = defaultView.GetInstantiatedElements(documentNodePath);
                if (instantiatedElements.Count <= 0)
                {
                    return(ControlStylingOperations.FindTemplateWithinStyle(documentNodePath, targetElement, ControlElement.TemplateProperty, (IPropertyId)targetPropertyReference[0]));
                }
                foreach (IViewObject viewObject in (IEnumerable <IViewObject>)instantiatedElements)
                {
                    if (PlatformTypes.Control.IsAssignableFrom((ITypeId)viewObject.GetIType((ITypeResolver)targetElement.ProjectContext)))
                    {
                        object platformObject = viewObject.GetValue(targetElement.ProjectContext.ResolveProperty(ControlElement.TemplateProperty));
                        if (platformObject != null)
                        {
                            IViewObject      instance = targetElement.ViewModel.ProjectContext.Platform.ViewObjectFactory.Instantiate(platformObject);
                            DocumentNodePath correspondingNodePath = defaultView.GetCorrespondingNodePath(instance, true);
                            if (correspondingNodePath != null && ControlStylingOperations.ShouldSetEditingContextToNodePath(correspondingNodePath, targetElement, targetPropertyReference[0]))
                            {
                                return(correspondingNodePath);
                            }
                        }
                    }
                }
            }
            return((DocumentNodePath)null);
        }
        public static IEnumerable <Instruction> PushServiceProvider(this INode node, ILContext context, FieldReference bpRef = null, PropertyReference propertyRef = null, TypeReference declaringTypeReference = null)
        {
            var module = context.Body.Method.Module;

#if NOSERVICEPROVIDER
            yield return(Instruction.Create(OpCodes.Ldnull));

            yield break;
#endif

            var ctorinfo = typeof(XamlServiceProvider).GetConstructor(new Type[] { });
            var ctor     = module.Import(ctorinfo);

            var addServiceInfo = typeof(XamlServiceProvider).GetMethod("Add", new[] { typeof(Type), typeof(object) });
            var addService     = module.Import(addServiceInfo);

            var getTypeFromHandle =
                module.Import(typeof(Type).GetMethod("GetTypeFromHandle", new[] { typeof(RuntimeTypeHandle) }));
            var getAssembly = module.Import(typeof(Type).GetProperty("Assembly").GetMethod);

            yield return(Instruction.Create(OpCodes.Newobj, ctor));

            //Add a SimpleValueTargetProvider
            var pushParentIl = node.PushParentObjectsArray(context).ToList();
            if (pushParentIl[pushParentIl.Count - 1].OpCode != OpCodes.Ldnull)
            {
                yield return(Instruction.Create(OpCodes.Dup));                //Keep the serviceProvider on the stack

                yield return(Instruction.Create(OpCodes.Ldtoken, module.Import(typeof(IProvideValueTarget))));

                yield return(Instruction.Create(OpCodes.Call, module.Import(getTypeFromHandle)));

                foreach (var instruction in pushParentIl)
                {
                    yield return(instruction);
                }

                foreach (var instruction in PushTargetProperty(bpRef, propertyRef, declaringTypeReference, module))
                {
                    yield return(instruction);
                }

                var targetProviderCtor =
                    module.Import(typeof(SimpleValueTargetProvider).GetConstructor(new[] { typeof(object[]), typeof(object) }));
                yield return(Instruction.Create(OpCodes.Newobj, targetProviderCtor));

                yield return(Instruction.Create(OpCodes.Callvirt, addService));
            }

            //Add a NamescopeProvider
            if (context.Scopes.ContainsKey(node))
            {
                yield return(Instruction.Create(OpCodes.Dup));                //Dupicate the serviceProvider

                yield return(Instruction.Create(OpCodes.Ldtoken, module.Import(typeof(INameScopeProvider))));

                yield return(Instruction.Create(OpCodes.Call, module.Import(getTypeFromHandle)));

                var namescopeProviderCtor = module.Import(typeof(NameScopeProvider).GetConstructor(new Type[] { }));
                yield return(Instruction.Create(OpCodes.Newobj, namescopeProviderCtor));

                yield return(Instruction.Create(OpCodes.Dup));                //Duplicate the namescopeProvider

                var setNamescope = module.Import(typeof(NameScopeProvider).GetProperty("NameScope").GetSetMethod());

                yield return(Instruction.Create(OpCodes.Ldloc, context.Scopes[node]));

                yield return(Instruction.Create(OpCodes.Callvirt, setNamescope));

                yield return(Instruction.Create(OpCodes.Callvirt, addService));
            }

            //Add a XamlTypeResolver
            if (node.NamespaceResolver != null)
            {
                yield return(Instruction.Create(OpCodes.Dup));                //Dupicate the serviceProvider

                yield return(Instruction.Create(OpCodes.Ldtoken, module.Import(typeof(IXamlTypeResolver))));

                yield return(Instruction.Create(OpCodes.Call, module.Import(getTypeFromHandle)));

                var xmlNamespaceResolverCtor = module.Import(typeof(XmlNamespaceResolver).GetConstructor(new Type[] { }));
                var addNamespace             = module.Import(typeof(XmlNamespaceResolver).GetMethod("Add"));
                yield return(Instruction.Create(OpCodes.Newobj, xmlNamespaceResolverCtor));

                foreach (var kvp in node.NamespaceResolver.GetNamespacesInScope(XmlNamespaceScope.ExcludeXml))
                {
                    yield return(Instruction.Create(OpCodes.Dup));                    //dup the resolver

                    yield return(Instruction.Create(OpCodes.Ldstr, kvp.Key));

                    yield return(Instruction.Create(OpCodes.Ldstr, kvp.Value));

                    yield return(Instruction.Create(OpCodes.Callvirt, addNamespace));
                }
                yield return(Instruction.Create(OpCodes.Ldtoken, context.Body.Method.DeclaringType));

                yield return(Instruction.Create(OpCodes.Call, module.Import(getTypeFromHandle)));

                yield return(Instruction.Create(OpCodes.Callvirt, getAssembly));

                var xtr = module.Import(typeof(XamlTypeResolver)).Resolve();
                var xamlTypeResolverCtor = module.Import(xtr.Methods.First(md => md.IsConstructor && md.Parameters.Count == 2));
                yield return(Instruction.Create(OpCodes.Newobj, xamlTypeResolverCtor));

                yield return(Instruction.Create(OpCodes.Callvirt, addService));
            }

            if (node is IXmlLineInfo)
            {
                yield return(Instruction.Create(OpCodes.Dup));                //Dupicate the serviceProvider

                yield return(Instruction.Create(OpCodes.Ldtoken, module.Import(typeof(IXmlLineInfoProvider))));

                yield return(Instruction.Create(OpCodes.Call, module.Import(getTypeFromHandle)));

                foreach (var instruction in node.PushXmlLineInfo(context))
                {
                    yield return(instruction);
                }

                var lip = module.Import(typeof(XmlLineInfoProvider)).Resolve();
                var lineInfoProviderCtor = module.Import(lip.Methods.First(md => md.IsConstructor && md.Parameters.Count == 1));
                yield return(Instruction.Create(OpCodes.Newobj, lineInfoProviderCtor));

                yield return(Instruction.Create(OpCodes.Callvirt, addService));
            }
        }
Esempio n. 6
0
        protected override DocumentNodePath ProvideEditingContainer(SceneElement targetElement, PropertyReference targetProperty, DocumentNode resourceNode)
        {
            SceneViewModel   viewModel        = targetElement.ViewModel.GetViewModel(resourceNode.DocumentRoot, false);
            DocumentNodePath documentNodePath = targetElement.GetLocalValueAsDocumentNode(targetProperty) ?? new DocumentNodePath(resourceNode.DocumentRoot.RootNode, resourceNode);
            DocumentNode     documentNode     = (viewModel.GetSceneNode(resourceNode) as StyleNode).GetLocalValueAsSceneNode(ControlElement.TemplateProperty).DocumentNode;

            return(documentNodePath.GetPathInContainer((DocumentNode)documentNode.Parent).GetPathInSubContainer(documentNode.SitePropertyKey, documentNode));
        }
Esempio n. 7
0
 public KeyframeSceneNodeProperty(SceneNodeObjectSet objectSet, PropertyReference propertyReference, AttributeCollection attributes, Type proxyType)
     : base(objectSet, propertyReference, attributes, (PropertyValue)null, proxyType)
 {
 }
Esempio n. 8
0
 static PropertyDefinition Find(this TypeReference declaringType, PropertyReference reference)
 {
     return(declaringType.Resolve().Properties
            .FirstOrDefault(property => HasSameSignature(declaringType, property, reference.DeclaringType, reference.Resolve())));
 }
		public void AddPropertyReference(string referencedClass, string propertyName)
		{
			var upr = new PropertyReference {referencedClass = referencedClass, propertyName = propertyName};
			propertyReferences.Add(upr);
		}
Esempio n. 10
0
 public bool IsSet(PropertyReference propertyReference)
 {
     return(propertyReference.IsSet(this.viewObject));
 }
Esempio n. 11
0
		internal void AddPropertyReference(string referencedClass, string propertyName)
		{
			PropertyReference upr = new PropertyReference();
			upr.referencedClass = referencedClass;
			upr.propertyName = propertyName;
			propertyReferences.Add(upr);
		}
		protected MarkupPropertyBase( PropertyReference reference )
		{
			Reference = reference;
		}
 /// <summary>
 /// Opens the array size field menu.
 /// </summary>
 void OpenArraySizeFieldMenu( Object targetObject, string targetPropertyPath, Vector3 mousePos )
 {
     PropertyReference propRef = new PropertyReference();
     propRef.target = targetObject;
     propRef.path   = targetPropertyPath;
     Rect menuRect = new Rect( mousePos.x, mousePos.y, 0, 0 );
     EditorUtility.DisplayCustomMenu( menuRect, CreateArraySizeMenuContents(), -1, SelectArraySizeMenuCallback, propRef );
 }
Esempio n. 14
0
 /// <summary>
 /// Resolves a property reference declared in this assembly.
 /// </summary>
 /// <param name="propertyRef">The property reference to resolve.</param>
 /// <returns>A property referred to by the reference.</returns>
 public IProperty Resolve(PropertyReference propertyRef)
 {
     return(Resolver.Resolve(propertyRef, this));
 }
Esempio n. 15
0
 public void ClearValue(PropertyReference propertyReference)
 {
     propertyReference.ClearValue(this.viewObject);
 }
Esempio n. 16
0
 public override string ToString()
 {
     return(PropertyReference.ToString(this.mTarget, this.name));
 }
Esempio n. 17
0
 public object GetBaseValue(PropertyReference propertyReference)
 {
     return(propertyReference.GetBaseValue(this.viewObject));
 }
Esempio n. 18
0
        public static Transform ReplacePathGeometry(PathElement pathElement, PathGeometry pathGeometry, SceneEditTransaction editTransaction)
        {
            Transform transform1 = Transform.Identity;

            using (pathElement.ViewModel.ForceBaseValue())
            {
                if (pathGeometry == null)
                {
                    pathElement.ClearLocalValue(PathElement.DataProperty);
                }
                else
                {
                    editTransaction.Update();
                    ILayoutDesigner designerForChild = pathElement.ViewModel.GetLayoutDesignerForChild((SceneElement)pathElement, true);
                    Rect            childRect        = designerForChild.GetChildRect((BaseFrameworkElement)pathElement);
                    Path            path             = pathElement.Path;
                    Transform       transform2       = path == null ? (Transform)null : path.RenderTransform;
                    Point           point1           = path == null ? new Point(0.0, 0.0) : path.RenderTransformOrigin;
                    double          num           = path == null || path.Stroke == null ? 0.0 : path.StrokeThickness;
                    Rect            bounds        = pathGeometry.Bounds;
                    PathGeometry    pathGeometry1 = new PathGeometry();
                    pathGeometry1.AddGeometry((System.Windows.Media.Geometry)pathGeometry);
                    Rect   rect1   = PathCommandHelper.InflateRectByStrokeWidth(pathGeometry1.Bounds, pathElement, false);
                    Vector vector1 = new Vector(-rect1.Left, -rect1.Top);
                    transform1 = (Transform) new TranslateTransform(vector1.X, vector1.Y);
                    PathGeometry pathGeometry2 = PathGeometryUtilities.TransformGeometry((System.Windows.Media.Geometry)pathGeometry1, transform1);
                    pathElement.PathGeometry = pathGeometry2;
                    PropertyReference propertyReference = PathCommandHelper.GetPathDataPropertyReference(pathElement.Platform);
                    PathCommandHelper.TransformPointKeyframes((SceneElement)pathElement, propertyReference, transform1);
                    if (!bounds.IsEmpty)
                    {
                        bounds.Inflate(num / 2.0, num / 2.0);
                        Rect rect2 = new Rect(childRect.Left + bounds.Left, childRect.Top + bounds.Top, bounds.Width, bounds.Height);
                        editTransaction.Update();
                        designerForChild.SetChildRect((BaseFrameworkElement)pathElement, rect2);
                        if (pathElement.IsSet(Base2DElement.RenderTransformOriginProperty) != PropertyState.Set)
                        {
                            if (transform2 != null)
                            {
                                if (transform2.Value.IsIdentity)
                                {
                                    goto label_15;
                                }
                            }
                            else
                            {
                                goto label_15;
                            }
                        }
                        Vector vector2 = childRect.TopLeft + new Vector(point1.X * childRect.Width, point1.Y * childRect.Height) - rect2.TopLeft;
                        Point  point2  = new Point(0.0, 0.0);
                        if (rect2.Width != 0.0)
                        {
                            point2.X = vector2.X / rect2.Width;
                        }
                        if (rect2.Height != 0.0)
                        {
                            point2.Y = vector2.Y / rect2.Height;
                        }
                        pathElement.RenderTransformOrigin = point2;
                    }
                }
            }
label_15:
            return(transform1);
        }
Esempio n. 19
0
        /************************************************************************************************************************/

        /// <summary>Returns true if the `reference` and <see cref="PropertyReference.Property"/> are not null.</summary>
        public static bool IsValid(this PropertyReference reference) => reference?.Property != null;
Esempio n. 20
0
 private static void FixPropertyNaming(PropertyReference property)
 {
     FixNaming(property, t => t.Name, (t, name) => t.Name = name,
               TypeNameToMemberPrefix(property.PropertyType.GetElementType().Name));
 }
 protected virtual void NotifyPropertyReferenceChanged(PropertyReference propertyReference)
 {
 }
Esempio n. 22
0
 public bool HasProperty(PropertyReference propRef)
 {
     return(assembly.FullName == propRef.Resolve().Module.Assembly.FullName);
 }
Esempio n. 23
0
        private void UpdateBrushForMappingModeChange(PropertyReference brushPropertyReference, BrushMappingMode mappingMode)
        {
            GradientBrush gradientBrush = this.GetComputedValueAsWpf(brushPropertyReference) as GradientBrush;

            if (gradientBrush == null || gradientBrush.MappingMode == mappingMode)
            {
                return;
            }
            Rect computedTightBounds = this.GetComputedTightBounds();

            if (computedTightBounds.IsEmpty)
            {
                return;
            }
            Matrix identity = Matrix.Identity;
            Matrix matrix   = Matrix.Identity;

            if (BrushAdorner.IsAdorningFillProperty((SceneElement)this))
            {
                matrix = BrushAdorner.GetStrokeTransform((SceneElement)this);
            }
            if (mappingMode == BrushMappingMode.Absolute)
            {
                identity *= matrix;
                identity.Scale(computedTightBounds.Width, computedTightBounds.Height);
                identity.Translate(computedTightBounds.X, computedTightBounds.Y);
            }
            else if (mappingMode == BrushMappingMode.RelativeToBoundingBox)
            {
                identity.Translate(-computedTightBounds.X, -computedTightBounds.Y);
                identity.Scale(computedTightBounds.Width == 0.0 ? 1.0 : 1.0 / computedTightBounds.Width, computedTightBounds.Height == 0.0 ? 1.0 : 1.0 / computedTightBounds.Height);
                matrix.Invert();
                identity *= matrix;
            }
            if (identity.IsIdentity)
            {
                return;
            }
            LinearGradientBrush linearGradientBrush;

            if ((linearGradientBrush = gradientBrush as LinearGradientBrush) != null)
            {
                Point point1 = RoundingHelper.RoundPosition(linearGradientBrush.StartPoint * identity);
                Point point2 = RoundingHelper.RoundPosition(linearGradientBrush.EndPoint * identity);
                this.SetValueAsWpf(brushPropertyReference.Append(LinearGradientBrushNode.StartPointProperty), (object)point1);
                this.SetValueAsWpf(brushPropertyReference.Append(LinearGradientBrushNode.EndPointProperty), (object)point2);
            }
            else
            {
                RadialGradientBrush radialGradientBrush;
                if ((radialGradientBrush = gradientBrush as RadialGradientBrush) == null)
                {
                    return;
                }
                Point  point1 = RoundingHelper.RoundPosition(radialGradientBrush.Center * identity);
                Point  point2 = RoundingHelper.RoundPosition(radialGradientBrush.GradientOrigin * identity);
                double num1   = RoundingHelper.RoundLength(radialGradientBrush.RadiusX * identity.M11);
                double num2   = RoundingHelper.RoundLength(radialGradientBrush.RadiusY * identity.M22);
                this.SetValueAsWpf(brushPropertyReference.Append(RadialGradientBrushNode.CenterProperty), (object)point1);
                this.SetValueAsWpf(brushPropertyReference.Append(RadialGradientBrushNode.GradientOriginProperty), (object)point2);
                this.SetValue(brushPropertyReference.Append(RadialGradientBrushNode.RadiusXProperty), (object)num1);
                this.SetValue(brushPropertyReference.Append(RadialGradientBrushNode.RadiusYProperty), (object)num2);
            }
        }
Esempio n. 24
0
 protected override DocumentNodePath ProvideEditingContainer(SceneElement targetElement, PropertyReference targetProperty, DocumentNode resourceNode)
 {
     return(ControlStylingOperations.ResolveNodePathForTemplateWithinExistingStyle(targetElement, targetProperty) ?? base.ProvideEditingContainer(targetElement, targetProperty, resourceNode));
 }
Esempio n. 25
0
 public KeyFrameAnimationSceneNode InstantiateWithTarget(SceneViewModel viewModel, SceneNode targetElement, PropertyReference targetProperty, IStoryboardContainer referenceStoryboardContainer, ITypeId type)
 {
     return((KeyFrameAnimationSceneNode)base.InstantiateWithTarget(viewModel, targetElement, targetProperty, referenceStoryboardContainer, type));
 }
Esempio n. 26
0
 public static PropertyReference PropertyReferenceFromVisual3D(Base3DElement item, PropertyReference propertyReference)
 {
     for (Base3DElement base3Delement = item.ParentElement as Base3DElement; base3Delement != null; base3Delement = item.ParentElement as Base3DElement)
     {
         if (base3Delement is ModelVisual3DElement)
         {
             if (item is Model3DElement)
             {
                 propertyReference = new PropertyReference((ReferenceStep)item.ProjectContext.ResolveProperty(ModelVisual3DElement.ContentProperty)).Append(propertyReference);
                 break;
             }
             break;
         }
         if (base3Delement is ModelUIElement3DElement)
         {
             if (item is Model3DElement)
             {
                 propertyReference = new PropertyReference((ReferenceStep)item.ProjectContext.ResolveProperty(ModelUIElement3DElement.ModelProperty)).Append(propertyReference);
                 break;
             }
             break;
         }
         int siteChildIndex = item.DocumentNode.SiteChildIndex;
         PropertyReference propertyReference1 = new PropertyReference((ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((ITypeResolver)item.ProjectContext, typeof(Model3DCollection), siteChildIndex));
         propertyReference = new PropertyReference((ReferenceStep)item.ProjectContext.ResolveProperty(Model3DGroupElement.ChildrenProperty)).Append(propertyReference1).Append(propertyReference);
         item = base3Delement;
     }
     return(propertyReference);
 }
Esempio n. 27
0
        public void ReverseKeyFrames(double startTime, double endTime)
        {
            if (this.KeyFrameCount == 0)
            {
                return;
            }
            this.ConvertKeySplineResourcesToLocalValues();
            int capacity = 0;
            IList <KeyFrameSceneNode> keyFrameCollection = this.KeyFrameCollection;
            int index1 = 0;

            while (index1 < keyFrameCollection.Count && keyFrameCollection[index1].Time < startTime)
            {
                ++index1;
            }
            int index2 = index1;

            for (; index1 < keyFrameCollection.Count && keyFrameCollection[index1].Time <= endTime; ++index1)
            {
                ++capacity;
            }
            if (capacity == 0)
            {
                return;
            }
            bool flag = startTime == 0.0 && keyFrameCollection[0].Time != 0.0;

            if (flag)
            {
                ++capacity;
            }
            List <KeyFrameSceneNode> list1 = new List <KeyFrameSceneNode>(capacity);
            List <Point?>            list2 = new List <Point?>(capacity);

            if (flag)
            {
                KeyFrameSceneNode keyFrameSceneNode = this.IsDiscreteOnly ? (KeyFrameSceneNode)KeyFrameSceneNode.Factory.Instantiate(this.ViewModel, this.GetKeyFrameType(KeyFrameInterpolationType.Discrete)) : (KeyFrameSceneNode)KeyFrameSceneNode.Factory.Instantiate(this.ViewModel, this.GetKeyFrameType(KeyFrameInterpolationType.Spline));
                keyFrameSceneNode.Time = 0.0;
                SceneElement sceneElement = this.TargetElement as SceneElement;
                IViewObject  viewObject   = sceneElement.ViewTargetElement;
                if (PlatformTypes.Viewport3D.Equals((object)viewObject.GetIType((ITypeResolver)this.ProjectContext)))
                {
                    viewObject = sceneElement.ViewObject;
                }
                PropertyReference propertyReference = DesignTimeProperties.GetAppliedShadowPropertyReference(this.TargetProperty, (ITypeId)this.Type);
                keyFrameSceneNode.Value = viewObject.GetBaseValue(propertyReference);
                list1.Add(keyFrameSceneNode);
                if (keyFrameCollection[0].InterpolationType == KeyFrameInterpolationType.Spline && keyFrameCollection[0].KeySpline != null)
                {
                    list2.Add(new Point?(keyFrameCollection[0].KeySpline.ControlPoint1));
                }
                else if (!this.IsDiscreteOnly)
                {
                    list2.Add(new Point?(new Point()));
                }
                else
                {
                    list2.Add(new Point?());
                }
            }
            int num1 = 0;

            while (list1.Count < capacity)
            {
                if (keyFrameCollection[index2].InterpolationType != KeyFrameInterpolationType.Discrete)
                {
                    list2.Add(new Point?(keyFrameCollection[index2].EaseOutControlPoint));
                }
                else
                {
                    list2.Add(new Point?());
                }
                list1.Add(keyFrameCollection[index2]);
                keyFrameCollection.RemoveAt(index2);
                ++num1;
            }
            for (int index3 = 0; index3 < list1.Count; ++index3)
            {
                KeyFrameSceneNode keyFrameSceneNode1 = list1[index3];
                Point?            nullable1          = list2[index3];
                Point?            nullable2          = new Point?();
                if (keyFrameSceneNode1.InterpolationType != KeyFrameInterpolationType.Discrete)
                {
                    nullable2 = new Point?(keyFrameSceneNode1.EaseInControlPoint);
                }
                double            num2 = endTime - (keyFrameSceneNode1.Time - startTime);
                KeyFrameSceneNode node;
                if (nullable1.HasValue)
                {
                    KeyFrameSceneNode keyFrameSceneNode2 = (KeyFrameSceneNode)KeyFrameSceneNode.Factory.Instantiate(this.ViewModel, this.GetKeyFrameType(KeyFrameInterpolationType.Spline));
                    keyFrameSceneNode2.ValueNode = keyFrameSceneNode1.ValueNode.Clone(keyFrameSceneNode2.DocumentContext);
                    node = keyFrameSceneNode2;
                    node.EaseInControlPoint = new Point(1.0 - nullable1.Value.X, 1.0 - nullable1.Value.Y);
                }
                else
                {
                    KeyFrameSceneNode keyFrameSceneNode2 = (KeyFrameSceneNode)KeyFrameSceneNode.Factory.Instantiate(this.ViewModel, this.GetKeyFrameType(KeyFrameInterpolationType.Discrete));
                    keyFrameSceneNode2.ValueNode = keyFrameSceneNode1.ValueNode.Clone(keyFrameSceneNode2.DocumentContext);
                    node = keyFrameSceneNode2;
                }
                node.Time = num2;
                keyFrameCollection.Insert(index2, node);
                if (nullable2.HasValue)
                {
                    Point newEaseOut = new Point(1.0 - nullable2.Value.X, 1.0 - nullable2.Value.Y);
                    KeyFrameSceneNode.SetEaseOutControlPoint(node, newEaseOut);
                }
            }
            if (!flag)
            {
                return;
            }
            Point?nullable = new Point?(keyFrameCollection[0].EaseOutControlPoint);

            if (nullable.HasValue)
            {
                this.SetHandoffKeyFrameEaseOutPoint(nullable.Value);
            }
            this.RemoveKeyFrame(0.0);
        }
        public static DocumentNodePath ProvideStyleOrTemplateNodePath(SceneElement targetElement, PropertyReference targetPropertyReference)
        {
            DocumentNodePath documentNodePath = (DocumentNodePath)null;
            ReferenceStep    targetProperty   = targetPropertyReference[0];
            StyleNode        styleNode        = targetElement as StyleNode;

            if (targetPropertyReference.TargetType.IsAssignableFrom(targetElement.TargetType) || styleNode != null && targetPropertyReference.TargetType.IsAssignableFrom(styleNode.StyleTargetType))
            {
                IViewObjectFactory viewObjectFactory = targetElement.Platform.ViewObjectFactory;
                object             computedValue     = targetElement.GetComputedValue(targetPropertyReference);
                DocumentNodePath   valuePath         = (DocumentNodePath)null;
                if (computedValue != null)
                {
                    IViewObject instance = viewObjectFactory.Instantiate(computedValue);
                    valuePath = targetElement.ViewModel.DefaultView.GetCorrespondingNodePath(instance, true);
                }
                if (valuePath == null && !BaseFrameworkElement.StyleProperty.Equals((object)targetProperty))
                {
                    BaseFrameworkElement frameworkElement = targetElement as BaseFrameworkElement;
                    if (frameworkElement != null)
                    {
                        frameworkElement.FindMissingImplicitStyle();
                    }
                    if (computedValue != null)
                    {
                        IViewObject      instance = viewObjectFactory.Instantiate(computedValue);
                        DocumentNodePath correspondingNodePath = targetElement.ViewModel.DefaultView.GetCorrespondingNodePath(instance, true);
                        if (correspondingNodePath != null)
                        {
                            valuePath = ControlStylingOperations.FindTemplateWithinStyle(correspondingNodePath, targetElement, (IPropertyId)targetProperty, (IPropertyId)targetProperty);
                        }
                    }
                }
                if (ControlStylingOperations.ShouldSetEditingContextToNodePath(valuePath, targetElement, targetProperty))
                {
                    documentNodePath = valuePath;
                }
            }
            if (documentNodePath == null && styleNode != null && targetElement.IsSet(targetPropertyReference) == PropertyState.Set)
            {
                DocumentNodePath valueAsDocumentNode = targetElement.GetLocalValueAsDocumentNode(targetPropertyReference);
                if (ControlStylingOperations.ShouldSetEditingContextToNodePath(valueAsDocumentNode, targetElement, targetProperty))
                {
                    documentNodePath = valueAsDocumentNode;
                }
            }
            return(documentNodePath);
        }
Esempio n. 29
0
 protected override string GetPropertyName(PropertyReference property)
 {
     return((writerContext == null || writerContext.ModuleContext.Module == null) ? property.Name : base.GetPropertyName(property));
 }
Esempio n. 30
0
    public override void OnInspectorGUI()
    {
        PropertyBinding pb = target as PropertyBinding;

        NGUIEditorTools.SetLabelWidth(80f);

        serializedObject.Update();

        if (pb.direction == PropertyBinding.Direction.TargetUpdatesSource && pb.target != null)
        {
            PropertyReferenceDrawer.filter = pb.target.GetPropertyType();
        }

        GUILayout.Space(3f);
        PropertyBinding.Direction dir = (target as PropertyBinding).direction;

        PropertyReferenceDrawer.mustRead = (dir == PropertyBinding.Direction.SourceUpdatesTarget ||
                                            dir == PropertyBinding.Direction.BiDirectional);
        PropertyReferenceDrawer.mustWrite = (dir == PropertyBinding.Direction.TargetUpdatesSource ||
                                             dir == PropertyBinding.Direction.BiDirectional);

        NGUIEditorTools.DrawProperty(serializedObject, "source");

        if (pb.direction == PropertyBinding.Direction.SourceUpdatesTarget && pb.source != null)
        {
            PropertyReferenceDrawer.filter = pb.source.GetPropertyType();
        }

        if (pb.source.target != null)
        {
            GUILayout.Space(-18f);

            if (pb.direction == PropertyBinding.Direction.TargetUpdatesSource)
            {
                GUILayout.Label("   \u25B2");                 // Up
            }
            else if (pb.direction == PropertyBinding.Direction.SourceUpdatesTarget)
            {
                GUILayout.Label("   \u25BC");                 // Down
            }
            else
            {
                GUILayout.Label("  \u25B2\u25BC");
            }
        }

        GUILayout.Space(1f);

        PropertyReferenceDrawer.mustRead = (dir == PropertyBinding.Direction.TargetUpdatesSource ||
                                            dir == PropertyBinding.Direction.BiDirectional);
        PropertyReferenceDrawer.mustWrite = (dir == PropertyBinding.Direction.SourceUpdatesTarget ||
                                             dir == PropertyBinding.Direction.BiDirectional);

        NGUIEditorTools.DrawProperty(serializedObject, "target");

        PropertyReferenceDrawer.mustRead  = false;
        PropertyReferenceDrawer.mustWrite = false;
        PropertyReferenceDrawer.filter    = typeof(void);

        GUILayout.Space(1f);
        NGUIEditorTools.DrawPaddedProperty(serializedObject, "direction");
        NGUIEditorTools.DrawPaddedProperty(serializedObject, "update");
        GUILayout.BeginHorizontal();
        NGUIEditorTools.DrawProperty(" ", serializedObject, "editMode", GUILayout.Width(100f));
        GUILayout.Label("Update in Edit Mode");
        GUILayout.EndHorizontal();

        if (!serializedObject.isEditingMultipleObjects)
        {
            if (pb.source != null && pb.target != null && pb.source.GetPropertyType() != pb.target.GetPropertyType())
            {
                if (pb.direction == PropertyBinding.Direction.BiDirectional)
                {
                    EditorGUILayout.HelpBox("Bi-Directional updates require both Source and Target to reference values of the same type.", MessageType.Error);
                }
                else if (pb.direction == PropertyBinding.Direction.SourceUpdatesTarget)
                {
                    if (!PropertyReference.Convert(pb.source.Get(), pb.target.GetPropertyType()))
                    {
                        EditorGUILayout.HelpBox("Unable to convert " + pb.source.GetPropertyType() + " to " + pb.target.GetPropertyType(), MessageType.Error);
                    }
                }
                else if (!PropertyReference.Convert(pb.target.Get(), pb.source.GetPropertyType()))
                {
                    EditorGUILayout.HelpBox("Unable to convert " + pb.target.GetPropertyType() + " to " + pb.source.GetPropertyType(), MessageType.Error);
                }
            }
        }
        serializedObject.ApplyModifiedProperties();
    }
Esempio n. 31
0
 public static PropertyInfo ResolveReflection(this PropertyReference mref)
 => _ResolveReflection(mref, null) as PropertyInfo;
Esempio n. 32
0
        public PropertyReferenceProperty CreateProperty(string propertyPath, AttributeCollection attributes)
        {
            if (this.activeObjectSet == null || this.activePropertyCache == null)
            {
                return((PropertyReferenceProperty)null);
            }
            if (this.platformSupportsCompositeTransform && this.TransformType.Equals((object)TransformType.Transform2D))
            {
                string str = string.Empty;
                propertyPath = !TransformPropertyLookup.TranformGroupPathToCompositePathMap.TryGetValue(propertyPath, out str) ? "CompositeTransform." + propertyPath : str;
            }
            else if (this.Relative)
            {
                switch (this.TransformType)
                {
                case TransformType.Transform2D:
                    propertyPath = "CanonicalTransform." + propertyPath;
                    break;

                case TransformType.Transform3D:
                    propertyPath = "CanonicalTransform3D." + propertyPath;
                    break;
                }
            }
            else
            {
                switch (this.TransformType)
                {
                case TransformType.Transform2D:
                    if (propertyPath.Equals("CenterX") || propertyPath.Equals("CenterY"))
                    {
                        return((PropertyReferenceProperty)this.BuildCenterTransformPropertyReference(propertyPath, attributes));
                    }
                    propertyPath = this.BuildExpandedPropertyPath2D(propertyPath);
                    break;

                case TransformType.Transform3D:
                    propertyPath = this.BuildExpandedPropertyPath3D(propertyPath);
                    break;
                }
            }
            PropertyReferenceProperty referenceProperty = (PropertyReferenceProperty)null;

            if (this.activePropertyCache.TryGetValue(propertyPath, out referenceProperty))
            {
                return(referenceProperty);
            }
            PropertyReference propertyReference = (PropertyReference)null;

            try
            {
                propertyReference = new PropertyReference((ITypeResolver)this.sceneNodeObjectSet.ProjectContext, propertyPath);
            }
            catch (Exception ex)
            {
            }
            if (propertyReference != null)
            {
                if (!this.relative)
                {
                    referenceProperty = (PropertyReferenceProperty) new TransformSceneNodeProperty((SceneNodeObjectSet)this.activeObjectSet, this.transformProperty.Reference.Append(propertyReference), attributes);
                    referenceProperty.Recache();
                }
                else
                {
                    referenceProperty = this.activeObjectSet.CreateProperty(propertyReference, attributes);
                }
            }
            if (referenceProperty != null)
            {
                this.activePropertyCache[propertyPath] = referenceProperty;
            }
            return(referenceProperty);
        }
 ///--------------------------------------------------------------------------------
 /// <summary>Interpret this node to produce code, output, or model data..</summary>
 ///
 /// <param name="interpreterType">The type of interpretation to perform.</param>
 /// <param name="solutionContext">The associated solution.</param>
 /// <param name="templateContext">The associated template.</param>
 /// <param name="modelContext">The associated model context.</param>
 ///--------------------------------------------------------------------------------
 public void InterpretNode(InterpreterTypeCode interpreterType, Solution solutionContext, ITemplate templateContext, IDomainEnterpriseObject modelContext)
 {
     try
     {
         if (CurrentItem != null)
         {
             if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentAuditProperty))
             {
                 if (solutionContext.CurrentAuditProperty != null)
                 {
                     AuditProperty.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- AuditProperty: ").Append(solutionContext.CurrentAuditProperty.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentCollection))
             {
                 if (solutionContext.CurrentCollection != null)
                 {
                     Collection.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- Collection: ").Append(solutionContext.CurrentCollection.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentEntity))
             {
                 if (solutionContext.CurrentEntity != null)
                 {
                     Entity.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- Entity: ").Append(solutionContext.CurrentEntity.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentEntityReference))
             {
                 if (solutionContext.CurrentEntityReference != null)
                 {
                     EntityReference.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- EntityReference: ").Append(solutionContext.CurrentEntityReference.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentEnumeration))
             {
                 if (solutionContext.CurrentEnumeration != null)
                 {
                     Enumeration.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- Enumeration: ").Append(solutionContext.CurrentEnumeration.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentFeature))
             {
                 if (solutionContext.CurrentFeature != null)
                 {
                     Feature.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- Feature: ").Append(solutionContext.CurrentFeature.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentIndex))
             {
                 if (solutionContext.CurrentIndex != null)
                 {
                     Index.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- Index: ").Append(solutionContext.CurrentIndex.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentIndexProperty))
             {
                 if (solutionContext.CurrentIndexProperty != null)
                 {
                     IndexProperty.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- IndexProperty: ").Append(solutionContext.CurrentIndexProperty.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentMethod))
             {
                 if (solutionContext.CurrentMethod != null)
                 {
                     Method.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- Method: ").Append(solutionContext.CurrentMethod.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentMethodRelationship))
             {
                 if (solutionContext.CurrentMethodRelationship != null)
                 {
                     MethodRelationship.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- MethodRelationship: ").Append(solutionContext.CurrentMethodRelationship.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentModel))
             {
                 if (solutionContext.CurrentModel != null)
                 {
                     Model.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- Model: ").Append(solutionContext.CurrentModel.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentModelObject))
             {
                 if (solutionContext.CurrentModelObject != null)
                 {
                     ModelObject.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- ModelObject: ").Append(solutionContext.CurrentModelObject.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentModelProperty))
             {
                 if (solutionContext.CurrentModelProperty != null)
                 {
                     ModelProperty.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- ModelProperty: ").Append(solutionContext.CurrentModelProperty.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentObjectInstance))
             {
                 if (solutionContext.CurrentObjectInstance != null)
                 {
                     ObjectInstance.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- ObjectInstance: ").Append(solutionContext.CurrentObjectInstance.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentParameter))
             {
                 if (solutionContext.CurrentParameter != null)
                 {
                     Parameter.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- Parameter: ").Append(solutionContext.CurrentParameter.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentProject))
             {
                 if (solutionContext.CurrentProject != null)
                 {
                     Project.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- Project: ").Append(solutionContext.CurrentProject.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentProperty))
             {
                 if (solutionContext.CurrentProperty != null)
                 {
                     Property.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- Property: ").Append(solutionContext.CurrentProperty.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentPropertyInstance))
             {
                 if (solutionContext.CurrentPropertyInstance != null)
                 {
                     PropertyInstance.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- PropertyInstance: ").Append(solutionContext.CurrentPropertyInstance.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentPropertyReference))
             {
                 if (solutionContext.CurrentPropertyReference != null)
                 {
                     PropertyReference.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- PropertyReference: ").Append(solutionContext.CurrentPropertyReference.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentPropertyRelationship))
             {
                 if (solutionContext.CurrentPropertyRelationship != null)
                 {
                     PropertyRelationship.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- PropertyRelationship: ").Append(solutionContext.CurrentPropertyRelationship.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentRelationship))
             {
                 if (solutionContext.CurrentRelationship != null)
                 {
                     Relationship.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- Relationship: ").Append(solutionContext.CurrentRelationship.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentRelationshipProperty))
             {
                 if (solutionContext.CurrentRelationshipProperty != null)
                 {
                     RelationshipProperty.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- RelationshipProperty: ").Append(solutionContext.CurrentRelationshipProperty.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentStage))
             {
                 if (solutionContext.CurrentStage != null)
                 {
                     Stage.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- Stage: ").Append(solutionContext.CurrentStage.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentStageTransition))
             {
                 if (solutionContext.CurrentStageTransition != null)
                 {
                     StageTransition.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- StageTransition: ").Append(solutionContext.CurrentStageTransition.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentState))
             {
                 if (solutionContext.CurrentState != null)
                 {
                     State.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- State: ").Append(solutionContext.CurrentState.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentStateModel))
             {
                 if (solutionContext.CurrentStateModel != null)
                 {
                     StateModel.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- StateModel: ").Append(solutionContext.CurrentStateModel.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentStateTransition))
             {
                 if (solutionContext.CurrentStateTransition != null)
                 {
                     StateTransition.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- StateTransition: ").Append(solutionContext.CurrentStateTransition.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentStep))
             {
                 if (solutionContext.CurrentStep != null)
                 {
                     Step.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- Step: ").Append(solutionContext.CurrentStep.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentStepTransition))
             {
                 if (solutionContext.CurrentStepTransition != null)
                 {
                     StepTransition.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- StepTransition: ").Append(solutionContext.CurrentStepTransition.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentValue))
             {
                 if (solutionContext.CurrentValue != null)
                 {
                     Value.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- Value: ").Append(solutionContext.CurrentValue.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentView))
             {
                 if (solutionContext.CurrentView != null)
                 {
                     View.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- View: ").Append(solutionContext.CurrentView.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentViewProperty))
             {
                 if (solutionContext.CurrentViewProperty != null)
                 {
                     ViewProperty.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- ViewProperty: ").Append(solutionContext.CurrentViewProperty.InnerXmlData);
                     }
                 }
             }
             else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentWorkflow))
             {
                 if (solutionContext.CurrentWorkflow != null)
                 {
                     Workflow.DeleteCurrentItemFromSolution(solutionContext);
                     if (solutionContext.IsSampleMode == true)
                     {
                         templateContext.MessageBuilder.Append("\r\n- Workflow: ").Append(solutionContext.CurrentWorkflow.InnerXmlData);
                     }
                 }
             }
             #region protected
             #endregion protected
             else
             {
                 LogException(solutionContext, templateContext, modelContext, String.Format(DisplayValues.Exception_CouldNotDeleteItem, CurrentItem.CurrentItemName), interpreterType);
             }
         }
     }
     catch (ApplicationAbortException)
     {
         throw;
     }
     catch (System.Exception ex)
     {
         LogException(solutionContext, templateContext, modelContext, ex, interpreterType);
     }
 }
Esempio n. 34
0
    public static bool Convert(Type from, Type to)
    {
        object obj = null;

        return(PropertyReference.Convert(ref obj, from, to));
    }
Esempio n. 35
0
 public HavingClause(PropertyReference prop, Comparison comp, object literal)
     : base(prop, comp, literal)
 {
 }
Esempio n. 36
0
    /// <summary>
    /// Collect a list of usable properties and fields.
    /// </summary>

    static public List <Entry> GetProperties(GameObject target, bool read, bool write)
    {
        Component[] comps = target.GetComponents <Component>();

        List <Entry> list = new List <Entry>();

        for (int i = 0, imax = comps.Length; i < imax; ++i)
        {
            Component comp = comps[i];
            if (comp == null)
            {
                continue;
            }

            Type           type   = comp.GetType();
            BindingFlags   flags  = BindingFlags.Instance | BindingFlags.Public;
            FieldInfo[]    fields = type.GetFields(flags);
            PropertyInfo[] props  = type.GetProperties(flags);

            // The component itself without any method
            if (PropertyReference.Convert(comp, filter))
            {
                Entry ent = new Entry();
                ent.target = comp;
                list.Add(ent);
            }

            for (int b = 0; b < fields.Length; ++b)
            {
                FieldInfo field = fields[b];

                if (filter != typeof(void))
                {
                    if (canConvert)
                    {
                        if (!PropertyReference.Convert(field.FieldType, filter))
                        {
                            continue;
                        }
                    }
                    else if (!filter.IsAssignableFrom(field.FieldType))
                    {
                        continue;
                    }
                }

                Entry ent = new Entry();
                ent.target = comp;
                ent.name   = field.Name;
                list.Add(ent);
            }

            for (int b = 0; b < props.Length; ++b)
            {
                PropertyInfo prop = props[b];
                if (read && !prop.CanRead)
                {
                    continue;
                }
                if (write && !prop.CanWrite)
                {
                    continue;
                }

                if (filter != typeof(void))
                {
                    if (canConvert)
                    {
                        if (!PropertyReference.Convert(prop.PropertyType, filter))
                        {
                            continue;
                        }
                    }
                    else if (!filter.IsAssignableFrom(prop.PropertyType))
                    {
                        continue;
                    }
                }

                Entry ent = new Entry();
                ent.target = comp;
                ent.name   = prop.Name;
                list.Add(ent);
            }
        }
        return(list);
    }
Esempio n. 37
0
 public DataContextProperty(DocumentCompositeNode sourceNode, IProperty property, bool isCollectionItem, PropertyReference ancestorPath)
 {
     this.SourceNode       = sourceNode;
     this.Property         = property;
     this.IsCollectionItem = isCollectionItem;
     this.AncestorPath     = ancestorPath;
     this.IsValid          = true;
 }
Esempio n. 38
0
        private static void TransferPathFigureAnimations(PathElement oldElement, PathElement newElement, PropertyReference pathProperty, int oldFigureIndex, int newFigureIndex, Transform transform)
        {
            PathAnimationMovePackage animationMove = new PathAnimationMovePackage();

            PathCommandHelper.TransferPathFigureAnimations(oldElement, newElement, pathProperty, oldFigureIndex, newFigureIndex, transform, animationMove);
            animationMove.AddAndRemove();
        }
Esempio n. 39
0
 public WhereClause(BooleanOperand boolOp, PropertyReference prop, Comparison comp, object literal)
     : base(prop, comp, literal)
 {
     BooleanOperand = boolOp;
 }