public void OnCompileButton(CompilationEvent cmpEv)
 {
     if (!Remote)
     {
         if (_currentlyCompilingCode)
         {
             _lastCompiledScript = _engine.CompileCode(cmpEv.Code);
         }
         else if (_currentlyCompilingCoroutine)
         {
             _lastCompiledCoroutine = _engine.CompileCoroutine(cmpEv.Code);
         }
     }
     else
     {
         if (_currentlyCompilingCode)
         {
             _engineRemote.CompileCode(cmpEv.Code);
         }
     }
 }
Beispiel #2
0
        private static void AddTypeEvent(
            IHTMLDiv parent,
            CompilationEvent 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 PublicEvent().AttachTo(div);

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

            var s = new IHTMLAnchor {
                innerText = type.Name
            }.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.Name);

                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";

                AddTypeMethod(children, type.GetAddMethod(), UpdateLocation);
                AddTypeMethod(children, type.GetRemoveMethod(), UpdateLocation);



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

                NextClickHide =
                    delegate
                {
                    children.Hide();

                    onclick = NextClickShow;
                };

                NextClickShow =
                    delegate
                {
                    children.Show();

                    onclick = NextClickHide;
                };


                onclick = NextClickHide;
            };
        }