public StockSpriteType(string Namespace, string Name, SolutionProjectLanguageField Content = null)
		{
			this.Namespace = Namespace;
			this.Name = Name;

			this.BaseType = new KnownStockTypes.ScriptCoreLib.ActionScript.flash.display.Sprite();

			this.IsSealed = true;
            //this.IsInternal = true;

            this.Constructor = GetDefaultConstructorDefinition();
            this.Constructor.Code = new SolutionProjectLanguageCode
            {

            };

            this.UsingNamespaces.Add("ScriptCoreLib.Extensions");
            this.UsingNamespaces.Add("ScriptCoreLib.ActionScript.Extensions");


            

            if (Content != null)
            {

                var AttachToContainer =
                      new KnownStockTypes.ScriptCoreLib.ActionScript.Extensions.AvalonExtensions.AttachToContainer().ToCallExpression(
                          Content,
                          new PseudoThisExpression()
                      );

                var get_stage = new KnownStockTypes.ScriptCoreLib.ActionScript.flash.display.DisplayObject.get_stage().ToCallExpression(
                    new PseudoThisExpression()
                );

                var AutoSizeTo =
                     new KnownStockTypes.ScriptCoreLib.ActionScript.Extensions.ActionScriptAvalonExtensions.AutoSizeTo().ToCallExpression(
                        Content,
                        get_stage
                    );

                var handler = new SolutionProjectLanguageMethod
                {
                    Code = new SolutionProjectLanguageCode
                    {
                        AttachToContainer,
                        AutoSizeTo
                    }
                };

                this.Constructor.Code.Add(
                     new KnownStockTypes.ScriptCoreLib.ActionScript.Extensions.CommonExtensions.InvokeWhenStageIsReady().ToCallExpression(
                        new PseudoThisExpression(),
                        handler
                    )
                );
            }

            this.Methods.Add(this.Constructor);
		}
        private static void InitializeConstructorCode(SolutionProjectLanguageMethod ctor, SolutionProjectLanguageField r)
        {
            // jsc has a bug with nested params in stack...

            var Brushes_Red = 
                new KnownStockTypes.System.Windows.Media.Brushes.get_Red().ToCallExpression();

            var r_set_Fill_to_Brushes_Red =
                new KnownStockTypes.System.Windows.Shapes.Rectangle.set_Fill().ToCallExpression(r,
                    Brushes_Red
                );

            var r_AttachTo_this =
                new KnownStockTypes.ScriptCoreLib.Shared.Avalon.Extensions.SupportsContainerExtensions.AttachTo().ToCallExpression(
                    r,
                    new PseudoThisExpression()
                );

            var r_MoveTo_8_8 =
                 new KnownStockTypes.ScriptCoreLib.Shared.Avalon.Extensions.SupportsContainerExtensions.MoveTo().ToCallExpression(
                    r,
                    (PseudoInt32ConstantExpression)8,
                    (PseudoInt32ConstantExpression)8
                );

            var this_get_Height_sub_16 =
                new KnownStockTypes.System.Windows.FrameworkElement.get_Height().ToCallExpression(new PseudoThisExpression()) - 16.0;

            var this_get_Width_sub_16 =
                new KnownStockTypes.System.Windows.FrameworkElement.get_Width().ToCallExpression(new PseudoThisExpression()) - 16.0;


            var r_SizeTo_16_16 =
                  new KnownStockTypes.ScriptCoreLib.Shared.Avalon.Extensions.SupportsContainerExtensions.SizeTo().ToCallExpression(
                     r,
                     this_get_Width_sub_16,
                     this_get_Height_sub_16
                 );


            var this_add_SizeChanged_handler = r_SizeTo_16_16.ToAnonymousMethod();

            this_add_SizeChanged_handler.Parameters.Add("s");
            this_add_SizeChanged_handler.Parameters.Add("e");

            var this_add_SizeChanged =
                new KnownStockTypes.System.Windows.FrameworkElement.add_SizeChanged().ToCallExpression(
                    new PseudoThisExpression(),
                    this_add_SizeChanged_handler
                );

            ctor.Code = new SolutionProjectLanguageCode
            {
                r_set_Fill_to_Brushes_Red,
                r_AttachTo_this,
                r_MoveTo_8_8,
                this_add_SizeChanged
            };
        }
        public StockApplicationWebServiceType(SolutionBuilderInteractive Interactive)
        {
            // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2014/201406/20140602

            // we can now use it as a base type for our client side apps
            //this.IsSealed = true;

            // Cassini will not be able to support debugging if WebService is made internal?
            //this.IsInternal = true;

            // will this help us?
            //this.IsPartial = true;

            this.Name    = "ApplicationWebService";
            this.Summary = "Methods defined in this type can be used from JavaScript. The method calls will seamlessly be proxied to the server.";

            this.UsingNamespaces.Add("System");
            this.UsingNamespaces.Add("System.Linq");
            this.UsingNamespaces.Add("System.Xml.Linq");
            this.UsingNamespaces.Add("System.Collections.Generic");
            this.UsingNamespaces.Add("System.Threading.Tasks");
            this.UsingNamespaces.Add("System.Text");
            this.UsingNamespaces.Add("System.Data");
            this.UsingNamespaces.Add("System.Diagnostics");
            this.UsingNamespaces.Add("System.Runtime.CompilerServices");

            this.UsingNamespaces.Add("ScriptCoreLib");
            this.UsingNamespaces.Add("ScriptCoreLib.Extensions");
            this.UsingNamespaces.Add("ScriptCoreLib.Delegates");


            //  <h1 id='Header'>JSC - The .NET crosscompiler for web platforms.</h1>
            var HeaderField = new SolutionProjectLanguageField {
                Name = "Header", FieldType = new StockTypes.KnownStockTypes.System.Xml.Linq.XElement()
            };

            // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2014/201406/20140602
            HeaderField.Summary          = "The static content defined in the HTML file will be update to the dynamic content once application is running.";
            HeaderField.FieldConstructor =
                new PseudoCallExpression
            {
                Method = new StockTypes.KnownStockTypes.System.Xml.Linq.XElement().GetDefaultConstructorDefinition(),
                ParameterExpressions = new object[] {
                    new PseudoStringConstantExpression {
                        Value = "h1"
                    },
                    new PseudoStringConstantExpression {
                        Value = "JSC - The .NET crosscompiler for web platforms. ready."
                    }
                }
            };

            this.Fields.Add(HeaderField);

            this.WebMethod2 = new StockMethodWebMethod(Interactive);

            this.Methods.Add(WebMethod2);
        }
        public StockSpriteType(string Namespace, string Name, SolutionProjectLanguageField Content = null)
        {
            this.Namespace = Namespace;
            this.Name      = Name;

            this.BaseType = new KnownStockTypes.ScriptCoreLib.ActionScript.flash.display.Sprite();

            this.IsSealed = true;
            //this.IsInternal = true;

            this.Constructor      = GetDefaultConstructorDefinition();
            this.Constructor.Code = new SolutionProjectLanguageCode
            {
            };

            this.UsingNamespaces.Add("ScriptCoreLib.Extensions");
            this.UsingNamespaces.Add("ScriptCoreLib.ActionScript.Extensions");



            if (Content != null)
            {
                var AttachToContainer =
                    new KnownStockTypes.ScriptCoreLib.ActionScript.Extensions.AvalonExtensions.AttachToContainer().ToCallExpression(
                        Content,
                        new PseudoThisExpression()
                        );

                var get_stage = new KnownStockTypes.ScriptCoreLib.ActionScript.flash.display.DisplayObject.get_stage().ToCallExpression(
                    new PseudoThisExpression()
                    );

                var AutoSizeTo =
                    new KnownStockTypes.ScriptCoreLib.ActionScript.Extensions.ActionScriptAvalonExtensions.AutoSizeTo().ToCallExpression(
                        Content,
                        get_stage
                        );

                var handler = new SolutionProjectLanguageMethod
                {
                    Code = new SolutionProjectLanguageCode
                    {
                        AttachToContainer,
                        AutoSizeTo
                    }
                };

                this.Constructor.Code.Add(
                    new KnownStockTypes.ScriptCoreLib.ActionScript.Extensions.CommonExtensions.InvokeWhenStageIsReady().ToCallExpression(
                        new PseudoThisExpression(),
                        handler
                        )
                    );
            }

            this.Methods.Add(this.Constructor);
        }
        public StockAppletType(string Namespace, string Name, SolutionProjectLanguageField Content = null)
		{
			this.Namespace = Namespace;
			this.Name = Name;

			this.BaseType = new KnownStockTypes.java.applet.Applet();

			this.IsSealed = true;
            //this.IsInternal = true;

			this.init = new SolutionProjectLanguageMethod
			{
				DeclaringType = this,
				Name = "init",
				IsOverride = true,
				Code = new SolutionProjectLanguageCode
				{
					new PseudoCallExpression
					{
						Object = new PseudoBaseExpression(),
						Method = new SolutionProjectLanguageMethod
						{
							DeclaringType = BaseType,
							Name = "resize",
						},
						ParameterExpressions = new []
						{
							(PseudoInt32ConstantExpression)400,
							(PseudoInt32ConstantExpression)300,
						}
					}
				}
			};

            this.Methods.Add(init);

            if (Content != null)
            {
                this.init.Code = new SolutionProjectLanguageCode
                {
                    new KnownStockTypes.ScriptCoreLib.Java.Extensions.WindowsFormsExtensions.AttachTo().ToCallExpression(
                        Content,
                        new PseudoThisExpression()
                    ),
                     new KnownStockTypes.ScriptCoreLib.Java.Extensions.WindowsFormsExtensions.AutoSizeTo().ToCallExpression(
                        Content,
                        new PseudoThisExpression()
                    ),

                    new KnownStockTypes.ScriptCoreLib.Java.Extensions.WindowsFormsExtensions.EnableVisualStyles().ToCallExpression(
                        new PseudoThisExpression()
                    )
                };
            }

		}
        public StockAppletType(string Namespace, string Name, SolutionProjectLanguageField Content = null)
        {
            this.Namespace = Namespace;
            this.Name      = Name;

            this.BaseType = new KnownStockTypes.java.applet.Applet();

            this.IsSealed = true;
            //this.IsInternal = true;

            this.init = new SolutionProjectLanguageMethod
            {
                DeclaringType = this,
                Name          = "init",
                IsOverride    = true,
                Code          = new SolutionProjectLanguageCode
                {
                    new PseudoCallExpression
                    {
                        Object = new PseudoBaseExpression(),
                        Method = new SolutionProjectLanguageMethod
                        {
                            DeclaringType = BaseType,
                            Name          = "resize",
                        },
                        ParameterExpressions = new []
                        {
                            (PseudoInt32ConstantExpression)400,
                            (PseudoInt32ConstantExpression)300,
                        }
                    }
                }
            };

            this.Methods.Add(init);

            if (Content != null)
            {
                this.init.Code = new SolutionProjectLanguageCode
                {
                    new KnownStockTypes.ScriptCoreLib.Java.Extensions.WindowsFormsExtensions.AttachTo().ToCallExpression(
                        Content,
                        new PseudoThisExpression()
                        ),
                    new KnownStockTypes.ScriptCoreLib.Java.Extensions.WindowsFormsExtensions.AutoSizeTo().ToCallExpression(
                        Content,
                        new PseudoThisExpression()
                        ),

                    new KnownStockTypes.ScriptCoreLib.Java.Extensions.WindowsFormsExtensions.EnableVisualStyles().ToCallExpression(
                        new PseudoThisExpression()
                        )
                };
            }
        }
        public StockApplicationWebServiceType(SolutionBuilderInteractive Interactive)
        {
            // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2014/201406/20140602

            // we can now use it as a base type for our client side apps
            //this.IsSealed = true;

            // Cassini will not be able to support debugging if WebService is made internal?
            //this.IsInternal = true;

            // will this help us?
            //this.IsPartial = true;

            this.Name = "ApplicationWebService";
            this.Summary = "Methods defined in this type can be used from JavaScript. The method calls will seamlessly be proxied to the server.";

            this.UsingNamespaces.Add("System");
            this.UsingNamespaces.Add("System.Linq");
            this.UsingNamespaces.Add("System.Xml.Linq");
            this.UsingNamespaces.Add("System.Collections.Generic");
            this.UsingNamespaces.Add("System.Threading.Tasks");
            this.UsingNamespaces.Add("System.Text");
            this.UsingNamespaces.Add("System.Data");
            this.UsingNamespaces.Add("System.Diagnostics");
            this.UsingNamespaces.Add("System.Runtime.CompilerServices");

            this.UsingNamespaces.Add("ScriptCoreLib");
            this.UsingNamespaces.Add("ScriptCoreLib.Extensions");
            this.UsingNamespaces.Add("ScriptCoreLib.Delegates");


            //  <h1 id='Header'>JSC - The .NET crosscompiler for web platforms.</h1>
            var HeaderField = new SolutionProjectLanguageField { Name = "Header", FieldType = new StockTypes.KnownStockTypes.System.Xml.Linq.XElement() };

            // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2014/201406/20140602
            HeaderField.Summary = "The static content defined in the HTML file will be update to the dynamic content once application is running.";
            HeaderField.FieldConstructor =
                new PseudoCallExpression
                   {

                       Method = new StockTypes.KnownStockTypes.System.Xml.Linq.XElement().GetDefaultConstructorDefinition(),
                       ParameterExpressions = new object[] {
                        new PseudoStringConstantExpression { Value = "h1"},
                        new PseudoStringConstantExpression { Value = "JSC - The .NET crosscompiler for web platforms. ready."}
                       }
                   };

            this.Fields.Add(HeaderField);

            this.WebMethod2 = new StockMethodWebMethod(Interactive);

            this.Methods.Add(WebMethod2);
        }
        public StockMethodInitializeCamera(SolutionProjectLanguageField video)
        {
            var camera = new SolutionProjectLanguageArgument
            {
                Name = "camera",
                Type = new KnownStockTypes.ScriptCoreLib.ActionScript.flash.media.Camera()
            };

            this.Parameters.Add(camera);



            var camera_setMode =new KnownStockTypes.ScriptCoreLib.ActionScript.flash.media.Camera.setMode().ToCallExpression(
                  camera,
                        (PseudoInt32ConstantExpression)ScriptApplicationEntryPointAttribute.DefaultWidth,
                        (PseudoInt32ConstantExpression)ScriptApplicationEntryPointAttribute.DefaultHeight,
                (PseudoInt32ConstantExpression)(1000 / 24)
            );

            var video_attachCamera = new KnownStockTypes.ScriptCoreLib.ActionScript.flash.media.Video.attachCamera().ToCallExpression(
                video,
                camera
            );

         


            var AttachTo = new SolutionProjectLanguageMethod
            {
                IsStatic = true,
                IsExtensionMethod = true,
                Name = "AttachTo",
                DeclaringType = new KnownStockTypes.ScriptCoreLib.ActionScript.Extensions.CommonExtensions()
            };

            var video_AttachTo_this =
                new PseudoCallExpression
                {
                    Method = AttachTo,
                    ParameterExpressions = new object[]
                    {
                        video,
                        new PseudoThisExpression()
                    }
                };

            this.Code = new SolutionProjectLanguageCode
            {
                camera_setMode,
                video_attachCamera,
                video_AttachTo_this
            };
        }
        public StockMethodInitializeCamera(SolutionProjectLanguageField video)
        {
            var camera = new SolutionProjectLanguageArgument
            {
                Name = "camera",
                Type = new KnownStockTypes.ScriptCoreLib.ActionScript.flash.media.Camera()
            };

            this.Parameters.Add(camera);



            var camera_setMode = new KnownStockTypes.ScriptCoreLib.ActionScript.flash.media.Camera.setMode().ToCallExpression(
                camera,
                (PseudoInt32ConstantExpression)ScriptApplicationEntryPointAttribute.DefaultWidth,
                (PseudoInt32ConstantExpression)ScriptApplicationEntryPointAttribute.DefaultHeight,
                (PseudoInt32ConstantExpression)(1000 / 24)
                );

            var video_attachCamera = new KnownStockTypes.ScriptCoreLib.ActionScript.flash.media.Video.attachCamera().ToCallExpression(
                video,
                camera
                );



            var AttachTo = new SolutionProjectLanguageMethod
            {
                IsStatic          = true,
                IsExtensionMethod = true,
                Name          = "AttachTo",
                DeclaringType = new KnownStockTypes.ScriptCoreLib.ActionScript.Extensions.CommonExtensions()
            };

            var video_AttachTo_this =
                new PseudoCallExpression
            {
                Method = AttachTo,
                ParameterExpressions = new object[]
                {
                    video,
                    new PseudoThisExpression()
                }
            };

            this.Code = new SolutionProjectLanguageCode
            {
                camera_setMode,
                video_attachCamera,
                video_AttachTo_this
            };
        }
        public StockCanvasType(string Namespace, string Name)
        {
            this.Namespace = Namespace;
            this.Name = Name;

            this.BaseType = new KnownStockTypes.System.Windows.Controls.Canvas();

            
            // no need to be sealed
            this.IsSealed = false;

            this.UsingNamespaces.Add("System");
            this.UsingNamespaces.Add("System.Text");
            this.UsingNamespaces.Add("System.Linq");
            this.UsingNamespaces.Add("System.Xml");
            this.UsingNamespaces.Add("System.Xml.Linq");
            this.UsingNamespaces.Add("System.Windows.Media");
            this.UsingNamespaces.Add("System.Windows.Shapes");
            this.UsingNamespaces.Add("ScriptCoreLib.Extensions");
            this.UsingNamespaces.Add("ScriptCoreLib.Shared.Avalon.Extensions");

            // empty ctor
            var ctor = this.GetDefaultConstructorDefinition();

            var r = new SolutionProjectLanguageField
            {
                FieldType = new KnownStockTypes.System.Windows.Shapes.Rectangle(),
                FieldConstructor = new KnownStockTypes.System.Windows.Shapes.Rectangle().GetDefaultConstructor(),
                Name = "r",
                IsReadOnly = true
            };

            // we are adding a field. does it show up in the source code later?
            // SolutionProjectLanguage.WriteType makes it happen!
            this.Fields.Add(r);


            InitializeConstructorCode(ctor, r);

            this.Methods.Add(ctor);
        }
Beispiel #11
0
        public StockCanvasType(string Namespace, string Name)
        {
            this.Namespace = Namespace;
            this.Name      = Name;

            this.BaseType = new KnownStockTypes.System.Windows.Controls.Canvas();


            // no need to be sealed
            this.IsSealed = false;

            this.UsingNamespaces.Add("System");
            this.UsingNamespaces.Add("System.Text");
            this.UsingNamespaces.Add("System.Linq");
            this.UsingNamespaces.Add("System.Xml");
            this.UsingNamespaces.Add("System.Xml.Linq");
            this.UsingNamespaces.Add("System.Windows.Media");
            this.UsingNamespaces.Add("System.Windows.Shapes");
            this.UsingNamespaces.Add("ScriptCoreLib.Extensions");
            this.UsingNamespaces.Add("ScriptCoreLib.Shared.Avalon.Extensions");

            // empty ctor
            var ctor = this.GetDefaultConstructorDefinition();

            var r = new SolutionProjectLanguageField
            {
                FieldType        = new KnownStockTypes.System.Windows.Shapes.Rectangle(),
                FieldConstructor = new KnownStockTypes.System.Windows.Shapes.Rectangle().GetDefaultConstructor(),
                Name             = "r",
                IsReadOnly       = true
            };

            // we are adding a field. does it show up in the source code later?
            // SolutionProjectLanguage.WriteType makes it happen!
            this.Fields.Add(r);


            InitializeConstructorCode(ctor, r);

            this.Methods.Add(ctor);
        }
Beispiel #12
0
        public StockUserControlType(string Namespace, string Name)
        {
            var UserControl1DesignerType =
                new SolutionProjectLanguagePartialType
            {
                Name = Name + ".Designer",
                Type = new SolutionProjectLanguageType
                {
                    Namespace = Namespace,
                    Name      = Name,
                },
            };

            #region Dispose
            var disposing = new SolutionProjectLanguageArgument
            {
                Summary = "true if managed resources should be disposed; otherwise, false.",
                Name    = "disposing",
                Type    = new KnownStockTypes.System.Boolean(),
            };

            var Dispose = new SolutionProjectLanguageMethod
            {
                IsProtected   = true,
                IsOverride    = true,
                Summary       = "Clean up any resources being used.",
                Name          = "Dispose",
                DeclaringType = UserControl1DesignerType.Type,
                Code          = new SolutionProjectLanguageCode
                {
                    "Note: This jsc project does not support unmanaged resources.",
                    new PseudoCallExpression
                    {
                        Object = new PseudoBaseExpression(),
                        Method = new SolutionProjectLanguageMethod
                        {
                            Name = "Dispose",
                        },
                        ParameterExpressions = new[]
                        {
                            disposing
                        }
                    }
                }
            };

            Dispose.Parameters.Add(disposing);
            #endregion

            #region components
            var components =
                new SolutionProjectLanguageField
            {
                IsPrivate = true,
                Name      = "components",
                Summary   = "Required designer variable.",
                FieldType = new KnownStockTypes.System.ComponentModel.IContainer()
            };

            UserControl1DesignerType.Type.Fields.Add(components);
            #endregion



            #region set_Name
            var set_Name = new PseudoCallExpression
            {
                Object = new PseudoThisExpression(),
                Method = new SolutionProjectLanguageMethod
                {
                    IsProperty = true,
                    Name       = "set_Name",
                },
                ParameterExpressions = new[]
                {
                    new PseudoStringConstantExpression
                    {
                        Value = Name
                    }
                }
            };
            #endregion

            #region set_Size
            var set_Size = new PseudoCallExpression
            {
                Object = new PseudoThisExpression(),
                Method = new SolutionProjectLanguageMethod
                {
                    IsProperty = true,
                    Name       = "set_Size",
                },
                ParameterExpressions = new[]
                {
                    new PseudoCallExpression
                    {
                        Method = new SolutionProjectLanguageMethod
                        {
                            DeclaringType = new SolutionProjectLanguageType
                            {
                                Namespace = "System.Drawing",
                                Name      = "Size"
                            },
                            Name = SolutionProjectLanguageMethod.ConstructorName
                        },
                        ParameterExpressions = new []
                        {
                            (PseudoInt32ConstantExpression)400,
                            (PseudoInt32ConstantExpression)300,
                        }
                    }
                }
            };
            #endregion


            #region InitializeComponent
            var InitializeComponent =
                new SolutionProjectLanguageMethod
            {
                Summary = @"Required method for Designer support - do not modify
the contents of this method with the code editor.",

                IsPrivate     = true,
                DeclaringType = UserControl1DesignerType.Type,
                Name          = "InitializeComponent",
                Code          = new SolutionProjectLanguageCode
                {
                    set_Name,
                    set_Size
                }
            };

            UserControl1DesignerType.Type.Methods.Add(InitializeComponent);
            #endregion


            #region UserControl1Constructor
            var UserControl1Constructor =
                new SolutionProjectLanguageMethod
            {
                DeclaringType = UserControl1DesignerType.Type,
                Name          = SolutionProjectLanguageMethod.ConstructorName,
                Code          = new SolutionProjectLanguageCode
                {
                    new PseudoCallExpression
                    {
                        Object = new PseudoThisExpression(),
                        Method = InitializeComponent
                    }
                }
            };
            this.Methods.Add(UserControl1Constructor);
            #endregion

            this.Namespace = Namespace;
            this.Name      = Name;

            this.BaseType = new KnownStockTypes.System.Windows.Forms.UserControl();

            this.DependentPartialTypes = new[]
            {
                UserControl1DesignerType
            };



            UserControl1DesignerType.Type.UsingNamespaces.Add("System.ComponentModel");
            UserControl1DesignerType.Type.UsingNamespaces.Add("System.Windows.Forms");

            this.UsingNamespaces.Add("System.Collections.Generic");
            this.UsingNamespaces.Add("System.ComponentModel");
            this.UsingNamespaces.Add("System.Drawing");
            this.UsingNamespaces.Add("System.Linq");
            this.UsingNamespaces.Add("System.Text");
            this.UsingNamespaces.Add("System.Windows.Forms");



            UserControl1DesignerType.Type.Methods.Add(Dispose);
        }
Beispiel #13
0
        private static void InitializeConstructorCode(SolutionProjectLanguageMethod ctor, SolutionProjectLanguageField r)
        {
            // jsc has a bug with nested params in stack...

            var Brushes_Red =
                new KnownStockTypes.System.Windows.Media.Brushes.get_Red().ToCallExpression();

            var r_set_Fill_to_Brushes_Red =
                new KnownStockTypes.System.Windows.Shapes.Rectangle.set_Fill().ToCallExpression(r,
                                                                                                Brushes_Red
                                                                                                );

            var r_AttachTo_this =
                new KnownStockTypes.ScriptCoreLib.Shared.Avalon.Extensions.SupportsContainerExtensions.AttachTo().ToCallExpression(
                    r,
                    new PseudoThisExpression()
                    );

            var r_MoveTo_8_8 =
                new KnownStockTypes.ScriptCoreLib.Shared.Avalon.Extensions.SupportsContainerExtensions.MoveTo().ToCallExpression(
                    r,
                    (PseudoInt32ConstantExpression)8,
                    (PseudoInt32ConstantExpression)8
                    );

            var this_get_Height_sub_16 =
                new KnownStockTypes.System.Windows.FrameworkElement.get_Height().ToCallExpression(new PseudoThisExpression()) - 16.0;

            var this_get_Width_sub_16 =
                new KnownStockTypes.System.Windows.FrameworkElement.get_Width().ToCallExpression(new PseudoThisExpression()) - 16.0;


            var r_SizeTo_16_16 =
                new KnownStockTypes.ScriptCoreLib.Shared.Avalon.Extensions.SupportsContainerExtensions.SizeTo().ToCallExpression(
                    r,
                    this_get_Width_sub_16,
                    this_get_Height_sub_16
                    );


            var this_add_SizeChanged_handler = r_SizeTo_16_16.ToAnonymousMethod();

            this_add_SizeChanged_handler.Parameters.Add("s");
            this_add_SizeChanged_handler.Parameters.Add("e");

            var this_add_SizeChanged =
                new KnownStockTypes.System.Windows.FrameworkElement.add_SizeChanged().ToCallExpression(
                    new PseudoThisExpression(),
                    this_add_SizeChanged_handler
                    );

            ctor.Code = new SolutionProjectLanguageCode
            {
                r_set_Fill_to_Brushes_Red,
                r_AttachTo_this,
                r_MoveTo_8_8,
                this_add_SizeChanged
            };
        }
        public StockUserControlType(string Namespace, string Name)
        {
            var UserControl1DesignerType =
                new SolutionProjectLanguagePartialType
                {
                    Name = Name + ".Designer",
                    Type = new SolutionProjectLanguageType
                    {
                        Namespace = Namespace,
                        Name = Name,
                    },
                };

            #region Dispose
            var disposing = new SolutionProjectLanguageArgument
            {
                Summary = "true if managed resources should be disposed; otherwise, false.",
                Name = "disposing",
                Type = new KnownStockTypes.System.Boolean(),
            };

            var Dispose = new SolutionProjectLanguageMethod
            {
                IsProtected = true,
                IsOverride = true,
                Summary = "Clean up any resources being used.",
                Name = "Dispose",
                DeclaringType = UserControl1DesignerType.Type,
                Code = new SolutionProjectLanguageCode
				{
					"Note: This jsc project does not support unmanaged resources.",
					new PseudoCallExpression
					{
						Object = new PseudoBaseExpression(),
						Method = new SolutionProjectLanguageMethod
						{
							Name = "Dispose",
						},
						ParameterExpressions = new[]
						{
							disposing
						}
					}
				}
            };

            Dispose.Parameters.Add(disposing);
            #endregion

            #region components
            var components =
                new SolutionProjectLanguageField
                {
                    IsPrivate = true,
                    Name = "components",
                    Summary = "Required designer variable.",
                    FieldType = new KnownStockTypes.System.ComponentModel.IContainer()
                };

            UserControl1DesignerType.Type.Fields.Add(components);
            #endregion



            #region set_Name
            var set_Name = new PseudoCallExpression
            {
                Object = new PseudoThisExpression(),
                Method = new SolutionProjectLanguageMethod
                {
                    IsProperty = true,
                    Name = "set_Name",
                },
                ParameterExpressions = new[]
				{
					new PseudoStringConstantExpression
					{
						Value = Name
					}
				}
            };
            #endregion

            #region set_Size
            var set_Size = new PseudoCallExpression
            {
                Object = new PseudoThisExpression(),
                Method = new SolutionProjectLanguageMethod
                {
                    IsProperty = true,
                    Name = "set_Size",
                },
                ParameterExpressions = new[]
				{
					new PseudoCallExpression
					{
						Method = new SolutionProjectLanguageMethod
						{
							DeclaringType = new SolutionProjectLanguageType
							{
								Namespace = "System.Drawing",
								Name = "Size"
							},
							Name = SolutionProjectLanguageMethod.ConstructorName
						},
						ParameterExpressions = new []
						{
							(PseudoInt32ConstantExpression) 400,
							(PseudoInt32ConstantExpression) 300,
						}
					}
				}
            };
            #endregion


            #region InitializeComponent
            var InitializeComponent =
                new SolutionProjectLanguageMethod
                {
                    Summary = @"Required method for Designer support - do not modify
the contents of this method with the code editor.",

                    IsPrivate = true,
                    DeclaringType = UserControl1DesignerType.Type,
                    Name = "InitializeComponent",
                    Code = new SolutionProjectLanguageCode
					{
						set_Name,
						set_Size
					}
                };

            UserControl1DesignerType.Type.Methods.Add(InitializeComponent);
            #endregion


            #region UserControl1Constructor
            var UserControl1Constructor =
                new SolutionProjectLanguageMethod
                {
                    DeclaringType = UserControl1DesignerType.Type,
                    Name = SolutionProjectLanguageMethod.ConstructorName,
                    Code = new SolutionProjectLanguageCode
					{
						new PseudoCallExpression
						{
							Object = new PseudoThisExpression(),
							Method = InitializeComponent
						}
					}
                };
            this.Methods.Add(UserControl1Constructor);
            #endregion

            this.Namespace = Namespace;
            this.Name = Name;

            this.BaseType = new KnownStockTypes.System.Windows.Forms.UserControl();

            this.DependentPartialTypes = new[]
				{
					UserControl1DesignerType
				};



            UserControl1DesignerType.Type.UsingNamespaces.Add("System.ComponentModel");
            UserControl1DesignerType.Type.UsingNamespaces.Add("System.Windows.Forms");

            this.UsingNamespaces.Add("System.Collections.Generic");
            this.UsingNamespaces.Add("System.ComponentModel");
            this.UsingNamespaces.Add("System.Drawing");
            this.UsingNamespaces.Add("System.Linq");
            this.UsingNamespaces.Add("System.Text");
            this.UsingNamespaces.Add("System.Windows.Forms");



            UserControl1DesignerType.Type.Methods.Add(Dispose);

        }