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 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 override void WriteTypeName(SolutionFile File, SolutionProjectLanguageType Type)
        {
            if (Type == null)
            {
                return;
            }

            if (Type is KnownStockTypes.System.String)
            {
                File.Write("string");
                return;
            }

            if (Type is KnownStockTypes.System.Boolean)
            {
                File.Write("bool");
                return;
            }

            if (Type.DeclaringType != null)
            {
                WriteTypeName(File, Type.DeclaringType);
                File.Write(".");
            }

            if (Type.ElementType != null)
            {
                WriteTypeName(File, Type.ElementType);
                File.Write("[]");

                return;
            }

            File.Write(Type);

            if (Type.Arguments.Count > 0)
            {
                File.Write("<");

                var Arguments = Type.Arguments.ToArray();

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

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

                File.Write(">");
            }
        }
		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 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 override void WriteTypeName(SolutionFile File, SolutionProjectLanguageType Type)
        {
            if (Type == null)
            {
                return;
            }

            if (Type.DeclaringType != null)
            {
                WriteTypeName(File, Type.DeclaringType);
                File.Write(".");
            }

            if (Type.ElementType != null)
            {
                WriteTypeName(File, Type.ElementType);
                File.Write("()");

                return;
            }

            File.Write(
                new SolutionFileWriteArguments
            {
                Fragment = SolutionFileTextFragment.Type,
                Tag      = Type,
                Text     = Type.Name
            }
                );

            if (Type.Arguments.Count > 0)
            {
                File.Write("(");
                File.Write(Keywords.Of);
                File.WriteSpace();

                var Arguments = Type.Arguments.ToArray();

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

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

                File.Write(")");
            }
        }
        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 override void WriteType(SolutionFile File, SolutionProjectLanguageType Type, SolutionBuilder Context)
        {
            // http://msdn.microsoft.com/en-us/library/dd233205.aspx

            File.Write(this, Context, Type.Comments);

            File.Region(
                delegate
            {
                WriteNamespace(File, Type.Namespace,
                               delegate
                {
                    File.WriteUsingNamespaceList(this, Type);

                    File.WriteLine();

                    this.WriteSummary(
                        File,
                        Type.Summary
                        );

                    File.Region(
                        delegate
                    {
                        File.WriteIndent();

                        var Constructor = Type.Methods.SingleOrDefault(k => k.IsConstructor);


                        if (Type.IsStatic)
                        {
                            File.WriteSpace(Keywords.@module);
                            WriteTypeName(File, Type);
                            File.WriteSpace();
                            File.Write("=");

                            File.WriteLine();
                        }
                        else
                        {
                            File.Write("[<Sealed>]");
                            File.WriteLine();
                            File.WriteIndent();

                            File.WriteSpace(Keywords.type);

                            if (Type.IsInternal)
                            {
                                File.WriteSpace(Keywords.@internal);
                            }

                            WriteTypeName(File, Type);
                            File.Write("(");

                            if (Constructor != null)
                            {
                                this.InternalWriteParameters(File, Constructor, Constructor.Parameters.ToArray());
                            }

                            File.WriteSpace(")");

                            File.WriteSpace(Keywords.@as);
                            File.WriteSpace("me");

                            File.WriteSpace("=");
                            File.WriteLine();

                            File.Indent(this,
                                        delegate
                            {
                                if (Type.BaseType != null)
                                {
                                    File.WriteIndent();
                                    File.WriteSpace(Keywords.@inherit);

                                    WriteTypeName(File, Type.BaseType);
                                    File.Write("(");
                                    File.WriteSpace(")");
                                    File.WriteLine();
                                }

                                // only need this if there are any members beyond ctor?
                                File.WriteIndent();
                                File.WriteSpace(Keywords.@let);
                                File.Write("this");
                                File.WriteSpaces("=");
                                File.Write("me");
                                File.WriteLine();

                                File.WriteLine();

                                File.WriteIndent();
                                File.WriteSpace(Keywords.@do);
                                File.Write("()");
                                File.WriteLine();

                                File.WriteLine();
                            }
                                        );
                        }

                        // .ctor !

                        File.Indent(this,
                                    delegate
                        {
                            if (!Type.IsStatic)
                            {
                                #region Fields with FieldConstructor
                                Type.Fields.WithEach(
                                    Field =>
                                {
                                    // http://msdn.microsoft.com/en-us/library/dd469494.aspx



                                    if (Field.FieldConstructor != null)
                                    {
                                        File.WriteIndent().WriteSpace(Keywords.let).Write(Field.Name).WriteSpaces("=");
                                        this.WritePseudoCallExpression(File, Field.FieldConstructor, Context);
                                    }
                                    else
                                    {
                                        // first asignment shall do a let
                                        if (Field.IsReadOnly)
                                        {
                                            return;
                                        }

                                        File.WriteIndent().WriteSpace(Keywords.let).WriteSpace(Keywords.mutable);
                                        File.Write(Field.Name).WriteSpaces(":");
                                        WriteTypeName(File, Field.FieldType);

                                        File.WriteSpaces("=").Write(Keywords.@null);
                                    }

                                    File.WriteLine();
                                }
                                    );
                                #endregion


                                if (Constructor != null)
                                {
                                    this.WriteMethodBody(
                                        File, Constructor.Code, Context
                                        );
                                }

                                File.WriteLine();
                                File.WriteLine();
                            }

                            foreach (var item in (from m in Type.Methods where !m.IsConstructor select m).ToArray())
                            {
                                if (item.DeclaringType == null)
                                {
                                    item.DeclaringType = Type;
                                }

                                this.WriteMethod(
                                    File,
                                    item,
                                    Context
                                    );

                                File.WriteLine();
                            }
                        }
                                    );
                    }
                        );
                }
                               );
            }
                );
        }
        public override void WriteType(SolutionFile File, SolutionProjectLanguageType Type, SolutionBuilder Context)
        {
            File.Write(this, Context, Type.Comments);




            // should the namespaces be clickable?


            File.WriteUsingNamespaceList(this, Type);

            File.WriteLine();

            File.Region(
                delegate
                {


                    WriteNamespace(File, Type.Namespace,
                        delegate
                        {


                            this.WriteSummary(
                                    File,

                                    Type.Summary
                                );


                            File.Region(
                                delegate
                                {
                                    File.WriteIndent();

                                    if (Type.IsPartial)
                                        File.WriteSpace(Keywords.Partial);

                                    File.WriteSpace(Keywords.Public);

                                    if (Type.IsSealed)
                                    {
                                        File.WriteSpace(Keywords.NotInheritable);
                                    }

                                    if (!Type.IsStatic)
                                    {
                                        File.WriteSpace(Keywords.Class);
                                    }
                                    else
                                    {
                                        File.WriteSpace(Keywords.Module);
                                    }

                                    File.Write(Type);
                                    File.WriteLine();

                                    File.Indent(this,
                                        delegate
                                        {
                                            Type.BaseType.With(
                                                BaseType =>
                                                {
                                                    File.WriteIndent().WriteSpace(Keywords.Inherits);
                                                    WriteTypeName(File, BaseType);
                                                    File.WriteLine();
                                                }
                                            );

                                            #region Fields
                                            Type.Fields.WithEach(
                                                Field =>
                                                {
                                                    this.WriteSummary(File, Field.Summary);

                                                    File.WriteIndent();

                                                    if (Field.IsPrivate)
                                                    {
                                                        File.WriteSpace(Keywords.Private);
                                                    }
                                                    else
                                                    {
                                                        File.WriteSpace(Keywords.Public);
                                                    }

                                                    if (Field.IsReadOnly)
                                                    {
                                                        File.WriteSpace(Keywords.ReadOnly);
                                                    }

                                                    File.WriteSpace(Field.Name);
                                                    File.WriteSpace(Keywords.As);

                                                    if (Field.FieldConstructor == null)
                                                    {
                                                        WriteTypeName(File, Field.FieldType);
                                                    }
                                                    else
                                                    {
                                                        WritePseudoCallExpression(File, Field.FieldConstructor, Context);
                                                    }

                                                    File.WriteLine();

                                                    File.WriteLine();
                                                }
                                            );


                                            #endregion

                                            #region Methods
                                            foreach (var item in Type.Methods.ToArray())
                                            {
                                                if (item.DeclaringType == null)
                                                    item.DeclaringType = Type;

                                                this.WriteMethod(
                                                    File,
                                                    item,
                                                    Context
                                                );


                                                File.WriteLine();
                                            }
                                            #endregion



                                            File.WriteLine();
                                        }
                                    );

                                    File.WriteIndent();
                                    File.Write(Keywords.End);
                                    File.WriteSpace();
                                    if (!Type.IsStatic)
                                    {
                                        File.Write(Keywords.Class);
                                    }
                                    else
                                    {
                                        File.Write(Keywords.Module);
                                    }
                                }
                            );
                            File.WriteLine();

                        }
                    );


                }
            );
            File.WriteLine();

        }
 public StockAttributeGeneralInformation(SolutionProjectLanguageType Type, PseudoStringConstantExpression Constant)
 {
     this.Type       = Type;
     this.Parameters = new[] { Constant };
 }
        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 override void WriteType(SolutionFile File, SolutionProjectLanguageType Type, SolutionBuilder Context)
        {
            File.Write(this, Context, Type.Comments);

            File.WriteUsingNamespaceList(this, Type);


            File.WriteLine();

            File.Region(
                delegate
                {
                    WriteNamespace(File, Type.Namespace,
                        delegate
                        {

                            if (Type.Summary != null)
                                this.WriteSummary(
                                    File,
                                    Type.Summary
                                );

                            File.Region(
                                delegate
                                {
                                    File.WriteIndent();

                                    if (Type.IsInternal)
                                    {
                                        File.WriteSpace(Keywords.@internal);
                                    }
                                    else
                                    {
                                        File.WriteSpace(Keywords.@public);
                                    }

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


                                    if (Type.IsSealed)
                                    {
                                        File.WriteSpace(Keywords.@sealed);
                                    }

                                    if (Type.IsPartial)
                                    {
                                        File.WriteSpace(Keywords.@partial);
                                    }


                                    if (Type.IsInterface)
                                    {
                                        File.WriteSpace(Keywords.@interface);
                                    }
                                    else
                                    {
                                        File.WriteSpace(Keywords.@class);
                                    }

                                    File.Write(Type);

                                    if (Type.BaseType != null)
                                    {
                                        File.WriteSpaces(":");
                                        WriteTypeName(File, Type.BaseType);
                                    }

                                    File.WriteLine();

                                    File.WriteIndent();
                                    File.WriteLine("{");
                                    File.Indent(this,
                                        delegate
                                        {
                                            #region Fields
                                            Type.Fields.WithEach(
                                                Field =>
                                                {
                                                    this.WriteSummary(File, Field.Summary);

                                                    File.WriteIndent();

                                                    if (Field.IsPrivate)
                                                    {
                                                        File.WriteSpace(Keywords.@private);
                                                    }
                                                    else
                                                    {
                                                        File.WriteSpace(Keywords.@public);
                                                    }

                                                    if (Field.IsReadOnly)
                                                    {
                                                        File.WriteSpace(Keywords.@readonly);
                                                    }

                                                    WriteTypeName(File, Field.FieldType);
                                                    File.WriteSpace().Write(Field.Name);

                                                    if (Field.FieldConstructor != null)
                                                    {
                                                        File.WriteSpaces("=");
                                                        this.WritePseudoCallExpression(File, Field.FieldConstructor, Context);
                                                    }

                                                    File.WriteLine(";");

                                                    File.WriteLine();
                                                }
                                            );


                                            #endregion


                                            #region Properties
                                            foreach (var m in Type.Properties.ToArray())
                                            {
                                                File.WriteIndent();

                                                if (Type.IsInterface)
                                                {

                                                }
                                                else
                                                {
                                                    File.Write(Keywords.@public);
                                                    File.WriteSpace();

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

                                                WriteTypeName(File, m.PropertyType);
                                                File.WriteSpace();
                                                File.Write(m.Name);

                                                if (m.IsAutoProperty)
                                                {
                                                    File.WriteSpace();
                                                    File.Write("{");
                                                }
                                                else
                                                {
                                                    File.WriteLine();
                                                    File.WriteIndent();
                                                    File.WriteLine("{");
                                                }


                                                Action<SolutionProjectLanguageMethod, Keyword> Property = (mm, kk) =>
                                                {
                                                    if (mm != null)
                                                    {
                                                        if (m.IsAutoProperty)
                                                        {
                                                            File.WriteSpace();
                                                        }
                                                        else
                                                        {
                                                            File.WriteIndent();
                                                        }
                                                        File.Write(kk);
                                                        if (mm.Code == null)
                                                        {
                                                            File.Write(";");
                                                            if (m.IsAutoProperty)
                                                            {
                                                            }
                                                            else
                                                            {
                                                                File.WriteLine();
                                                            }
                                                        }
                                                        else
                                                        {
                                                            File.WriteLine();
                                                            this.WriteMethodBody(File, mm.Code, Context);
                                                        }
                                                    }
                                                };

                                                Action PropertyBody = delegate
                                                {
                                                    Property(m.GetMethod, Keywords.get);
                                                    Property(m.SetMethod, Keywords.set);
                                                };

                                                Action<Action> PropertyIndent = Body => File.Indent(this, Body);

                                                if (m.IsAutoProperty)
                                                {
                                                    PropertyBody();
                                                    File.WriteSpace();
                                                }
                                                else
                                                {
                                                    File.Indent(this, PropertyBody);
                                                    File.WriteIndent();
                                                }


                                                File.WriteLine("}");
                                            }
                                            #endregion

                                            if (Type.Properties.Any())
                                                File.WriteLine();

                                            foreach (var item in Type.Methods.ToArray())
                                            {
                                                if (item.DeclaringType == null)
                                                    item.DeclaringType = Type;

                                                this.WriteMethod(
                                                    File,
                                                    item,
                                                    Context
                                                );

                                                File.WriteLine();
                                            }


                                        }
                                    );

                                    File.WriteIndent().WriteLine("}");
                                }
                            );
                        }
                    );


                }
            );

        }
        public override void WriteTypeName(SolutionFile File, SolutionProjectLanguageType Type)
        {
            if (Type is KnownStockTypes.System.Boolean)
            {
                File.Write(Keywords.@bool);
                return;
            }

            if (Type is KnownStockTypes.System.String)
            {
                File.Write(Keywords.@string);
                return;
            }

            if (Type.DeclaringType != null)
            {
                WriteTypeName(File, Type.DeclaringType);
                File.Write(".");
            }

            if (Type.ElementType != null)
            {
                WriteTypeName(File, Type.ElementType);
                File.Write("[]");

                return;
            }

            File.Write(Type);

            if (Type.Arguments.Count > 0)
            {
                File.Write("<");

                var Arguments = Type.Arguments.ToArray();

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

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

                File.Write(">");

            }
        }
		public static PseudoCallExpression ToPseudoCallExpression(this XElement e)
		{
			// we need a factory or context for equality
			var XElement = new SolutionProjectLanguageType
			{
				Namespace = "System.Xml.Linq",
				Name = "XElement"
			};

			var XAttribute = new SolutionProjectLanguageType
			{
				Namespace = "System.Xml.Linq",
				Name = "XAttribute"
			};

			var XName = new SolutionProjectLanguageType
			{
				Namespace = "System.Xml.Linq",
				Name = "XName"
			};

			var XComment = new SolutionProjectLanguageType
			{
				Namespace = "System.Xml.Linq",
				Name = "XComment"
			};

			#region XNameFromString
			Func<string, PseudoCallExpression> XNameFromString =
				Name =>
				{
					return new PseudoCallExpression
					{

						Method = new SolutionProjectLanguageMethod
						{
							DeclaringType = XName,
							IsStatic = true,
							Name = SolutionProjectLanguageMethod.op_Implicit
						},
						ParameterExpressions = new[]
						{
							new PseudoStringConstantExpression { 
								Value = Name
							}
						}
					};
				};
			#endregion

			var CreateXElement = default(Func<XElement, PseudoCallExpression>);

			Func<XElement, object[]> GetParameters =
				ee =>
				{

					var NewParameters = new ArrayList();

					NewParameters.Add(XNameFromString(ee.Name.LocalName));

					var Content = new PseudoArrayExpression();

					Content.ElementType = new SolutionProjectLanguageType { Name = "object" };

					foreach (var item in ee.Attributes().ToArray())
					{
						Content.Items.Add(
							new PseudoCallExpression
							{

								Method = new SolutionProjectLanguageMethod
								{
									Name = SolutionProjectLanguageMethod.ConstructorName,

									DeclaringType = XAttribute,
									ReturnType = XAttribute
								},

								ParameterExpressions = new object []
								{
									XNameFromString(item.Name.LocalName),
									new PseudoStringConstantExpression
									{
										Value = item.Value
									}
								}
							}
						);
					}

					foreach (var item in ee.Nodes().ToArray())
					{
						var _XText = item as XText;
						if (_XText != null)
						{
							Content.Items.Add(
								new PseudoStringConstantExpression
								{
									Value = _XText.Value
								}
							);
						}

						var _XElement = item as XElement;
						if (_XElement != null)
						{
							Content.Items.Add(
								CreateXElement(_XElement)
							);
						}


						var _XComment = item as XComment;
						if (_XComment != null)
						{
							Content.Items.Add(
								new PseudoCallExpression
								{

									Method = new SolutionProjectLanguageMethod
									{
										Name = SolutionProjectLanguageMethod.ConstructorName,

										DeclaringType = XComment,
										ReturnType = XComment
									},

									ParameterExpressions = new object[]
									{
										new PseudoStringConstantExpression
										{
											Value = _XComment.Value
										}
									}
								}
							);
						}

						
					}

					NewParameters.Add(Content);

					return NewParameters.ToArray();
				};

			CreateXElement =
				ee =>
				{
					return new PseudoCallExpression
					{
						XLinq = ee,

						Method = new SolutionProjectLanguageMethod
						{
							Name = SolutionProjectLanguageMethod.ConstructorName,

							DeclaringType = XElement,
							ReturnType = XElement
						},

						ParameterExpressions = GetParameters(ee)
					};
				};

			return CreateXElement(e);
		}
        public override void WriteType(SolutionFile File, SolutionProjectLanguageType Type, SolutionBuilder Context)
        {
            // http://msdn.microsoft.com/en-us/library/dd233205.aspx

            File.Write(this, Context, Type.Comments);

            File.Region(
                delegate
                {
                    WriteNamespace(File, Type.Namespace,
                        delegate
                        {
                            File.WriteUsingNamespaceList(this, Type);

                            File.WriteLine();

                            this.WriteSummary(
                                File,
                                Type.Summary
                            );

                            File.Region(
                                delegate
                                {
                                    File.WriteIndent();

                                    var Constructor = Type.Methods.SingleOrDefault(k => k.IsConstructor);


                                    if (Type.IsStatic)
                                    {
                                        File.WriteSpace(Keywords.@module);
                                        WriteTypeName(File, Type);
                                        File.WriteSpace();
                                        File.Write("=");

                                        File.WriteLine();

                                    }
                                    else
                                    {
                                        File.Write("[<Sealed>]");
                                        File.WriteLine();
                                        File.WriteIndent();

                                        File.WriteSpace(Keywords.type);

                                        if (Type.IsInternal)
                                        {
                                            File.WriteSpace(Keywords.@internal);
                                        }

                                        WriteTypeName(File, Type);
                                        File.Write("(");

                                        if (Constructor != null)
                                            this.InternalWriteParameters(File, Constructor, Constructor.Parameters.ToArray());

                                        File.WriteSpace(")");

                                        File.WriteSpace(Keywords.@as);
                                        File.WriteSpace("me");

                                        File.WriteSpace("=");
                                        File.WriteLine();

                                        File.Indent(this,
                                            delegate
                                            {
                                                if (Type.BaseType != null)
                                                {
                                                    File.WriteIndent();
                                                    File.WriteSpace(Keywords.@inherit);

                                                    WriteTypeName(File, Type.BaseType);
                                                    File.Write("(");
                                                    File.WriteSpace(")");
                                                    File.WriteLine();
                                                }

                                                // only need this if there are any members beyond ctor?
                                                File.WriteIndent();
                                                File.WriteSpace(Keywords.@let);
                                                File.Write("this");
                                                File.WriteSpaces("=");
                                                File.Write("me");
                                                File.WriteLine();

                                                File.WriteLine();

                                                File.WriteIndent();
                                                File.WriteSpace(Keywords.@do);
                                                File.Write("()");
                                                File.WriteLine();

                                                File.WriteLine();
                                            }
                                        );


                                    }

                                    // .ctor !

                                    File.Indent(this,
                                        delegate
                                        {
                                            if (!Type.IsStatic)
                                            {
                                                #region Fields with FieldConstructor
                                                Type.Fields.WithEach(
                                                    Field =>
                                                    {
                                                        // http://msdn.microsoft.com/en-us/library/dd469494.aspx




                                                        if (Field.FieldConstructor != null)
                                                        {
                                                            File.WriteIndent().WriteSpace(Keywords.let).Write(Field.Name).WriteSpaces("=");
                                                            this.WritePseudoCallExpression(File, Field.FieldConstructor, Context);
                                                        }
                                                        else
                                                        {
                                                            // first asignment shall do a let
                                                            if (Field.IsReadOnly)
                                                                return;

                                                            File.WriteIndent().WriteSpace(Keywords.let).WriteSpace(Keywords.mutable);
                                                            File.Write(Field.Name).WriteSpaces(":");
                                                            WriteTypeName(File, Field.FieldType);

                                                            File.WriteSpaces("=").Write(Keywords.@null);
                                                        }

                                                        File.WriteLine();
                                                    }
                                                );
                                                #endregion


                                                if (Constructor != null)
                                                {
                                                    this.WriteMethodBody(
                                                        File, Constructor.Code, Context
                                                    );
                                                }

                                                File.WriteLine();
                                                File.WriteLine();
                                            }

                                            foreach (var item in (from m in Type.Methods where !m.IsConstructor select m).ToArray())
                                            {
                                                if (item.DeclaringType == null)
                                                    item.DeclaringType = Type;

                                                this.WriteMethod(
                                                    File,
                                                    item,
                                                    Context
                                                );

                                                File.WriteLine();
                                            }



                                        }
                                    );
                                }
                            );
                        }
                    );
                }
            );

        }
        public override void WriteType(SolutionFile File, SolutionProjectLanguageType Type, SolutionBuilder Context)
        {
            File.Write(this, Context, Type.Comments);

            File.WriteUsingNamespaceList(this, Type);


            File.WriteLine();

            File.Region(
                delegate
            {
                WriteNamespace(File, Type.Namespace,
                               delegate
                {
                    if (Type.Summary != null)
                    {
                        this.WriteSummary(
                            File,
                            Type.Summary
                            );
                    }

                    File.Region(
                        delegate
                    {
                        File.WriteIndent();

                        if (Type.IsInternal)
                        {
                            File.WriteSpace(Keywords.@internal);
                        }
                        else
                        {
                            File.WriteSpace(Keywords.@public);
                        }

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


                        if (Type.IsSealed)
                        {
                            File.WriteSpace(Keywords.@sealed);
                        }

                        if (Type.IsPartial)
                        {
                            File.WriteSpace(Keywords.@partial);
                        }


                        if (Type.IsInterface)
                        {
                            File.WriteSpace(Keywords.@interface);
                        }
                        else
                        {
                            File.WriteSpace(Keywords.@class);
                        }

                        File.Write(Type);

                        if (Type.BaseType != null)
                        {
                            File.WriteSpaces(":");
                            WriteTypeName(File, Type.BaseType);
                        }

                        File.WriteLine();

                        File.WriteIndent();
                        File.WriteLine("{");
                        File.Indent(this,
                                    delegate
                        {
                            #region Fields
                            Type.Fields.WithEach(
                                Field =>
                            {
                                this.WriteSummary(File, Field.Summary);

                                File.WriteIndent();

                                if (Field.IsPrivate)
                                {
                                    File.WriteSpace(Keywords.@private);
                                }
                                else
                                {
                                    File.WriteSpace(Keywords.@public);
                                }

                                if (Field.IsReadOnly)
                                {
                                    File.WriteSpace(Keywords.@readonly);
                                }

                                WriteTypeName(File, Field.FieldType);
                                File.WriteSpace().Write(Field.Name);

                                if (Field.FieldConstructor != null)
                                {
                                    File.WriteSpaces("=");
                                    this.WritePseudoCallExpression(File, Field.FieldConstructor, Context);
                                }

                                File.WriteLine(";");

                                File.WriteLine();
                            }
                                );


                            #endregion


                            #region Properties
                            foreach (var m in Type.Properties.ToArray())
                            {
                                File.WriteIndent();

                                if (Type.IsInterface)
                                {
                                }
                                else
                                {
                                    File.Write(Keywords.@public);
                                    File.WriteSpace();

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

                                WriteTypeName(File, m.PropertyType);
                                File.WriteSpace();
                                File.Write(m.Name);

                                if (m.IsAutoProperty)
                                {
                                    File.WriteSpace();
                                    File.Write("{");
                                }
                                else
                                {
                                    File.WriteLine();
                                    File.WriteIndent();
                                    File.WriteLine("{");
                                }


                                Action <SolutionProjectLanguageMethod, Keyword> Property = (mm, kk) =>
                                {
                                    if (mm != null)
                                    {
                                        if (m.IsAutoProperty)
                                        {
                                            File.WriteSpace();
                                        }
                                        else
                                        {
                                            File.WriteIndent();
                                        }
                                        File.Write(kk);
                                        if (mm.Code == null)
                                        {
                                            File.Write(";");
                                            if (m.IsAutoProperty)
                                            {
                                            }
                                            else
                                            {
                                                File.WriteLine();
                                            }
                                        }
                                        else
                                        {
                                            File.WriteLine();
                                            this.WriteMethodBody(File, mm.Code, Context);
                                        }
                                    }
                                };

                                Action PropertyBody = delegate
                                {
                                    Property(m.GetMethod, Keywords.get);
                                    Property(m.SetMethod, Keywords.set);
                                };

                                Action <Action> PropertyIndent = Body => File.Indent(this, Body);

                                if (m.IsAutoProperty)
                                {
                                    PropertyBody();
                                    File.WriteSpace();
                                }
                                else
                                {
                                    File.Indent(this, PropertyBody);
                                    File.WriteIndent();
                                }


                                File.WriteLine("}");
                            }
                            #endregion

                            if (Type.Properties.Any())
                            {
                                File.WriteLine();
                            }

                            foreach (var item in Type.Methods.ToArray())
                            {
                                if (item.DeclaringType == null)
                                {
                                    item.DeclaringType = Type;
                                }

                                this.WriteMethod(
                                    File,
                                    item,
                                    Context
                                    );

                                File.WriteLine();
                            }
                        }
                                    );

                        File.WriteIndent().WriteLine("}");
                    }
                        );
                }
                               );
            }
                );
        }
Exemple #17
0
        public StudioView(Action <IHTMLElement, Action <ISaveAction> > AddSaveButton = null)
        {
            Content.style.position = IStyle.PositionEnum.absolute;
            Content.style.left     = "0px";
            Content.style.right    = "0px";
            Content.style.top      = "0px";
            Content.style.bottom   = "0px";

            new TwentyTenWorkspace().ToBackground(Content.style, true);

            var WorkspaceHeaderTab0 = new IHTMLDiv().With(
                div =>
            {
                div.style.position = IStyle.PositionEnum.absolute;
                div.style.top      = "0px";
                div.style.left     = "0px";
                div.style.width    = "14em";
                div.style.height   = "6em";

                div.style.padding = "0.5em";

                new Glow1().ToBackground(div.style, false);
            }
                ).AttachTo(Content);

            var WorkspaceHeaderTab1 = new IHTMLDiv().With(
                div =>
            {
                div.style.position = IStyle.PositionEnum.absolute;
                div.style.top      = "0px";
                div.style.left     = "14em";
                div.style.width    = "20em";
                div.style.height   = "6em";

                div.style.padding = "0.5em";

                new Glow1().ToBackground(div.style, false);
            }
                ).AttachTo(Content);

            var WorkspaceHeaderTab2 = new IHTMLDiv().With(
                div =>
            {
                div.style.position = IStyle.PositionEnum.absolute;
                div.style.top      = "0px";
                div.style.left     = "34em";
                div.style.right    = "6em";
                div.style.height   = "6em";

                div.style.padding = "0.5em";

                new Glow1().ToBackground(div.style, false);
            }
                ).AttachTo(Content);

            var WorkspaceHeaderTab7 = new IHTMLDiv().With(
                div =>
            {
                div.style.position = IStyle.PositionEnum.absolute;
                div.style.top      = "0px";
                div.style.width    = "6em";
                div.style.right    = "0px";
                div.style.height   = "6em";

                //div.style.padding = "0.5em";

                new Glow1().ToBackground(div.style, false);
            }
                ).AttachTo(Content);

            var WorkspaceHeaderTab0Text = default(IHTMLSpan);



            new DownloadSDK
            {
            }.AttachTo(
                new IHTMLAnchor
            {
                title = "Download JSC SDK!",
                href  = "http://download.jsc-solutions.net"
            }.AttachTo(WorkspaceHeaderTab7)
                );

            @"studio.jsc-solutions.net".ToDocumentTitle().With(
                title =>
            {
                WorkspaceHeaderTab0Text = new IHTMLSpan {
                    innerText = title
                };

                WorkspaceHeaderTab0Text.AttachTo(WorkspaceHeaderTab0);
                //WorkspaceHeaderTab0Text.style.SetLocation(16, 8);
                WorkspaceHeaderTab0Text.style.fontFamily = IStyle.FontFamilyEnum.Tahoma;
                WorkspaceHeaderTab0Text.style.color      = Color.White;
                WorkspaceHeaderTab0Text.style.display    = IStyle.DisplayEnum.block;

                // http://www.quirksmode.org/css/textshadow.html
                WorkspaceHeaderTab0Text.style.textShadow = "#808080 4px 2px 2px";
            }
                );


            if (AddSaveButton != null)
            {
                AddSaveButton(WorkspaceHeaderTab0Text, i => Save = i);
            }

            // em + px :)
            var Workspace0 = new IHTMLDiv().With(
                div =>
            {
                div.style.position = IStyle.PositionEnum.absolute;
                div.style.left     = "0px";
                div.style.right    = "0px";
                div.style.bottom   = "0px";
                div.style.top      = "6em";
            }
                ).AttachTo(Content);

            // workspace contains the split views
            var Workspace = new IHTMLDiv().With(
                div =>
            {
                div.style.position = IStyle.PositionEnum.absolute;
                div.style.left     = "6px";
                div.style.right    = "6px";
                div.style.bottom   = "6px";
                div.style.top      = "6px";
            }
                ).AttachTo(Workspace0);

            // in this project we wont be having toolbox or toolbar yet

            Action <HorizontalSplit> ApplyStyle =
                t =>
            {
                t.Split.Splitter.style.backgroundColor = Color.None;
                t.SplitImageContainer.Orphanize();
                t.SplitArea.Target.style.borderLeft  = "0";
                t.SplitArea.Target.style.borderRight = "0";
                t.SplitArea.Target.style.width       = "6px";
                t.SplitArea.Target.style.Opacity     = 0.7;

                // should we obselete JSColor already?
                t.SelectionColor = JSColor.Black;
            };

            var EditorTreeSplit = new HorizontalSplit
            {
                Minimum = 0,
                Maximum = 1,
                Value   = 0.7,
            };

            EditorTreeSplit.With(ApplyStyle);

            EditorTreeSplit.Split.Splitter.style.backgroundColor = Color.None;


            EditorTreeSplit.Container.AttachTo(Workspace);



            var Split = new HorizontalSplit
            {
                Minimum = 0,
                Maximum = 1,
                Value   = 0.3,
            };

            Split.With(ApplyStyle);

            Split.Split.Splitter.style.backgroundColor = Color.None;

            EditorTreeSplit.LeftContainer = Split.Container;



            var SolutionToolbox = new SolutionDockWindowPage();

            SolutionToolbox.HeaderText.innerText          = "Toolbox";
            SolutionToolbox.Content.style.backgroundColor = Color.White;
            SolutionToolbox.Content.style.padding         = "2px";
            SolutionToolbox.Content.style.overflow        = IStyle.OverflowEnum.auto;
            SolutionToolbox.Content.Clear();


            var vv = new SolutionToolboxListView();

            vv.Container.style.color = Color.Black;
            //vv.Container.AttachTo(SolutionToolbox.Content);

            var items = new StockToolboxTabsForHTMLDocument();

            // jsc market components

            vv.Add(
                new SolutionToolboxListViewTab
            {
                DataType = "DataTable",

                Name  = "DataTable",
                Title = "DataTable",
                Text  = "DataTable",
                Icon  = new DataTableImage()
            }
                );

            vv.Add(
                new SolutionToolboxListViewTab
            {
                DataType = "SpiralDataType",

                Name  = "Spiral1",
                Title = "Spiral",
                Text  = "Spiral",
                Icon  = new Spiral()
            }
                );

            // can we drag this into
            // code ?
            // msvs gets the image link
            //http://192.168.43.252:11924/assets/ScriptCoreLib.Ultra.Components/StockToolboxImageTransparent64.png?data-jsc-type=DAETruck
            vv.Add(
                new SolutionToolboxListViewTab
            {
                DataType = "DAETruck",

                Name  = "DAETruck",
                Title = "DAETruck",
                Text  = "DAETruck",
                Icon  = new DAETruck()
            }
                );

            vv.Add(
                new SolutionToolboxListViewTab
            {
                DataType = "WebGLEarthByBjorn",

                Name  = "WebGLEarthByBjorn",
                Title = "WebGLEarthByBjorn",
                Text  = "WebGLEarthByBjorn",
                Icon  = new WebGLEarthByBjorn()
            }
                );


            items.WithEach(vv.Add);



            var Viewer = new SolutionDocumentViewer();
            SolutionDocumentViewerTab File7Tab = "Design/App.htm";

            Viewer.Add(File7Tab);

            #region OutputFile
            var OutputFile       = new SolutionFile();
            var OutputFileViewer = new SolutionFileView();

            // fullscreen! :)
            OutputFileViewer.Container.style.height = "100%";

            OutputFile.IndentStack.Push(
                delegate
            {
                OutputFile.Write(SolutionFileTextFragment.Comment, "" + DateTime.Now);
                OutputFile.WriteSpace();
            }
                );

            Action <string> OutputWriteLine =
                n =>
            {
                // Would we want to rewire System.Out? Console.WriteLine?
                OutputFile.WriteIndent();
                OutputFile.WriteLine(n);

                // we could have a resume feature? now we just go and clear...
                OutputFileViewer.File = OutputFile;
            };


            OutputWriteLine("studio.jsc-solutions.net ready!");
            #endregion

            SolutionDocumentViewerTab OutputTab = "Output";
            Viewer.Add(OutputTab);
            OutputTab.TabElement.style.Float = IStyle.FloatEnum.right;


            SolutionDocumentViewerTab AboutTab = "Project";
            Viewer.Add(AboutTab);
            AboutTab.TabElement.style.Float = IStyle.FloatEnum.right;


            var CurrentDesigner = new SolutionFileDesigner();



            var HTMLDesigner = new SolutionFileDesignerHTMLElementTabs();

            CurrentDesigner.Add(HTMLDesigner);


            // undoable?
            var sln = new SolutionBuilder();



            #region CodeSourceA
            var CodeSourceATab =
                new SolutionFileDesignerTab
            {
                Image = new RTA_mode_html(),
                Text  = "Generated Code"
            };

            var CodeSourceAView = new SolutionFileView();

            CodeSourceAView.Container.style.position = IStyle.PositionEnum.absolute;
            CodeSourceAView.Container.style.left     = "0px";
            CodeSourceAView.Container.style.right    = "0px";
            CodeSourceAView.Container.style.top      = "0px";
            CodeSourceAView.Container.style.bottom   = "0px";

            CodeSourceAView.Container.style.display = IStyle.DisplayEnum.none;
            CodeSourceAView.Container.AttachTo(CurrentDesigner.Content);

            CodeSourceATab.Deactivated +=
                delegate
            {
                CodeSourceAView.Container.style.display = IStyle.DisplayEnum.none;
            };

            CodeSourceATab.Activated +=
                delegate
            {
                HTMLDesigner.HTMLDesignerContent.WhenContentReady(
                    body =>
                {
                    var CodeSourceFile = new SolutionFile
                    {
                        Name = "Default.htm"
                    };

                    var Type = new SolutionProjectLanguageType
                    {
                        Comments    = new SolutionFileComment[] { "This type was generated from the HTML file." },
                        Namespace   = sln.Name + ".HTML.Pages",
                        Name        = "IDefaultPage",
                        IsInterface = true,
                    };

                    (from n in body.AsXElement().DescendantsAndSelf()
                     let id = n.Attribute("id")
                              where id != null
                              select new { n, id }
                    ).WithEach(
                        k =>
                    {
                        Type.Properties.Add(
                            new KnownStockTypes.ScriptCoreLib.JavaScript.DOM.HTML.IHTMLElement().ToAutoProperty(k.id.Value)
                            );
                    }
                        );

                    sln.Language.WriteType(CodeSourceFile, Type, null);

                    CodeSourceAView.File = CodeSourceFile;

                    CodeSourceAView.Container.style.display = IStyle.DisplayEnum.empty;
                }
                    );
            };


            #endregion


            #region CodeSourceB
            var CodeSourceBTab =
                new SolutionFileDesignerTab
            {
                Image = new RTA_mode_html(),
                // all source code, not just html?
                Text = "Source"
            };

            var CodeSourceBView = new SolutionFileView();

            CodeSourceBView.Container.style.position = IStyle.PositionEnum.absolute;
            CodeSourceBView.Container.style.left     = "0px";
            CodeSourceBView.Container.style.right    = "0px";
            CodeSourceBView.Container.style.top      = "0px";
            CodeSourceBView.Container.style.bottom   = "0px";

            CodeSourceBView.Container.style.display = IStyle.DisplayEnum.none;
            CodeSourceBView.Container.AttachTo(CurrentDesigner.Content);

            CodeSourceBTab.Deactivated +=
                delegate
            {
                CodeSourceBView.Container.style.display = IStyle.DisplayEnum.none;
            };

            CodeSourceBTab.Activated +=
                delegate
            {
                CodeSourceBView.Container.style.display = IStyle.DisplayEnum.empty;
            };


            #endregion

            #region CodeSourceFormsDesignerTab
            var CodeSourceFormsDesignerTab =
                new SolutionFileDesignerTab
            {
                Image = new RTA_mode_design(),
                // all source code, not just html?
                Text = "Designer"
            };


            var CodeSourceFormsDesignerTabView = new SolutionFileView();

            CodeSourceFormsDesignerTabView.Container.style.With(
                style =>
            {
                style.position = IStyle.PositionEnum.absolute;
                style.left     = "0px";
                style.right    = "0px";
                style.top      = "0px";
                style.bottom   = "0px";

                style.display = IStyle.DisplayEnum.none;
            }
                );

            new IHTMLDiv().With(
                div =>
            {
                div.style.position        = IStyle.PositionEnum.absolute;
                div.style.left            = "16px";
                div.style.top             = "16px";
                div.style.width           = "400px";
                div.style.height          = "300px";
                div.style.backgroundColor = Color.FromGray(0xe0);
                div.style.border          = "1px solid gray";
                div.AttachTo(CodeSourceFormsDesignerTabView.Container);
            }
                );


            CodeSourceFormsDesignerTabView.Container.AttachTo(CurrentDesigner.Content);

            CodeSourceFormsDesignerTab.Deactivated +=
                delegate
            {
                CodeSourceFormsDesignerTabView.Container.style.display = IStyle.DisplayEnum.none;
            };

            CodeSourceFormsDesignerTab.Activated +=
                delegate
            {
                CodeSourceFormsDesignerTabView.Container.style.display = IStyle.DisplayEnum.empty;
            };


            #endregion

            CurrentDesigner.Add(CodeSourceFormsDesignerTab);
            CurrentDesigner.Add(CodeSourceBTab);
            CurrentDesigner.Add(CodeSourceATab);



            var wLeftScrollable = new System.Windows.Forms.Form
            {
                BackColor  = global::System.Drawing.Color.White,
                Text       = "Toolbox",
                ControlBox = false,
                ShowIcon   = false,
                AutoScroll = true
            };

            vv.Container.AttachTo(
                wLeftScrollable.GetHTMLTargetContainer()
                );

            //wLeftScrollable.Show();

            Split.Split.LeftScrollable.style.zIndex = 0;
            wLeftScrollable.AttachFormTo(Split.Split.LeftScrollable);


            //wLeftScrollable.PopupInsteadOfClosing();

            //Split.Split.LeftScrollable = (IHTMLDiv)(object)SolutionToolbox.body;
            Split.Split.RightScrollable = Viewer.Container;

            // ...



            #region dynamic content
            Func <IEnumerable <XElement> > GetPages = delegate
            {
                return(from n in sln.ApplicationPage.DescendantsAndSelf()
                       let type = n.Attribute(SolutionBuilderInteractive.DataTypeAttribute)
                                  where type != null
                                  let id = n.Attribute("id")
                                           where id != null
                                           select n);
            };

            sln.Interactive.GenerateApplicationExpressions +=
                Add =>
            {
                // page.PageContainer.ReplaceWith(
                GetPages().WithEach(
                    k =>
                {
                    var id = k.Attribute("id").Value;

                    if (id == "Page1")
                    {
                        Add(
                            new StockReplaceWithNewPageExpression(id)
                            );
                    }

                    if (id == "UserControl1")
                    {
                        Add(
                            new StockReplaceWithNewUserControlExpression(sln.Name + ".Components", id)
                            );
                    }

                    if (id == "Applet1")
                    {
                        Add(
                            new StockReplaceWithNewAppletExpression(sln.Name + ".Components", id)
                            );
                    }

                    if (id == "Sprite1")
                    {
                        Add(
                            new StockReplaceWithNewSpriteExpression(sln.Name + ".Components", id)
                            );
                    }

                    if (id == "AppletUserControl1")
                    {
                        Add(
                            new StockReplaceWithNewAppletExpression(sln.Name + ".Components", id)
                            );
                    }
                }
                    );
            };

            sln.Interactive.GenerateHTMLFiles +=
                Add =>
            {
                GetPages().WithEach(
                    k =>
                {
                    var id = k.Attribute("id").Value;

                    if (id == "Page1")
                    {
                        var __Content = new XElement(StockPageDefault.Page);


                        __Content.Element("head").Element("title").Value = id;

                        Add(
                            new SolutionProjectHTMLFile
                        {
                            Name    = "Design/" + id + ".htm",
                            Content = __Content
                        }
                            );
                    }
                }
                    );
            };

            sln.Interactive.GenerateTypes +=
                Add =>
            {
                GetPages().WithEach(
                    k =>
                {
                    var id = k.Attribute("id").Value;

                    if (id == "UserControl1")
                    {
                        Add(
                            new StockUserControlType(sln.Name + ".Components", id)
                            );
                    }

                    if (id == "Applet1")
                    {
                        Add(
                            new StockAppletType(sln.Name + ".Components", id)
                            );
                    }

                    if (id == "Sprite1")
                    {
                        Add(
                            new StockSpriteType(sln.Name + ".Components", id)
                            );
                    }

                    if (id == "AppletUserControl1")
                    {
                        var UserControl2 = new StockUserControlType(sln.Name + ".Components", "UserControl2");

                        Add(
                            UserControl2
                            );

                        Add(
                            new StockUserControlAppletType(sln.Name + ".Components", id, UserControl2)
                            );
                    }
                }
                    );
            };
            #endregion


            var _Solution = new TreeNode(VistaTreeNodePage.Create);


            var _Project = _Solution.Add();

            var About = new About();

            #region UpdateFile1Text
            Action UpdateFile1Text =
                delegate
            {
                if (CodeSourceBView.File != null)
                {
                    File7Tab.Text = CodeSourceBView.File.Name.SkipUntilLastIfAny("/");
                }
                else
                {
                    File7Tab.Text = sln.Name;
                }
            };
            #endregion



            #region Update
            Action Update =
                delegate
            {
                sln.Name = About.ProjectName.value;

                UpdateFile1Text();

                _Project.Clear();
                UpdateTree(sln, CodeSourceBView, _Solution, _Project);
            };
            #endregion


            var PreviousVersion = default(string);

            #region HTMLDesigner.HTMLDesignerContent
            HTMLDesigner.HTMLDesignerContent.WhenContentReady(
                body =>
            {
                if (PreviousVersion == null)
                {
                    var x           = new XElement(body.AsXElement());
                    var y           = x.ToString();
                    PreviousVersion = y;
                }

                Action <bool> HTMLDesignerContentCheck =
                    DoUpdate =>
                {
                    var x = new XElement(body.AsXElement());
                    var y = x.ToString();

                    if (PreviousVersion != y)
                    {
                        PreviousVersion = y;


                        sln.ApplicationPage = x;

                        // allow any blur causing action to complete first
                        // we get reselected for some odd reason, why?
                        new Timer(
                            delegate
                        {
                            if (DoUpdate)
                            {
                                OutputWriteLine("Designer has caused an update.");
                                Update();
                            }
                            else
                            {
                                OutputWriteLine("Designer will cause an update.");
                            }
                        }
                            ).StartTimeout(700);
                    }
                };

                var HTMLDesignerContentDirty = new Timer(
                    delegate
                {
                    HTMLDesignerContentCheck(false);
                }
                    );

                HTMLDesigner.HTMLDesignerContent.contentWindow.onfocus +=
                    delegate
                {
                    OutputWriteLine("Designer activated.");
                    //"focus".ToDocumentTitle();

                    //HTMLDesignerContentDirty.StartInterval(700);
                };

                HTMLDesigner.HTMLDesignerContent.contentWindow.onblur +=
                    delegate
                {
                    //HTMLDesignerContentDirty.Stop();

                    OutputWriteLine("Designer deactivated.");
                    //"blur".ToDocumentTitle();
                    HTMLDesignerContentCheck(true);
                };
            }
                );
            #endregion

            #region CodeSourceBView.FileChanged
            CodeSourceBView.FileChanged +=
                delegate
            {
                UpdateFile1Text();


                OutputWriteLine("Select: " + CodeSourceBView.File.Name);

                CodeSourceFormsDesignerTab.TabElement.Hide();

                // hack :)
                if (CodeSourceBView.File.Name.EndsWith("/App.htm"))
                {
                    // currently we only have one element :)

                    HTMLDesigner.HTMLDesignerTab.RaiseActivated();

                    HTMLDesigner.HTMLDesignerTab.TabElement.style.display = IStyle.DisplayEnum.inline_block;
                    HTMLDesigner.HTMLSourceTab.TabElement.style.display   = IStyle.DisplayEnum.none;
                    CodeSourceATab.TabElement.style.display = IStyle.DisplayEnum.inline_block;
                    CodeSourceBTab.TabElement.style.display = IStyle.DisplayEnum.inline_block;

                    HTMLDesigner.HTMLDesignerContent.WhenContentReady(
                        body =>
                    {
                        HTMLDesigner.HTMLDesignerContent.contentWindow.focus();
                    }
                        );

                    // show the design/source buttons
                }
                else if (CodeSourceBView.File.Name.EndsWith(".sln"))
                {
                    AboutTab.Activate();
                }
                else if (CodeSourceBView.File.Name.EndsWith(sln.Language.ProjectFileExtension))
                {
                    AboutTab.Activate();
                }
                else if (CodeSourceBView.File.Name.EndsWith(sln.Language.CodeFileExtension))
                {
                    // show type outline / member
                    CodeSourceBTab.RaiseActivated();

                    HTMLDesigner.HTMLDesignerTab.TabElement.style.display = IStyle.DisplayEnum.none;
                    HTMLDesigner.HTMLSourceTab.TabElement.style.display   = IStyle.DisplayEnum.none;
                    CodeSourceATab.TabElement.style.display = IStyle.DisplayEnum.none;
                    CodeSourceBTab.TabElement.style.display = IStyle.DisplayEnum.inline_block;

                    CodeSourceBView.File.ContextType.BaseType.With(
                        BaseType =>
                    {
                        if (BaseType is KnownStockTypes.System.Windows.Forms.UserControl)
                        {
                            CodeSourceFormsDesignerTab.TabElement.Show();
                            CodeSourceFormsDesignerTab.RaiseActivated();
                        }

                        if (BaseType is KnownStockTypes.System.ComponentModel.Component)
                        {
                            CodeSourceFormsDesignerTab.TabElement.Show();
                            CodeSourceFormsDesignerTab.RaiseActivated();
                        }
                    }
                        );
                }
            };
            #endregion


            //AddSaveButton(WorkspaceHeader, i => Save = i);

            About.ProjectName.value     = sln.Name;
            About.ProjectName.onchange +=
                delegate
            {
                OutputWriteLine("Project name has changed.");
                Update();
            };



            Viewer.Content.Clear();
            Viewer.Content.Add(About.Container);
            Viewer.Content.Add(CurrentDesigner.Container);
            Viewer.Content.Add(OutputFileViewer.Container);

            AboutTab.WhenActivated(About.Container);
            File7Tab.WhenActivated(CurrentDesigner.Container);
            OutputTab.WhenActivated(OutputFileViewer.Container);



            Viewer.First().Activate();

            //var SolutionExplorer = new SolutionDockWindowPage();

            //SolutionExplorer.HeaderText.innerText = "Solution Explorer";
            //SolutionExplorer.Content.style.backgroundColor = Color.White;
            //SolutionExplorer.Content.style.padding = "2px";
            //SolutionExplorer.Content.ReplaceContentWith(_Solution.Container);


            var fSolutionExplorer = new System.Windows.Forms.Form
            {
                BackColor  = global::System.Drawing.Color.White,
                Text       = "Solution Explorer",
                ControlBox = false,
                ShowIcon   = false
            };

            EditorTreeSplit.Split.RightScrollable.style.zIndex   = 0;
            EditorTreeSplit.Split.RightScrollable.style.position = IStyle.PositionEnum.relative;

            fSolutionExplorer.AttachFormTo(EditorTreeSplit.Split.RightScrollable);

            _Solution.Container.AttachTo(fSolutionExplorer.GetHTMLTargetContainer());

            _Solution.Container.style.overflow        = IStyle.OverflowEnum.auto;
            _Solution.Container.style.height          = "100%";
            _Solution.Container.style.backgroundColor = Color.White;

            //EditorTreeSplit.Split.RightContainer = (IHTMLDiv)(object)SolutionExplorer.Container;

            EditorTreeSplit.Container.AttachTo(Workspace);

            //CurrentDesigner.First().RaiseActivated();

            Update();

            #region CreateLanguageButton
            Action <IHTMLImage, string, SolutionProjectLanguage, string> CreateLanguageButton =
                (Icon, Text, Language, Name) =>
            {
                var span = new IHTMLSpan(Text);

                span.style.marginLeft  = "0.7em";
                span.style.marginRight = "0.7em";

                new IHTMLButton {
                    Icon                   /*, span */
                }.AttachTo(WorkspaceHeaderTab1).With(
                    btn =>
                {
                    btn.onclick +=
                        delegate
                    {
                        sln.Language = Language;
                        sln.Name     = Language.LanguageSpelledName.Replace(" ", "") + "Project1";
                        Update();
                    };

                    //btn.style.display = IStyle.DisplayEnum.block;
                }
                    );
            };
            #endregion


            CreateLanguageButton(new VisualCSharpProject(), "C#", KnownLanguages.VisualCSharp, "VisualCSharpProject1");
            CreateLanguageButton(new VisualFSharpProject(), "F#", KnownLanguages.VisualFSharp, "VisualFSharpProject1");
            CreateLanguageButton(new VisualBasicProject(), "Visual Basic", KnownLanguages.VisualBasic, "VisualBasicProject1");

            var ListOfCreateProjectTypeButton = new List <IHTMLButton>();

            #region CreateProjectTypeButton
            Action <string, Action> CreateProjectTypeButton =
                (Text, Handler) =>
            {
                var span = new IHTMLSpan(Text);

                span.style.marginLeft  = "0.7em";
                span.style.marginRight = "0.7em";

                new IHTMLButton {
                    span
                }.AttachTo(WorkspaceHeaderTab2).With(
                    btn =>
                {
                    ListOfCreateProjectTypeButton.Add(btn);

                    btn.onclick +=
                        delegate
                    {
                        ListOfCreateProjectTypeButton.WithEach(n => n.disabled = true);

                        Handler();
                    };

                    //btn.style.display = IStyle.DisplayEnum.block;
                }
                    );
            };
            #endregion

            #region ToSpecificProjectType
            Action <string, Action> ToSpecificProjectType =
                (Text, Handler) =>
            {
                CreateProjectTypeButton(Text,
                                        delegate
                {
                    Handler();


                    HTMLDesigner.HTMLDesignerContent.WhenDocumentReady(
                        document =>
                    {
                        document.WithContent(sln.ApplicationPage);
                        // we should now also lock the designer!
                        document.DesignMode = false;
                    }
                        );

                    Update();
                }
                                        );
            };
            #endregion

            #region Avalon, Forms
            ToSpecificProjectType("Avalon App",
                                  delegate
            {
                sln.WithCanvas();
            }
                                  );


            ToSpecificProjectType("Avalon Flash App",
                                  delegate
            {
                sln.WithCanvasAdobeFlash();
            }
                                  );

            ToSpecificProjectType("Forms App",
                                  delegate
            {
                sln.WithForms();
            }
                                  );


            ToSpecificProjectType("Forms Applet App",
                                  delegate
            {
                sln.WithFormsApplet();
            }
                                  );
            #endregion

            ToSpecificProjectType("Flash App",
                                  delegate
            {
                sln.WithAdobeFlash();
            }
                                  );

            ToSpecificProjectType("Flash Camera App",
                                  delegate
            {
                sln.WithAdobeFlashCamera();
            }
                                  );

            ToSpecificProjectType("Flash Flare3D App",
                                  delegate
            {
                sln.WithAdobeFlashWithFlare3D();
            }
                                  );

            ToSpecificProjectType("Applet App",
                                  delegate
            {
                sln.WithJavaApplet();
            }
                                  );
        }
        public override void WriteType(SolutionFile File, SolutionProjectLanguageType Type, SolutionBuilder Context)
        {
            File.Write(this, Context, Type.Comments);



            // should the namespaces be clickable?


            File.WriteUsingNamespaceList(this, Type);

            File.WriteLine();

            File.Region(
                delegate
            {
                WriteNamespace(File, Type.Namespace,
                               delegate
                {
                    this.WriteSummary(
                        File,

                        Type.Summary
                        );


                    File.Region(
                        delegate
                    {
                        File.WriteIndent();

                        if (Type.IsPartial)
                        {
                            File.WriteSpace(Keywords.Partial);
                        }

                        File.WriteSpace(Keywords.Public);

                        if (Type.IsSealed)
                        {
                            File.WriteSpace(Keywords.NotInheritable);
                        }

                        if (!Type.IsStatic)
                        {
                            File.WriteSpace(Keywords.Class);
                        }
                        else
                        {
                            File.WriteSpace(Keywords.Module);
                        }

                        File.Write(Type);
                        File.WriteLine();

                        File.Indent(this,
                                    delegate
                        {
                            Type.BaseType.With(
                                BaseType =>
                            {
                                File.WriteIndent().WriteSpace(Keywords.Inherits);
                                WriteTypeName(File, BaseType);
                                File.WriteLine();
                            }
                                );

                            #region Fields
                            Type.Fields.WithEach(
                                Field =>
                            {
                                this.WriteSummary(File, Field.Summary);

                                File.WriteIndent();

                                if (Field.IsPrivate)
                                {
                                    File.WriteSpace(Keywords.Private);
                                }
                                else
                                {
                                    File.WriteSpace(Keywords.Public);
                                }

                                if (Field.IsReadOnly)
                                {
                                    File.WriteSpace(Keywords.ReadOnly);
                                }

                                File.WriteSpace(Field.Name);
                                File.WriteSpace(Keywords.As);

                                if (Field.FieldConstructor == null)
                                {
                                    WriteTypeName(File, Field.FieldType);
                                }
                                else
                                {
                                    WritePseudoCallExpression(File, Field.FieldConstructor, Context);
                                }

                                File.WriteLine();

                                File.WriteLine();
                            }
                                );


                            #endregion

                            #region Methods
                            foreach (var item in Type.Methods.ToArray())
                            {
                                if (item.DeclaringType == null)
                                {
                                    item.DeclaringType = Type;
                                }

                                this.WriteMethod(
                                    File,
                                    item,
                                    Context
                                    );


                                File.WriteLine();
                            }
                            #endregion



                            File.WriteLine();
                        }
                                    );

                        File.WriteIndent();
                        File.Write(Keywords.End);
                        File.WriteSpace();
                        if (!Type.IsStatic)
                        {
                            File.Write(Keywords.Class);
                        }
                        else
                        {
                            File.Write(Keywords.Module);
                        }
                    }
                        );
                    File.WriteLine();
                }
                               );
            }
                );
            File.WriteLine();
        }
		public StockAttributeGeneralInformation(SolutionProjectLanguageType Type, PseudoStringConstantExpression Constant)
		{
			this.Type = Type;
			this.Parameters = new[] { Constant };

		}
        public static PseudoCallExpression ToPseudoCallExpression(this XElement e)
        {
            // we need a factory or context for equality
            var XElement = new SolutionProjectLanguageType
            {
                Namespace = "System.Xml.Linq",
                Name      = "XElement"
            };

            var XAttribute = new SolutionProjectLanguageType
            {
                Namespace = "System.Xml.Linq",
                Name      = "XAttribute"
            };

            var XName = new SolutionProjectLanguageType
            {
                Namespace = "System.Xml.Linq",
                Name      = "XName"
            };

            var XComment = new SolutionProjectLanguageType
            {
                Namespace = "System.Xml.Linq",
                Name      = "XComment"
            };

            #region XNameFromString
            Func <string, PseudoCallExpression> XNameFromString =
                Name =>
            {
                return(new PseudoCallExpression
                {
                    Method = new SolutionProjectLanguageMethod
                    {
                        DeclaringType = XName,
                        IsStatic = true,
                        Name = SolutionProjectLanguageMethod.op_Implicit
                    },
                    ParameterExpressions = new[]
                    {
                        new PseudoStringConstantExpression {
                            Value = Name
                        }
                    }
                });
            };
            #endregion

            var CreateXElement = default(Func <XElement, PseudoCallExpression>);

            Func <XElement, object[]> GetParameters =
                ee =>
            {
                var NewParameters = new ArrayList();

                NewParameters.Add(XNameFromString(ee.Name.LocalName));

                var Content = new PseudoArrayExpression();

                Content.ElementType = new SolutionProjectLanguageType {
                    Name = "object"
                };

                foreach (var item in ee.Attributes().ToArray())
                {
                    Content.Items.Add(
                        new PseudoCallExpression
                    {
                        Method = new SolutionProjectLanguageMethod
                        {
                            Name = SolutionProjectLanguageMethod.ConstructorName,

                            DeclaringType = XAttribute,
                            ReturnType    = XAttribute
                        },

                        ParameterExpressions = new object []
                        {
                            XNameFromString(item.Name.LocalName),
                            new PseudoStringConstantExpression
                            {
                                Value = item.Value
                            }
                        }
                    }
                        );
                }

                foreach (var item in ee.Nodes().ToArray())
                {
                    var _XText = item as XText;
                    if (_XText != null)
                    {
                        Content.Items.Add(
                            new PseudoStringConstantExpression
                        {
                            Value = _XText.Value
                        }
                            );
                    }

                    var _XElement = item as XElement;
                    if (_XElement != null)
                    {
                        Content.Items.Add(
                            CreateXElement(_XElement)
                            );
                    }


                    var _XComment = item as XComment;
                    if (_XComment != null)
                    {
                        Content.Items.Add(
                            new PseudoCallExpression
                        {
                            Method = new SolutionProjectLanguageMethod
                            {
                                Name = SolutionProjectLanguageMethod.ConstructorName,

                                DeclaringType = XComment,
                                ReturnType    = XComment
                            },

                            ParameterExpressions = new object[]
                            {
                                new PseudoStringConstantExpression
                                {
                                    Value = _XComment.Value
                                }
                            }
                        }
                            );
                    }
                }

                NewParameters.Add(Content);

                return(NewParameters.ToArray());
            };

            CreateXElement =
                ee =>
            {
                return(new PseudoCallExpression
                {
                    XLinq = ee,

                    Method = new SolutionProjectLanguageMethod
                    {
                        Name = SolutionProjectLanguageMethod.ConstructorName,

                        DeclaringType = XElement,
                        ReturnType = XElement
                    },

                    ParameterExpressions = GetParameters(ee)
                });
            };

            return(CreateXElement(e));
        }
Exemple #21
0
        public StudioView()
        {
            Content.style.position = IStyle.PositionEnum.absolute;
            Content.style.left     = "0px";
            Content.style.right    = "0px";
            Content.style.top      = "0px";
            Content.style.bottom   = "0px";

            new TwentyTenWorkspace().ToBackground(Content.style, true);

            var WorkspaceHeader = default(IHTMLSpan);

            @"jsc-solutions.net studio".ToDocumentTitle().With(
                title =>
            {
                WorkspaceHeader = new IHTMLSpan {
                    innerText = title
                };

                WorkspaceHeader.AttachTo(Content);
                WorkspaceHeader.style.SetLocation(16, 8);
                WorkspaceHeader.style.color = Color.White;

                // http://www.quirksmode.org/css/textshadow.html
                WorkspaceHeader.style.textShadow = "#808080 4px 2px 2px";
            }
                );

            // em + px :)
            var Workspace0 = new IHTMLDiv().With(
                div =>
            {
                div.style.position = IStyle.PositionEnum.absolute;
                div.style.left     = "0px";
                div.style.right    = "0px";
                div.style.bottom   = "0px";
                div.style.top      = "3em";
            }
                ).AttachTo(Content);

            // workspace contains the split views
            var Workspace = new IHTMLDiv().With(
                div =>
            {
                div.style.position = IStyle.PositionEnum.absolute;
                div.style.left     = "6px";
                div.style.right    = "6px";
                div.style.bottom   = "6px";
                div.style.top      = "6px";
            }
                ).AttachTo(Workspace0);


            Action <HorizontalSplit> ApplyStyle =
                t =>
            {
                t.Split.Splitter.style.backgroundColor = Color.None;
                t.SplitImageContainer.Orphanize();
                t.SplitArea.Target.style.borderLeft  = "0";
                t.SplitArea.Target.style.borderRight = "0";
                t.SplitArea.Target.style.width       = "6px";
                t.SplitArea.Target.style.Opacity     = 0.7;

                // should we obselete JSColor already?
                t.SelectionColor = JSColor.Black;
            };

            var Split = new HorizontalSplit
            {
                Minimum = 0,
                Maximum = 1,
                Value   = 0.2,
            };

            Split.With(ApplyStyle);

            Split.Split.Splitter.style.backgroundColor = Color.None;

            Split.Container.AttachTo(Workspace);



            var SolutionToolbox = new SolutionDockWindowPage();

            SolutionToolbox.HeaderText.innerText          = "Toolbox";
            SolutionToolbox.Content.style.backgroundColor = Color.White;
            SolutionToolbox.Content.style.padding         = "2px";
            SolutionToolbox.Content.style.overflow        = IStyle.OverflowEnum.auto;
            SolutionToolbox.Content.Clear();


            var vv = new SolutionToolboxListView();

            vv.Container.AttachTo(SolutionToolbox.Content);

            var items = new StockToolboxTabsForHTMLDocument();

            items.WithEach(vv.Add);


            var Viewer = new SolutionDocumentViewer();
            SolutionDocumentViewerTab AboutTab = "About";

            Viewer.Add(AboutTab);

            var CurrentDesigner = new SolutionFileDesigner();



            var HTMLDesigner = new SolutionFileDesignerHTMLElementTabs();

            CurrentDesigner.Add(HTMLDesigner);

            #region CodeSource
            var CodeSourceTab =
                new SolutionFileDesignerTab
            {
                Image = new ScriptCoreLib.Ultra.Components.HTML.Images.FromAssets.ClassViewer(),
                Text  = "XDefaultPage"
            };

            var CodeSourceView = new SolutionFileView();


            CodeSourceView.Container.style.position = IStyle.PositionEnum.absolute;
            CodeSourceView.Container.style.left     = "0px";
            CodeSourceView.Container.style.right    = "0px";
            CodeSourceView.Container.style.top      = "0px";
            CodeSourceView.Container.style.bottom   = "0px";

            CodeSourceView.Container.style.display = IStyle.DisplayEnum.none;
            CodeSourceView.Container.AttachTo(CurrentDesigner.Content);

            CodeSourceTab.Deactivated +=
                delegate
            {
                CodeSourceView.Container.style.display = IStyle.DisplayEnum.none;
            };

            CodeSourceTab.Activated +=
                delegate
            {
                HTMLDesigner.HTMLDesignerContent.WhenContentReady(
                    body =>
                {
                    var CodeSourceFile = new SolutionFile();

                    var Type = new SolutionProjectLanguageType
                    {
                        Namespace   = "HTML.Pages",
                        Name        = "IDefaultPage",
                        IsInterface = true,
                    };

                    (from n in body.AsXElement().DescendantsAndSelf()
                     let id = n.Attribute("id")
                              where id != null
                              select new { n, id }
                    ).WithEach(
                        k =>
                    {
                        Type.Properties.Add(
                            new SolutionProjectLanguageProperty
                        {
                            Name         = k.id.Value,
                            GetMethod    = new SolutionProjectLanguageMethod(),
                            SetMethod    = new SolutionProjectLanguageMethod(),
                            PropertyType = new SolutionProjectLanguageType
                            {
                                Namespace = "ScriptCoreLib.JavaScript.DOM.HTML",
                                Name      = "IHTMLElement"
                            }
                        }
                            );
                    }
                        );

                    KnownLanguages.VisualCSharp.WriteType(CodeSourceFile, Type, null);

                    CodeSourceView.File = CodeSourceFile;

                    CodeSourceView.Container.style.display = IStyle.DisplayEnum.empty;
                }
                    );
            };


            #endregion


            CurrentDesigner.Add(CodeSourceTab);



            CurrentDesigner.First().RaiseActivated();

            AboutTab.Activated +=
                delegate
            {
                Viewer.Content.ReplaceContentWith(CurrentDesigner.Container);
            };

            Viewer.First().Activate();

            Split.Split.LeftScrollable  = SolutionToolbox.Container;
            Split.Split.RightScrollable = Viewer.Container;
        }
        public override void WriteTypeName(SolutionFile File, SolutionProjectLanguageType Type)
        {
            if (Type == null)
                return;

            if (Type.DeclaringType != null)
            {
                WriteTypeName(File, Type.DeclaringType);
                File.Write(".");
            }

            if (Type.ElementType != null)
            {
                WriteTypeName(File, Type.ElementType);
                File.Write("()");

                return;
            }

            File.Write(
                new SolutionFileWriteArguments
                {
                    Fragment = SolutionFileTextFragment.Type,
                    Tag = Type,
                    Text = Type.Name
                }
            );

            if (Type.Arguments.Count > 0)
            {
                File.Write("(");
                File.Write(Keywords.Of);
                File.WriteSpace();

                var Arguments = Type.Arguments.ToArray();

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

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

                File.Write(")");

            }
        }