public StockAttributeObfuscation()
		{
			Type = new SolutionProjectLanguageType
			{
				Namespace = "System",
				Name = "Obfuscation"
			};

			var set_Feature = new SolutionProjectLanguageMethod
			{
				IsProperty = true,
				Name = "set_Feature",
				DeclaringType = Type
			};
			var merge = new PseudoStringConstantExpression
			{
				Value = "merge"
			};

			var p = new Dictionary<SolutionProjectLanguageMethod, object>
			{
				{ set_Feature, merge}
			};

			this.Properties = p;
		}
        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);
		}
Example #3
0
        public ApplicationCallWebMethodExpression(SolutionBuilderInteractive Interactive)
        {
            this.Comment = "Send data from JavaScript to the server tier";

            // why isn't this showing up?
            //this.GetObject = () => Interactive.Application_service;

            this.Object = new PseudoExpressions.PseudoThisExpression();


            this.Method = Interactive.ApplicationWebServiceType.WebMethod2;


            // promote to stockmethod?
            var YieldMethod = new SolutionProjectLanguageMethod
            {
                Code = new SolutionProjectLanguageCode
                {
                    Interactive.ApplicationYieldToDocumentTitle
                }
            };

            YieldMethod.Parameters.Add(Interactive.YieldMethod_doc);


            this.ParameterExpressions = new object[] {
                (PseudoStringConstantExpression)"A string from JavaScript.",
                YieldMethod
            };
        }
        public StockAttributeObfuscation()
        {
            Type = new SolutionProjectLanguageType
            {
                Namespace = "System",
                Name      = "Obfuscation"
            };

            var set_Feature = new SolutionProjectLanguageMethod
            {
                IsProperty    = true,
                Name          = "set_Feature",
                DeclaringType = Type
            };
            var merge = new PseudoStringConstantExpression
            {
                Value = "merge"
            };

            var p = new Dictionary <SolutionProjectLanguageMethod, object>
            {
                { set_Feature, merge }
            };

            this.Properties = p;
        }
        private void InternalWriteParameters(SolutionFile File, SolutionProjectLanguageMethod Method, params SolutionProjectLanguageArgument[] Parameters)
        {
            for (int i = 0; i < Parameters.Length; i++)
            {
                if (i > 0)
                {
                    File.WriteSpace(",");
                }

                File.Write(Parameters[i].Name);

                if (Method.IsLambda)
                {
                    // no types for lamdas!
                }
                else
                {
                    Parameters[i].Type.With(
                        ParameterType =>
                    {
                        File.WriteSpaces(":");

                        this.WriteTypeName(File, Parameters[i].Type);
                    }
                        );
                }
            }
        }
        public ApplicationCallWebMethodExpression(SolutionBuilderInteractive Interactive)
        {
            this.Comment = "Send data from JavaScript to the server tier";

            // why isn't this showing up?
            //this.GetObject = () => Interactive.Application_service;

            this.Object = new PseudoExpressions.PseudoThisExpression();


            this.Method = Interactive.ApplicationWebServiceType.WebMethod2;


            // promote to stockmethod?
            var YieldMethod = new SolutionProjectLanguageMethod
            {
                Code = new SolutionProjectLanguageCode
				{
					Interactive.ApplicationYieldToDocumentTitle
				}
            };

            YieldMethod.Parameters.Add(Interactive.YieldMethod_doc);


            this.ParameterExpressions = new object[] {
				(PseudoStringConstantExpression) "A string from JavaScript.",
				YieldMethod
			};
        }
Example #7
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
            };
        }
        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 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 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 override void WriteMethod(SolutionFile File, SolutionProjectLanguageMethod Method, SolutionBuilder Context)
        {
            var m = Method;

            if (!m.IsLambda)
                this.WriteSummary(File, m.Summary, m.Parameters.ToArray());


            File.Region(
                delegate
                {
                    if (m.IsLambda)
                    {
                        if (Method.IsFunction)
                            File.WriteSpace(Keywords.Function);
                        else
                            File.WriteSpace(Keywords.Sub);
                    }
                    else
                    {
                        File.WriteIndent();

                        if (m.IsProtected)
                            File.WriteSpace(Keywords.Protected);
                        else
                            File.WriteSpace(Keywords.Public);

                        if (m.IsStatic)
                        {
                            var IsModule = false;

                            if (m.DeclaringType != null)
                            {
                                if (m.DeclaringType.IsStatic)
                                {
                                    IsModule = true;
                                }
                            }

                            if (IsModule)
                            {
                            }
                            else
                            {
                                File.WriteSpace(Keywords.Shared);
                            }
                        }

                        if (m.IsOverride)
                            File.WriteSpace(Keywords.Overrides);

                        if (Method.IsFunction)
                            File.WriteSpace(Keywords.Function);
                        else
                            File.WriteSpace(Keywords.Sub);

                        if (m.IsConstructor)
                        {
                            File.Write(Keywords.New);
                        }
                        else
                        {
                            File.Write(m.Name);
                        }
                    }

                    File.Write("(");

                    #region Parameters
                    var Parameters = m.Parameters.ToArray();

                    for (int i = 0; i < Parameters.Length; i++)
                    {
                        if (i > 0)
                        {
                            File.WriteSpace(",");
                        }


                        File.Write(Parameters[i].Name);

                        if (Method.Code.IsLambdaExpression)
                        {
                            // omit type ? :)
                        }
                        else
                        {
                            Parameters[i].Type.With(
                                ParameterType =>
                                {
                                    File.WriteSpaces(Keywords.As);

                                    this.WriteTypeName(File, ParameterType);
                                }
                           );
                        }
                    }
                    #endregion

                    File.Write(")");

                    if (Method.Code.IsLambdaExpression)
                    {
                        File.WriteSpace();
                        this.WriteMethodBody(File, m.Code, Context);
                    }
                    else
                    {
                        File.WriteLine();

                        this.WriteMethodBody(File, m.Code, Context);

                        File.WriteIndent();

                        File.WriteSpace(Keywords.End);
                        if (Method.IsFunction)
                            File.WriteSpace(Keywords.Function);
                        else
                            File.WriteSpace(Keywords.Sub);
                    }
                    File.WriteLine();

                }
            );
        }
Example #15
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);
        }
        public override void WriteMethod(SolutionFile File, SolutionProjectLanguageMethod Method, SolutionBuilder Context)
        {
            #region WriteMethodBody
            Action WriteMethodBody =
                delegate
                {
                    this.WriteMethodBody(File, Method.Code, Context);

                    if (!Method.IsConstructor)
                    {
                        File.WriteIndent();

                        // empty?
                        var IsStatic = Method.IsStatic;

                        if (Method.DeclaringType != null)
                            if (Method.DeclaringType.IsStatic)
                                IsStatic = true;

                        if (IsStatic)
                        {
                            File.Write("0");
                        }
                        else
                        {
                            if (Method.ReturnType == null)
                                File.Write("()");
                        }

                        File.WriteLine();
                    }
                };
            #endregion


            if (Method.IsLambda)
            {
                var Parameters = Method.Parameters.ToQueue();

                var rec = default(Action<bool>);

                rec = WriteIndent =>
                {
                    if (WriteIndent)
                        File.WriteIndent();

                    File.WriteSpace(Keywords.fun);

                    if (Parameters.Count == 0)
                    {
                        File.Write("(").Write(")").WriteSpace();
                    }
                    else
                    {
                        InternalWriteParameters(File, Method, Parameters.Dequeue());
                    }

                    File.WriteSpaces("->").WriteLine();

                    File.Indent(this,
                        delegate
                        {
                            if (Parameters.Count == 0)
                                WriteMethodBody();
                            else
                                rec(true);
                        }
                    );

                };

                rec(false);

            }
            else
            {
                this.WriteSummary(File, Method.Summary, Method.Parameters.ToArray());


                File.WriteIndent();

                if (Method.Name == "Main")
                {
                    File.Write("[<Microsoft.FSharp.Core.EntryPoint>]");
                    File.WriteLine();
                    File.WriteIndent();
                }

                if (Method.DeclaringType.IsStatic)
                {
                    File.WriteSpace(Keywords.let);
                }
                else
                {
                    if (Method.IsOverride)
                        File.WriteSpace(Keywords.@override);
                    else
                        File.WriteSpace(Keywords.member);

                    File.Write("this").Write(".");
                }
                File.Write(Method.Name);
                File.Write("(");
                InternalWriteParameters(File, Method, Method.Parameters.ToArray());
                File.Write(")");
                File.WriteSpace().WriteLine("=");
                File.Indent(this, WriteMethodBody);
            }


        }
        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);

        }
        public override void WriteMethod(SolutionFile File, SolutionProjectLanguageMethod m, SolutionBuilder Context)
        {
            if (!m.IsLambda)
                if (m.Summary != null)
                    this.WriteSummary(File, m.Summary, m.Parameters.ToArray());

            File.Region(
                delegate
                {
                    if (m.IsLambda)
                    {
                        var Parameters = m.Parameters.ToArray();

                        if (Parameters.Length != 1)
                            File.Write("(");


                        for (int i = 0; i < Parameters.Length; i++)
                        {
                            if (i > 0)
                            {
                                File.WriteSpace(",");
                            }

                            File.Write(Parameters[i].Name);
                        }

                        if (Parameters.Length != 1)
                            File.WriteSpace(")");
                        else
                            File.WriteSpace();

                        File.WriteSpace("=>");

                        if (m.Code.History.Count != 1)
                            File.WriteLine();

                        this.WriteMethodBody(File, m.Code, Context);

                        return;

                    }
                    #region not lambda
                    File.WriteIndent();

                    if (m.IsPrivate)
                    {
                        File.Write(Keywords.@private);
                    }
                    else if (m.IsProtected)
                    {
                        File.Write(Keywords.@protected);
                    }
                    else
                    {
                        File.Write(Keywords.@public);
                    }
                    File.WriteSpace();

                    if (m.IsOverride)
                    {
                        File.WriteSpace(Keywords.@override);
                    }


                    if (m.IsStatic)
                    {
                        File.WriteSpace(Keywords.@static);
                    }

                    if (m.IsConstructor)
                    {
                        WriteTypeName(File, m.DeclaringType);
                    }
                    else
                    {
                        File.WriteSpace(Keywords.@void).Write(m.Name);
                    }
                    #endregion

                    {

                        var Parameters = m.Parameters.ToArray();


                        File.Write("(");


                        for (int i = 0; i < Parameters.Length; i++)
                        {
                            if (i > 0)
                            {
                                File.WriteSpace(",");
                            }

                            this.WriteTypeName(File, Parameters[i].Type);

                            File.WriteSpace();
                            File.Write(Parameters[i].Name);
                        }


                        File.Write(")");
                    }

                    if (m.Code == null)
                    {
                        File.WriteLine(";");
                    }
                    else
                    {
                        File.WriteLine();

                        this.WriteMethodBody(File, m.Code, Context);

                        if (!m.IsLambda)
                        {
                            File.WriteLine();
                        }
                    }
                }
            );
        }
        public override void WriteMethod(SolutionFile File, SolutionProjectLanguageMethod m, SolutionBuilder Context)
        {
            if (!m.IsLambda)
            {
                if (m.Summary != null)
                {
                    this.WriteSummary(File, m.Summary, m.Parameters.ToArray());
                }
            }

            File.Region(
                delegate
            {
                if (m.IsLambda)
                {
                    var Parameters = m.Parameters.ToArray();

                    if (Parameters.Length != 1)
                    {
                        File.Write("(");
                    }


                    for (int i = 0; i < Parameters.Length; i++)
                    {
                        if (i > 0)
                        {
                            File.WriteSpace(",");
                        }

                        File.Write(Parameters[i].Name);
                    }

                    if (Parameters.Length != 1)
                    {
                        File.WriteSpace(")");
                    }
                    else
                    {
                        File.WriteSpace();
                    }

                    File.WriteSpace("=>");

                    if (m.Code.History.Count != 1)
                    {
                        File.WriteLine();
                    }

                    this.WriteMethodBody(File, m.Code, Context);

                    return;
                }
                #region not lambda
                File.WriteIndent();

                if (m.IsPrivate)
                {
                    File.Write(Keywords.@private);
                }
                else if (m.IsProtected)
                {
                    File.Write(Keywords.@protected);
                }
                else
                {
                    File.Write(Keywords.@public);
                }
                File.WriteSpace();

                if (m.IsOverride)
                {
                    File.WriteSpace(Keywords.@override);
                }


                if (m.IsStatic)
                {
                    File.WriteSpace(Keywords.@static);
                }

                if (m.IsConstructor)
                {
                    WriteTypeName(File, m.DeclaringType);
                }
                else
                {
                    File.WriteSpace(Keywords.@void).Write(m.Name);
                }
                #endregion

                {
                    var Parameters = m.Parameters.ToArray();


                    File.Write("(");


                    for (int i = 0; i < Parameters.Length; i++)
                    {
                        if (i > 0)
                        {
                            File.WriteSpace(",");
                        }

                        this.WriteTypeName(File, Parameters[i].Type);

                        File.WriteSpace();
                        File.Write(Parameters[i].Name);
                    }


                    File.Write(")");
                }

                if (m.Code == null)
                {
                    File.WriteLine(";");
                }
                else
                {
                    File.WriteLine();

                    this.WriteMethodBody(File, m.Code, Context);

                    if (!m.IsLambda)
                    {
                        File.WriteLine();
                    }
                }
            }
                );
        }
        public override void WriteMethod(SolutionFile File, SolutionProjectLanguageMethod Method, SolutionBuilder Context)
        {
            var m = Method;

            if (!m.IsLambda)
            {
                this.WriteSummary(File, m.Summary, m.Parameters.ToArray());
            }


            File.Region(
                delegate
            {
                if (m.IsLambda)
                {
                    if (Method.IsFunction)
                    {
                        File.WriteSpace(Keywords.Function);
                    }
                    else
                    {
                        File.WriteSpace(Keywords.Sub);
                    }
                }
                else
                {
                    File.WriteIndent();

                    if (m.IsProtected)
                    {
                        File.WriteSpace(Keywords.Protected);
                    }
                    else
                    {
                        File.WriteSpace(Keywords.Public);
                    }

                    if (m.IsStatic)
                    {
                        var IsModule = false;

                        if (m.DeclaringType != null)
                        {
                            if (m.DeclaringType.IsStatic)
                            {
                                IsModule = true;
                            }
                        }

                        if (IsModule)
                        {
                        }
                        else
                        {
                            File.WriteSpace(Keywords.Shared);
                        }
                    }

                    if (m.IsOverride)
                    {
                        File.WriteSpace(Keywords.Overrides);
                    }

                    if (Method.IsFunction)
                    {
                        File.WriteSpace(Keywords.Function);
                    }
                    else
                    {
                        File.WriteSpace(Keywords.Sub);
                    }

                    if (m.IsConstructor)
                    {
                        File.Write(Keywords.New);
                    }
                    else
                    {
                        File.Write(m.Name);
                    }
                }

                File.Write("(");

                #region Parameters
                var Parameters = m.Parameters.ToArray();

                for (int i = 0; i < Parameters.Length; i++)
                {
                    if (i > 0)
                    {
                        File.WriteSpace(",");
                    }


                    File.Write(Parameters[i].Name);

                    if (Method.Code.IsLambdaExpression)
                    {
                        // omit type ? :)
                    }
                    else
                    {
                        Parameters[i].Type.With(
                            ParameterType =>
                        {
                            File.WriteSpaces(Keywords.As);

                            this.WriteTypeName(File, ParameterType);
                        }
                            );
                    }
                }
                #endregion

                File.Write(")");

                if (Method.Code.IsLambdaExpression)
                {
                    File.WriteSpace();
                    this.WriteMethodBody(File, m.Code, Context);
                }
                else
                {
                    File.WriteLine();

                    this.WriteMethodBody(File, m.Code, Context);

                    File.WriteIndent();

                    File.WriteSpace(Keywords.End);
                    if (Method.IsFunction)
                    {
                        File.WriteSpace(Keywords.Function);
                    }
                    else
                    {
                        File.WriteSpace(Keywords.Sub);
                    }
                }
                File.WriteLine();
            }
                );
        }
        public override void WriteMethod(SolutionFile File, SolutionProjectLanguageMethod Method, SolutionBuilder Context)
        {
            #region WriteMethodBody
            Action WriteMethodBody =
                delegate
            {
                this.WriteMethodBody(File, Method.Code, Context);

                if (!Method.IsConstructor)
                {
                    File.WriteIndent();

                    // empty?
                    var IsStatic = Method.IsStatic;

                    if (Method.DeclaringType != null)
                    {
                        if (Method.DeclaringType.IsStatic)
                        {
                            IsStatic = true;
                        }
                    }

                    if (IsStatic)
                    {
                        File.Write("0");
                    }
                    else
                    {
                        if (Method.ReturnType == null)
                        {
                            File.Write("()");
                        }
                    }

                    File.WriteLine();
                }
            };
            #endregion


            if (Method.IsLambda)
            {
                var Parameters = Method.Parameters.ToQueue();

                var rec = default(Action <bool>);

                rec = WriteIndent =>
                {
                    if (WriteIndent)
                    {
                        File.WriteIndent();
                    }

                    File.WriteSpace(Keywords.fun);

                    if (Parameters.Count == 0)
                    {
                        File.Write("(").Write(")").WriteSpace();
                    }
                    else
                    {
                        InternalWriteParameters(File, Method, Parameters.Dequeue());
                    }

                    File.WriteSpaces("->").WriteLine();

                    File.Indent(this,
                                delegate
                    {
                        if (Parameters.Count == 0)
                        {
                            WriteMethodBody();
                        }
                        else
                        {
                            rec(true);
                        }
                    }
                                );
                };

                rec(false);
            }
            else
            {
                this.WriteSummary(File, Method.Summary, Method.Parameters.ToArray());


                File.WriteIndent();

                if (Method.Name == "Main")
                {
                    File.Write("[<Microsoft.FSharp.Core.EntryPoint>]");
                    File.WriteLine();
                    File.WriteIndent();
                }

                if (Method.DeclaringType.IsStatic)
                {
                    File.WriteSpace(Keywords.let);
                }
                else
                {
                    if (Method.IsOverride)
                    {
                        File.WriteSpace(Keywords.@override);
                    }
                    else
                    {
                        File.WriteSpace(Keywords.member);
                    }

                    File.Write("this").Write(".");
                }
                File.Write(Method.Name);
                File.Write("(");
                InternalWriteParameters(File, Method, Method.Parameters.ToArray());
                File.Write(")");
                File.WriteSpace().WriteLine("=");
                File.Indent(this, WriteMethodBody);
            }
        }
        private void InternalWriteParameters(SolutionFile File, SolutionProjectLanguageMethod Method, params SolutionProjectLanguageArgument[] Parameters)
        {

            for (int i = 0; i < Parameters.Length; i++)
            {
                if (i > 0)
                {
                    File.WriteSpace(",");
                }

                File.Write(Parameters[i].Name);

                if (Method.IsLambda)
                {
                    // no types for lamdas!
                }
                else
                {
                    Parameters[i].Type.With(
                        ParameterType =>
                        {
                            File.WriteSpaces(":");

                            this.WriteTypeName(File, Parameters[i].Type);
                        }
                    );
                }
            }
        }