Esempio n. 1
0
        public void MapDrawableToPrintableProperty()
        {
            IProperty drawable = new DrawableProperty(
                new TestSubscription()
            {
                Value = "Drawable value"
            },
                new PropertyTemplate("Name", new Point(0, 0), "red")
                );
            IProperty printable = (drawable as DrawableProperty).MapToPrintable();

            Assert.True(printable is PrintableProperty);
            Assert.Equal(drawable.Template.Name, printable.Template.Name);
            Assert.Equal(drawable.Subscription, printable.Subscription);
            Assert.Equal(drawable.Template.HexColor, printable.Template.HexColor);
            Assert.Null(printable.Template.Location);
        }
        public static AssignmentExpressionSyntax GenerateInitializerSyntax(this DrawableProperty prop)
        {
            if (prop is EmbeddedDrawableProperty embedded)
            {
                return(embedded.GenerateInitializerSyntax());
            }

            if (prop is LocalBoundDrawableProperty localBound)
            {
                return(localBound.GenerateInitializerSyntax());
            }

            if (prop is ConfigBoundDrawableProperty configBound)
            {
                return(configBound.GenerateInitializerSyntax());
            }

            return(null);
        }
 set => SetValue(DrawableProperty, value);