public StockMethodMain(SolutionProjectLanguageType ApplicationType)
		{
			// note: this method will run under javascript

			#region Parameters args
			var _args = new SolutionProjectLanguageArgument
			{
				Type = new SolutionProjectLanguageType
				{
                    ElementType = new KnownStockTypes.System.String()
				},

				Name = "args",
				Summary = "Commandline arguments"
			};

			#endregion

			this.Name = "Main";
            //this.Summary = "In debug build you can just hit F5 and debug the server side code.";
			this.IsStatic = true;

            var AsProgram_Launch =
                new PseudoCallExpression
                {

                    Method = new SolutionProjectLanguageMethod
                    {
                        DeclaringType = new SolutionProjectLanguageType
                        {
                            DeclaringType = new SolutionProjectLanguageType
                            {
                                Namespace = "jsc.meta.Commands.Rewrite.RewriteToUltraApplication",
                                Name = "RewriteToUltraApplication"
                            },
                            Name = "AsProgram"
                        },
                        IsStatic = true,
                        Name = "Launch"
                    },

                    ParameterExpressions = new[] {
						ApplicationType
					}
                };

			this.Code = new SolutionProjectLanguageCode
			{
				AsProgram_Launch
			};

			this.Parameters.Add(_args);


		}
        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 StockMethodMain(SolutionProjectLanguageType ApplicationType)
        {
            // note: this method will run under javascript

            #region Parameters args
            var _args = new SolutionProjectLanguageArgument
            {
                Type = new SolutionProjectLanguageType
                {
                    ElementType = new KnownStockTypes.System.String()
                },

                Name    = "args",
                Summary = "Commandline arguments"
            };

            #endregion

            this.Name = "Main";
            //this.Summary = "In debug build you can just hit F5 and debug the server side code.";
            this.IsStatic = true;

            var AsProgram_Launch =
                new PseudoCallExpression
            {
                Method = new SolutionProjectLanguageMethod
                {
                    DeclaringType = new SolutionProjectLanguageType
                    {
                        DeclaringType = new SolutionProjectLanguageType
                        {
                            Namespace = "jsc.meta.Commands.Rewrite.RewriteToUltraApplication",
                            Name      = "RewriteToUltraApplication"
                        },
                        Name = "AsProgram"
                    },
                    IsStatic = true,
                    Name     = "Launch"
                },

                ParameterExpressions = new[] {
                    ApplicationType
                }
            };

            this.Code = new SolutionProjectLanguageCode
            {
                AsProgram_Launch
            };

            this.Parameters.Add(_args);
        }
        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
            };
        }
Exemple #5
0
        public StockMethodWebMethod(SolutionBuilderInteractive Interactive)
        {
            // note: this method will run under javascript

            #region Parameters e y
            var _e = new SolutionProjectLanguageArgument
            {
                Type = new KnownStockTypes.System.String(),

                Name    = "e",
                Summary = "A parameter from javascript."
            };

            var _y = new SolutionProjectLanguageArgument
            {
                Type = new KnownStockTypes.System.ActionOfString(),

                Name    = "y",
                Summary = "A callback to javascript."
            };
            #endregion


            this.Name    = "WebMethod2";
            this.Summary = "This Method is a javascript callable method.";

            this.Code = new SolutionProjectLanguageCode
            {
                //Interactive.WebMethod2,

                "Send it back to the caller.",
                new PseudoCallExpression
                {
                    Object = _y.Name,

                    Method = new SolutionProjectLanguageMethod {
                        Name = "Invoke"
                    },

                    ParameterExpressions = new [] {
                        _e.Name
                    }
                }
            };


            this.Parameters.Add(_e);
            this.Parameters.Add(_y);
        }
		public StockMethodWebMethod(SolutionBuilderInteractive Interactive)
		{
			// note: this method will run under javascript

            #region Parameters e y
            var _e = new SolutionProjectLanguageArgument
            {
                Type = new KnownStockTypes.System.String(),

                Name = "e",
                Summary = "A parameter from javascript."
            };

            var _y = new SolutionProjectLanguageArgument
            {
                Type = new KnownStockTypes.System.ActionOfString(),

                Name = "y",
                Summary = "A callback to javascript."
            };
            #endregion


			this.Name = "WebMethod2";
			this.Summary = "This Method is a javascript callable method.";

			this.Code = new SolutionProjectLanguageCode
			{
                //Interactive.WebMethod2,

				"Send it back to the caller.",
				new PseudoCallExpression
				{
					Object = _y.Name,

					Method =  new SolutionProjectLanguageMethod { Name = "Invoke" },

					ParameterExpressions = new [] {
						_e.Name
					}
				}
			};


			this.Parameters.Add(_e);
			this.Parameters.Add(_y);
		}
Exemple #7
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 WebMethod2Expression()
        {
            // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2014/201406/20140602

            // PHP does not yet support XLinq
            // Java does not yet support Generics



            // note: this method will run under javascript

            #region Parameters e y
            var _e = new SolutionProjectLanguageArgument
            {
                Type = new KnownStockTypes.System.String(),

                Name    = "e",
                Summary = "A parameter from javascript. JSC supports string data type for all platforms."
            };

            var _y = new SolutionProjectLanguageArgument
            {
                Type = new KnownStockTypes.ScriptCoreLib.Delegates.StringAction(),

                Name    = "y",
                Summary = "A callback to javascript. In the future all platforms will allow Action<XElementConvertable> delegates."
            };
            #endregion


            this.Comment = (InteractiveComment)"Send something back from WebMethod2";

            this.Object = new PseudoCallExpression
            {
                Object = _e.Name,

                Method = new SolutionProjectLanguageMethod
                {
                    DeclaringType = new KnownStockTypes.System.Xml.Linq.XElement(),
                    Name          = "Element"
                },

                ParameterExpressions = new[] {
                    new PseudoCallExpression {
                        Method = new SolutionProjectLanguageMethod
                        {
                            DeclaringType = new SolutionProjectLanguageType
                            {
                                Namespace = "System.Xml.Linq",
                                Name      = "XName"
                            },
                            IsStatic = true,
                            Name     = SolutionProjectLanguageMethod.op_Implicit
                        },
                        ParameterExpressions = new []
                        {
                            new PseudoStringConstantExpression {
                                Value =
                                    "Data"
                            }
                        }
                    }
                }
            };

            this.Method = new SolutionProjectLanguageMethod
            {
                DeclaringType = new KnownStockTypes.System.Xml.Linq.XElement(),
                Name          = "ReplaceAll"
            };

            this.Title = new PseudoStringConstantExpression {
                Value = "Data from the web server"
            };

            ParameterExpressions = new[] {
                this.Title
            };
        }
        public StockMethodApplication(SolutionProjectLanguageType DeclaringType, SolutionBuilderInteractive Interactive /*, SolutionProjectLanguageField style*/)
        {
            // note: this method will run under javascript

            #region Parameters args
            var _page = new SolutionProjectLanguageArgument
            {
                Type = new SolutionProjectLanguageType
                {
                    Name = "IApp"
                },



                //Name = "document",
                Name    = "page",
                Summary = "HTML document rendered by the web server which can now be enhanced."
            };

            #endregion

            this.Name    = SolutionProjectLanguageMethod.ConstructorName;
            this.Summary = "This is a javascript application.";



            this.Code = new SolutionProjectLanguageCode();

            Interactive.RaiseGenerateApplicationExpressions(this.Code.Add);

            //#region style.Content.AttachToHead
            //var style_get_Content =
            //         new PseudoCallExpression
            //         {
            //             Object = style,

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

            //this.Code.Add(
            //    new KnownStockTypes.ScriptCoreLib.JavaScript.Extensions.INodeExtensions.AttachToHead().ToCallExpression(
            //        style_get_Content
            //    )
            //);
            //#endregion


            this.Code.Add(Interactive.ApplicationToDocumentTitle);

            // visual basic demands a local variable!
            this.Code.Add(Interactive.ApplicationCallWebMethod);

            this.DeclaringType = DeclaringType;
            this.Parameters.Add(_page);
        }
        public StockMethodApplication(SolutionProjectLanguageType DeclaringType, SolutionBuilderInteractive Interactive /*, SolutionProjectLanguageField style*/)
        {
            // note: this method will run under javascript

            #region Parameters args
            var _page = new SolutionProjectLanguageArgument
            {
                Type = new SolutionProjectLanguageType
                {
                    Name = "IApp"
                },



                
                //Name = "document",
                Name = "page",
                Summary = "HTML document rendered by the web server which can now be enhanced."
            };

            #endregion

            this.Name = SolutionProjectLanguageMethod.ConstructorName;
            this.Summary = "This is a javascript application.";



            this.Code = new SolutionProjectLanguageCode();

            Interactive.RaiseGenerateApplicationExpressions(this.Code.Add);

            //#region style.Content.AttachToHead
            //var style_get_Content =
            //         new PseudoCallExpression
            //         {
            //             Object = style,

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

            //this.Code.Add(
            //    new KnownStockTypes.ScriptCoreLib.JavaScript.Extensions.INodeExtensions.AttachToHead().ToCallExpression(
            //        style_get_Content
            //    )
            //);
            //#endregion


            this.Code.Add(Interactive.ApplicationToDocumentTitle);

            // visual basic demands a local variable!
            this.Code.Add(Interactive.ApplicationCallWebMethod);

            this.DeclaringType = DeclaringType;
            this.Parameters.Add(_page);
        }
		public WebMethod2Expression()
		{
            // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2014/201406/20140602

            // PHP does not yet support XLinq
            // Java does not yet support Generics

		

			// note: this method will run under javascript

			#region Parameters e y
			var _e = new SolutionProjectLanguageArgument
			{
                Type = new KnownStockTypes.System.String(),

				Name = "e",
				Summary = "A parameter from javascript. JSC supports string data type for all platforms."
			};

			var _y = new SolutionProjectLanguageArgument
			{
                Type = new KnownStockTypes.ScriptCoreLib.Delegates.StringAction(),

				Name = "y",
				Summary = "A callback to javascript. In the future all platforms will allow Action<XElementConvertable> delegates."
			};
			#endregion


			this.Comment = (InteractiveComment)"Send something back from WebMethod2";

			this.Object = new PseudoCallExpression
			{
				Object = _e.Name,

				Method = new SolutionProjectLanguageMethod
				{
					DeclaringType = new KnownStockTypes.System.Xml.Linq.XElement(),
					Name = "Element"
				},

				ParameterExpressions = new[] {
					new PseudoCallExpression {
						
						Method = new SolutionProjectLanguageMethod
						{
							DeclaringType = new SolutionProjectLanguageType
							{
								Namespace = "System.Xml.Linq",
								Name = "XName"
							},
							IsStatic = true,
							Name = SolutionProjectLanguageMethod.op_Implicit
						},
						ParameterExpressions = new []
						{
							new PseudoStringConstantExpression { 
								Value = 
									"Data" 
							}
						}
					}
					
				}
			};

			this.Method = new SolutionProjectLanguageMethod
			{
                DeclaringType = new KnownStockTypes.System.Xml.Linq.XElement(),
				Name = "ReplaceAll"
			};

			this.Title = new PseudoStringConstantExpression { Value = "Data from the web server" };

			ParameterExpressions = new[] {
				this.Title
			};
		}
        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);

        }