コード例 #1
0
        private static void AddTypeConstructor(IHTMLDiv parent, CompilationConstructor type, Action <string> UpdateLocation)
        {
            var div = new IHTMLDiv().AttachTo(parent);

            div.style.marginTop  = "0.1em";
            div.style.fontFamily = ScriptCoreLib.JavaScript.DOM.IStyle.FontFamilyEnum.Verdana;
            div.style.whiteSpace = ScriptCoreLib.JavaScript.DOM.IStyle.WhiteSpaceEnum.nowrap;


            var i = new PublicConstructor().AttachTo(div);

            i.style.verticalAlign = "middle";
            i.style.marginRight   = "0.5em";

            var w = new StringBuilder();

            w.Append(type.DeclaringType.Name);

            w.Append("(");

            type.GetParameters().ForEach(
                (p, pi) =>
            {
                if (pi > 0)
                {
                    w.Append(", ");
                }

                w.Append(p.Name);
            }
                );

            w.Append(")");


            var s = new IHTMLAnchor {
                innerText = w.ToString()
            }.AttachTo(div);


            s.href = "#";
            s.style.textDecoration = "none";
            s.style.color          = JSColor.System.WindowText;

            Action onclick = delegate
            {
            };

            s.onclick +=
                e =>
            {
                e.PreventDefault();

                s.focus();

                UpdateLocation(type.DeclaringType.Name + ".ctor");

                onclick();
            };

            s.onfocus +=
                delegate
            {
                s.style.backgroundColor = JSColor.System.Highlight;
                s.style.color           = JSColor.System.HighlightText;
            };

            s.onblur +=
                delegate
            {
                s.style.backgroundColor = JSColor.None;
                s.style.color           = JSColor.System.WindowText;
            };


            onclick =
                delegate
            {
                //var children = new IHTMLDiv().AttachTo(div);

                //children.style.paddingLeft = "2em";

                //a.GetTypes().ForEach(
                //    (Current, Next) =>
                //    {
                //        AddType(GetNamespaceContainer(children, Current), Current, UpdateLocation);

                //        ScriptCoreLib.Shared.Avalon.Extensions.AvalonSharedExtensions.AtDelay(
                //            50,
                //            Next
                //        );
                //    }
                //);


                var NextClickHide = default(Action);
                var NextClickShow = default(Action);

                NextClickHide =
                    delegate
                {
                    //children.Hide();

                    onclick = NextClickShow;
                };

                NextClickShow =
                    delegate
                {
                    //children.Show();

                    onclick = NextClickHide;
                };


                onclick = NextClickHide;
            };
        }
コード例 #2
0
        private static void AddTypeConstructor(IHTMLDiv parent, CompilationConstructor type, Action<string> UpdateLocation)
        {
            var div = new IHTMLDiv().AttachTo(parent);

            div.style.marginTop = "0.1em";
            div.style.fontFamily = ScriptCoreLib.JavaScript.DOM.IStyle.FontFamilyEnum.Verdana;
            div.style.whiteSpace = ScriptCoreLib.JavaScript.DOM.IStyle.WhiteSpaceEnum.nowrap;


            var i = new PublicConstructor().AttachTo(div);

            i.style.verticalAlign = "middle";
            i.style.marginRight = "0.5em";

            var w = new StringBuilder();

            w.Append(type.DeclaringType.Name);

            w.Append("(");

            type.GetParameters().ForEach(
                (p, pi) =>
                {
                    if (pi > 0)
                        w.Append(", ");

                    w.Append(p.Name);
                }
            );

            w.Append(")");


            var s = new IHTMLAnchor { innerText = w.ToString() }.AttachTo(div);


            s.href = "#";
            s.style.textDecoration = "none";
            s.style.color = JSColor.System.WindowText;

            Action onclick = delegate
            {

            };

            s.onclick +=
                e =>
                {
                    e.PreventDefault();

                    s.focus();

                    UpdateLocation(type.DeclaringType.Name + ".ctor");

                    onclick();
                };

            s.onfocus +=
                delegate
                {

                    s.style.backgroundColor = JSColor.System.Highlight;
                    s.style.color = JSColor.System.HighlightText;
                };

            s.onblur +=
                delegate
                {

                    s.style.backgroundColor = JSColor.None;
                    s.style.color = JSColor.System.WindowText;
                };


            onclick =
                delegate
                {
                    //var children = new IHTMLDiv().AttachTo(div);

                    //children.style.paddingLeft = "2em";

                    //a.GetTypes().ForEach(
                    //    (Current, Next) =>
                    //    {
                    //        AddType(GetNamespaceContainer(children, Current), Current, UpdateLocation);

                    //        ScriptCoreLib.Shared.Avalon.Extensions.AvalonSharedExtensions.AtDelay(
                    //            50,
                    //            Next
                    //        );
                    //    }
                    //);


                    var NextClickHide = default(Action);
                    var NextClickShow = default(Action);

                    NextClickHide =
                        delegate
                        {
                            //children.Hide();

                            onclick = NextClickShow;
                        };

                    NextClickShow =
                        delegate
                        {
                            //children.Show();

                            onclick = NextClickHide;
                        };


                    onclick = NextClickHide;
                };
        }