public CreateMySprite(StockSpriteType Type, SolutionProjectLanguageField sprite)
            {
                var page_Page1 =
                    new PseudoCallExpression
                {
                    // Application(page)
                    Object = "page",

                    Method =
                        new SolutionProjectLanguageMethod
                    {
                        IsProperty = true,
                        Name       = "get_Content",
                        ReturnType = new SolutionProjectLanguageType
                        {
                            Name = "IHTMLElement"
                        }
                    }
                };

                //var new_Page1 =
                //    new PseudoCallExpression
                //    {
                //        // Application(page)

                //        Method =
                //            new SolutionProjectLanguageMethod
                //            {
                //                Name = SolutionProjectLanguageMethod.ConstructorName,
                //                DeclaringType = new SolutionProjectLanguageType
                //                {
                //                    Namespace = Type.Namespace,
                //                    Name = Type.Name
                //                }
                //            }
                //    };

                this.Comment = "Initialize " + Type.Name;

                this.Method = new KnownStockTypes.ScriptCoreLib.JavaScript.Extensions.SpriteExtensions.AttachSpriteTo();

                this.ParameterExpressions = new object[]
                {
                    sprite,
                    page_Page1
                };
            }
Ejemplo n.º 2
0
        public static SolutionBuilder WithCanvasAdobeFlash(this SolutionBuilder sln)
        {
            var content = default(SolutionProjectLanguageField);
            var sprite  = default(SolutionProjectLanguageField);

            InternalWithCanvas(sln, value => content = value);

            sln.Interactive.GenerateTypes +=
                AddType =>
            {
                var ApplicationSprite = new StockSpriteType(sln.Name, "ApplicationSprite", content);


                ApplicationSprite.DependentUpon = content.FieldType;


                content.DeclaringType = ApplicationSprite;

                sprite = ApplicationSprite.ToInitializedField("sprite");

                sprite.DeclaringType = sln.Interactive.ApplicationType;

                AddType(ApplicationSprite);
            };


            sln.Interactive.GenerateApplicationExpressions +=
                AddCode =>
            {
                var page_get_Content =
                    new PseudoCallExpression
                {
                    // Application(page)
                    Object = "page",

                    Method =
                        new SolutionProjectLanguageMethod
                    {
                        IsProperty = true,
                        Name       = "get_Content",
                        ReturnType = new KnownStockTypes.ScriptCoreLib.JavaScript.DOM.HTML.IHTMLElement()
                    }
                };

                var page_get_ContentSize =
                    new PseudoCallExpression
                {
                    // Application(page)
                    Object = "page",

                    Method =
                        new SolutionProjectLanguageMethod
                    {
                        IsProperty = true,
                        Name       = "get_ContentSize",
                        ReturnType = new KnownStockTypes.ScriptCoreLib.JavaScript.DOM.HTML.IHTMLElement()
                    }
                };

                AddCode(
                    new KnownStockTypes.ScriptCoreLib.JavaScript.Extensions.SpriteExtensions.AutoSizeSpriteTo().ToCallExpression(
                        sprite,
                        page_get_ContentSize
                        )
                    );

                AddCode(
                    new KnownStockTypes.ScriptCoreLib.JavaScript.Extensions.SpriteExtensions.AttachSpriteTo().ToCallExpression(
                        sprite,
                        page_get_Content
                        )
                    );
            };

            return(sln);
        }