public static void RaiseAtFormCreated(FormStyler s)
 {
     if (AtFormCreated != null)
     {
         AtFormCreated(s);
     }
 }
        public static void LikeVisualStudioMetro(FormStyler s)
        {
            s.TargetOuterBorder.style.boxShadow   = "rgba(0, 122, 204, 0.3) 0px 0px 6px 3px";
            s.TargetOuterBorder.style.borderColor = JSColor.FromRGB(0, 122, 204);

            s.TargetInnerBorder.style.borderWidth = "0px";

            s.CloseButton.style.color              = JSColor.White;
            s.CloseButton.style.backgroundColor    = JSColor.None;
            s.CloseButton.style.borderWidth        = "0px";
            s.CloseButtonContent.style.borderWidth = "0px";

            s.TargetResizerPadding.style.left   = "0px";
            s.TargetResizerPadding.style.top    = "0px";
            s.TargetResizerPadding.style.right  = "0px";
            s.TargetResizerPadding.style.bottom = "0px";

            s.ContentContainerPadding.style.top = "26px";


            s.Caption.style.backgroundColor = JSColor.FromRGB(0, 122, 204);


            // this is the first forms styler
            // that restyles the decendnt controls

            //X:\jsc.svn\examples\javascript\forms\css\CSSPartialHoverStyleForButton\CSSPartialHoverStyleForButton\Application.cs
            // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2014/201404/20140409

            //new IStyle(Native.css[s.Context].descendant[typeof(Button)] + IHTMLElement.HTMLElementEnum.button)
            // 4:72ms path not found!
            // why are we trying to find the path from element to descendants?
            // can we work around to set this style for all forms then?

            //new IStyle(Native.css[s.Context.GetHTMLTarget()].descendant[typeof(Button)] + IHTMLElement.HTMLElementEnum.button)
            //new IStyle(Native.css[s.Context.GetHTMLTarget().css].descendant[typeof(Button)] + IHTMLElement.HTMLElementEnum.button)

            new IStyle(Native.css[typeof(Form)].descendant[typeof(Button)] + IHTMLElement.HTMLElementEnum.button)
            {
                transition = "background-color 200ms linear",
                //backgroundColor = "rgba(0, 122, 204, 0.3)",
                backgroundColor = "rgba(0, 122, 204, 0.0)",

                //textDecoration = "uppercase",
                border = "0px",

                cursor = IStyle.CursorEnum.pointer
            };

            new IStyle(Native.css[typeof(Form)].hover.descendant[typeof(Button)] + IHTMLElement.HTMLElementEnum.button)
            {
                backgroundColor = "rgba(0, 122, 204, 0.7)",
            };

            new IStyle((Native.css[typeof(Form)].hover.descendant[typeof(Button)] + IHTMLElement.HTMLElementEnum.button).hover)
            {
                backgroundColor = "rgba(0, 122, 204, 1.0)",
                color           = "white",
            };
        }
        public static void LikeWindows3(FormStyler s)
        {

            s.TargetOuterBorder.style.boxShadow = "";
            s.TargetOuterBorder.style.borderColor = JSColor.Black;
            s.TargetOuterBorder.style.backgroundColor = JSColor.FromGray(0xc0);

            s.Caption.style.backgroundColor = JSColor.FromRGB(0, 0, 127);
            s.Caption.style.borderBottom = "1px solid black";

            s.CloseButton.style.right = "0px";
            s.CloseButton.style.top = "0px";
            s.CloseButton.style.backgroundColor = JSColor.FromGray(0xc0);

            s.CloseButton.style.lineHeight = "24px";
            s.CloseButton.style.height = "24px";
            s.CloseButton.style.width = "24px";

            s.CloseButton.style.borderLeftColor = JSColor.White;
            s.CloseButton.style.borderTopColor = JSColor.White;
            s.CloseButton.style.borderRightColor = JSColor.FromGray(0x80);
            s.CloseButton.style.borderBottomColor = JSColor.FromGray(0x80);


            s.CloseButtonContent.style.borderLeft = "0px";
            s.CloseButtonContent.style.borderTop = "0px";
            s.CloseButtonContent.style.borderRightColor = JSColor.FromGray(0x80);
            s.CloseButtonContent.style.borderBottomColor = JSColor.FromGray(0x80);

            //s.CloseButton.style.color = JSColor.White;
            //s.CloseButton.style.backgroundColor = JSColor.None;
            //s.CloseButton.style.borderWidth = "0px";
            //s.CloseButtonContent.style.borderWidth = "0px";

            s.TargetInnerBorder.style.borderColor = JSColor.Black;
            s.TargetInnerBorder.style.left = "2px";
            s.TargetInnerBorder.style.top = "2px";
            s.TargetInnerBorder.style.right = "2px";
            s.TargetInnerBorder.style.bottom = "2px";

            s.TargetResizerPadding.style.left = "0px";
            s.TargetResizerPadding.style.top = "0px";
            s.TargetResizerPadding.style.right = "0px";
            s.TargetResizerPadding.style.bottom = "0px";


            //dynamic style = s.CaptionContent.style;

            //style.fontFamily = "System, sans-serif;";

            s.CaptionContent.style.textAlign = DOM.IStyle.TextAlignEnum.center;
            //s.CaptionContent.style.fontFamily = DOM.IStyle.FontFamilyEnum.s
            //            font-family: System, sans-serif;
            //font-size: 20px;
        }
        public static void LikeWindows98(FormStyler s)
        {
            // tested by X:\jsc.svn\examples\javascript\forms\MSVSFormStyle\MSVSFormStyle\Application.cs

            // http://css-tricks.com/examples/CSS3Gradient/
            // http://www.codeguru.com/cpp/misc/misc/titlebar/article.php/c387/Win98-like-Gradient-Caption-Bar.htm
            //= RGB(16, 132, 208)


            s.Caption.style.background = "-webkit-linear-gradient(left, rgb(0, 0, 127), rgb(16, 132, 208))";
        }
        public static void LikeWindows3(FormStyler s)
        {
            s.TargetOuterBorder.style.boxShadow       = "";
            s.TargetOuterBorder.style.borderColor     = JSColor.Black;
            s.TargetOuterBorder.style.backgroundColor = JSColor.FromGray(0xc0);

            s.Caption.style.backgroundColor = JSColor.FromRGB(0, 0, 127);
            s.Caption.style.borderBottom    = "1px solid black";

            s.CloseButton.style.right           = "0px";
            s.CloseButton.style.top             = "0px";
            s.CloseButton.style.backgroundColor = JSColor.FromGray(0xc0);

            s.CloseButton.style.lineHeight = "24px";
            s.CloseButton.style.height     = "24px";
            s.CloseButton.style.width      = "24px";

            s.CloseButton.style.borderLeftColor   = JSColor.White;
            s.CloseButton.style.borderTopColor    = JSColor.White;
            s.CloseButton.style.borderRightColor  = JSColor.FromGray(0x80);
            s.CloseButton.style.borderBottomColor = JSColor.FromGray(0x80);


            s.CloseButtonContent.style.borderLeft        = "0px";
            s.CloseButtonContent.style.borderTop         = "0px";
            s.CloseButtonContent.style.borderRightColor  = JSColor.FromGray(0x80);
            s.CloseButtonContent.style.borderBottomColor = JSColor.FromGray(0x80);

            //s.CloseButton.style.color = JSColor.White;
            //s.CloseButton.style.backgroundColor = JSColor.None;
            //s.CloseButton.style.borderWidth = "0px";
            //s.CloseButtonContent.style.borderWidth = "0px";

            s.TargetInnerBorder.style.borderColor = JSColor.Black;
            s.TargetInnerBorder.style.left        = "2px";
            s.TargetInnerBorder.style.top         = "2px";
            s.TargetInnerBorder.style.right       = "2px";
            s.TargetInnerBorder.style.bottom      = "2px";

            s.TargetResizerPadding.style.left   = "0px";
            s.TargetResizerPadding.style.top    = "0px";
            s.TargetResizerPadding.style.right  = "0px";
            s.TargetResizerPadding.style.bottom = "0px";


            //dynamic style = s.CaptionContent.style;

            //style.fontFamily = "System, sans-serif;";

            s.CaptionContent.style.textAlign = DOM.IStyle.TextAlignEnum.center;
            //s.CaptionContent.style.fontFamily = DOM.IStyle.FontFamilyEnum.s
            //            font-family: System, sans-serif;
            //font-size: 20px;
        }
        public static void LikeWindows98(FormStyler s)
        {
            // tested by X:\jsc.svn\examples\javascript\forms\MSVSFormStyle\MSVSFormStyle\Application.cs

            // http://css-tricks.com/examples/CSS3Gradient/
            // http://www.codeguru.com/cpp/misc/misc/titlebar/article.php/c387/Win98-like-Gradient-Caption-Bar.htm
            //= RGB(16, 132, 208)


            s.Caption.style.background = "-webkit-linear-gradient(left, rgb(0, 0, 127), rgb(16, 132, 208))";
        }
        public static void LikeDesktop(FormStyler s)
        {
            s.TargetOuterBorder.style.boxShadow = "rgba(0, 148, 155, 0.3) 0px 0px 6px 3px";
            s.TargetOuterBorder.style.borderColor = JSColor.FromRGB(0, 148, 155);

            s.TargetInnerBorder.style.borderWidth = "0px";

            s.CloseButton.style.color = JSColor.White;
            s.CloseButton.style.backgroundColor = JSColor.None;
            s.CloseButton.style.borderWidth = "0px";
            s.CloseButtonContent.style.borderWidth = "0px";

            s.TargetResizerPadding.style.left = "0px";
            s.TargetResizerPadding.style.top = "0px";
            s.TargetResizerPadding.style.right = "0px";
            s.TargetResizerPadding.style.bottom = "0px";

            s.ContentContainerPadding.style.top = "26px";


            s.Caption.style.backgroundColor = JSColor.FromRGB(0, 148, 155);
        }
        public static void LikeVirtualWindow(FormStyler s)
        {
            s.TargetOuterBorder.style.boxShadow = "";
            s.TargetOuterBorder.style.borderColor = JSColor.FromRGB(127, 0, 0);
            s.TargetOuterBorder.style.borderStyle = "dotted";

            s.TargetInnerBorder.style.borderWidth = "0px";
            s.TargetInnerBorder.style.backgroundColor = "";

            s.CloseButton.style.color = JSColor.White;
            s.CloseButton.style.backgroundColor = JSColor.None;
            s.CloseButton.style.borderWidth = "0px";
            s.CloseButtonContent.style.borderWidth = "0px";

            s.TargetResizerPadding.style.left = "0px";
            s.TargetResizerPadding.style.top = "0px";
            s.TargetResizerPadding.style.right = "0px";
            s.TargetResizerPadding.style.bottom = "0px";

            s.ContentContainerPadding.style.top = "26px";


            s.Caption.style.backgroundColor = "";
        }
        public static void LikeWindowsClassic(FormStyler s)
        {

        }
 public static void RaiseAtFormCreated(FormStyler s)
 {
     if (AtFormCreated != null)
         AtFormCreated(s);
 }
        public static void LikeVisualStudioMetro(FormStyler s)
        {
            s.TargetOuterBorder.style.boxShadow = "rgba(0, 122, 204, 0.3) 0px 0px 6px 3px";
            s.TargetOuterBorder.style.borderColor = JSColor.FromRGB(0, 122, 204);

            s.TargetInnerBorder.style.borderWidth = "0px";

            s.CloseButton.style.color = JSColor.White;
            s.CloseButton.style.backgroundColor = JSColor.None;
            s.CloseButton.style.borderWidth = "0px";
            s.CloseButtonContent.style.borderWidth = "0px";

            s.TargetResizerPadding.style.left = "0px";
            s.TargetResizerPadding.style.top = "0px";
            s.TargetResizerPadding.style.right = "0px";
            s.TargetResizerPadding.style.bottom = "0px";

            s.ContentContainerPadding.style.top = "26px";


            s.Caption.style.backgroundColor = JSColor.FromRGB(0, 122, 204);


            // this is the first forms styler
            // that restyles the decendnt controls

            //X:\jsc.svn\examples\javascript\forms\css\CSSPartialHoverStyleForButton\CSSPartialHoverStyleForButton\Application.cs
            // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2014/201404/20140409

            //new IStyle(Native.css[s.Context].descendant[typeof(Button)] + IHTMLElement.HTMLElementEnum.button)
            // 4:72ms path not found! 
            // why are we trying to find the path from element to descendants?
            // can we work around to set this style for all forms then?

            //new IStyle(Native.css[s.Context.GetHTMLTarget()].descendant[typeof(Button)] + IHTMLElement.HTMLElementEnum.button)
            //new IStyle(Native.css[s.Context.GetHTMLTarget().css].descendant[typeof(Button)] + IHTMLElement.HTMLElementEnum.button)

            new IStyle(Native.css[typeof(Form)].descendant[typeof(Button)] + IHTMLElement.HTMLElementEnum.button)
            {
                transition = "background-color 200ms linear",
                //backgroundColor = "rgba(0, 122, 204, 0.3)",
                backgroundColor = "rgba(0, 122, 204, 0.0)",

                //textDecoration = "uppercase",
                border = "0px",

                cursor = IStyle.CursorEnum.pointer
            };

            new IStyle(Native.css[typeof(Form)].hover.descendant[typeof(Button)] + IHTMLElement.HTMLElementEnum.button)
            {
                backgroundColor = "rgba(0, 122, 204, 0.7)",

            };

            new IStyle((Native.css[typeof(Form)].hover.descendant[typeof(Button)] + IHTMLElement.HTMLElementEnum.button).hover)
            {
                backgroundColor = "rgba(0, 122, 204, 1.0)",
                color = "white",
            };
        }
        // tested by
        // X:\jsc.svn\examples\javascript\chrome\apps\ChromeGalaxyS\ChromeGalaxyS\Application.cs

        // Message	3	The designer has fixed inconsistent type names in a partial class.  
        // The partial class name 'ScriptCoreLib.JavaScript.Windows.Forms' has been changed to 'Abstractatech.JavaScript.Forms.FloatStyler'.		0	0	

        public static void LikeFloat(FormStyler s)
        {
            // border-radius:25px;

            //dynamic TargetOuterBorder_style = s.TargetOuterBorder.style;
            //dynamic TargetInnerBorder_style = s.TargetInnerBorder.style;

            var TargetBackground = new IHTMLDiv();

            //dynamic TargetBackground_style = TargetBackground.style;

            new IStyle(TargetBackground)
            {
                position = IStyle.PositionEnum.absolute,
                left = "0px",
                top = "0px",
                right = "0px",
                bottom = "0px",
                Opacity = 0.7
            };


            s.TargetOuterBorder.parentNode.insertBefore(TargetBackground, s.TargetOuterBorder.parentNode.firstChild);



            s.TargetOuterBorder.style.boxShadow = "rgba(0, 0, 0, 0.2) 4px 4px 4px 0px";
            s.TargetOuterBorder.style.borderColor = "black";
            s.TargetOuterBorder.style.borderWidth = "0px";


            new IStyle(s.CaptionContent)
            {
                paddingLeft = "12px",
                paddingRight = "30px",
                left = "",
                right = "0px",
                height = "27px",
                backgroundColor = "  rgba(0,0,0,0.7)",
            };

            s.TargetInnerBorder.style.borderWidth = "0px";

            s.CloseButton.style.color = JSColor.Red;
            s.CloseButton.style.backgroundColor = JSColor.None;
            s.CloseButton.style.borderWidth = "0px";
            s.CloseButtonContent.style.borderWidth = "0px";

            new IStyle(s.TargetResizerPadding)
            {
                left = "0px",
                top = "0px",
                right = "0px",
                bottom = "0px"
            };



            s.TargetInnerBorder.style.backgroundColor = "";


            s.Context.LocationChanged +=
               delegate
               {
                   if (s.Context.WindowState == FormWindowState.Normal)
                       s.TargetOuterBorder.style.boxShadow = "rgba(0, 0, 0, 0.2) 4px 4px 4px 0px";
                   else
                   {
                       s.TargetOuterBorder.style.boxShadow = "";
                   }
               };

            s.ContentContainerPadding.style.backgroundColor = "  rgba(0,0,0,0.7)";

            //s.Caption.style.left = "";
            s.Caption.style.backgroundColor = "";
        }
        public static void LikeChrome(FormStyler s)
        {
            // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2014/201404

            // border-radius:25px;

            //dynamic TargetOuterBorder_style = s.TargetOuterBorder.style;
            //dynamic TargetInnerBorder_style = s.TargetInnerBorder.style;

            var TargetBackground = new IHTMLDiv();

            //dynamic TargetBackground_style = TargetBackground.style;

            new IStyle(TargetBackground)
            {
                position = IStyle.PositionEnum.absolute,
                left = "0px",
                top = "0px",
                right = "0px",
                bottom = "0px",
                Opacity = 0.7,
                //boxShadow = "rgba(0, 0, 0, 0.2) 4px 4px 4px 0px"
            };

            s.TargetOuterBorder.parentNode.insertBefore(TargetBackground, s.TargetOuterBorder.parentNode.firstChild);


            s.TargetOuterBorder.style.boxShadow = "";
            s.TargetOuterBorder.style.borderColor = "black";
            s.TargetOuterBorder.style.borderWidth = "0px";

            // overkill via html, css, svg?
            var skin = new App();

            skin.shell.style.position = IStyle.PositionEnum.absolute;
            skin.shell.style.left = "0px";
            skin.shell.style.top = "0px";
            skin.shell.style.right = "0px";


            //skin.shell.style.zIndex = 0;


            s.Context.ShowIcon = false;

            skin.tabtitle.innerText = s.Context.Text;
            s.Context.TextChanged += delegate
            {
                skin.tabtitle.innerText = s.Context.Text;
            };

            s.CaptionContent.insertPreviousSibling(skin.shell);

            // div[style-id="2"]:not(:hover):not([await1="incomplete"]) 
            //((!s.TargetOuterBorder.css.hover) + skin.shell).style.Opacity = 0.5;
            // Error	39	The call is ambiguous between the following methods or properties: 'ScriptCoreLib.JavaScript.DOM.CSSStyleRuleMonkier.this[ScriptCoreLib.JavaScript.DOM.HTML.IHTMLElement]' and 'ScriptCoreLib.JavaScript.DOM.CSSStyleRuleMonkier.this[System.Threading.Tasks.Task]'	X:\jsc.svn\market\javascript\Abstractatech.JavaScript.Forms.ChromeStyler\Abstractatech.JavaScript.Forms.ChromeStyler\Application.cs	95	14	Abstractatech.JavaScript.Forms.ChromeStyler
            // ncaught TypeError: Cannot read property 'VREABmASXzSNfpl_bHJLUOA' of null

            skin.shell.style.transition = "opacity 300ms linear";

            ((!s.TargetOuterBorder.css.hover)[(IHTMLElement)skin.shell]).style.Opacity = 0.7;
            
            s.ContentContainerPadding.style.boxShadow = "inset 1px 0 rgba(255, 255, 255, 0.6), inset 0 1px rgba(255, 255, 255, 0.6), rgba(0, 0, 0, 0.2) 4px 4px 4px 0px";



            //skin.shell.AttachTo();



            //new IStyle(s.CaptionContent)
            //{
            //    //paddingLeft = "12px",
            //    //paddingRight = "30px",
            //    //left = "",
            //    //right = "0px",
            //    height = "27px",
            //    backgroundColor = "  rgba(255,0,0,0.7)",
            //};
            s.CaptionContent.Hide();

            s.TargetInnerBorder.style.borderWidth = "0px";

            s.CloseButton.style.color = JSColor.Red;
            s.CloseButton.style.backgroundColor = JSColor.None;
            s.CloseButton.style.borderWidth = "0px";
            s.CloseButtonContent.style.borderWidth = "0px";

            s.CloseButton.Orphanize();
            s.CloseButtonContent.Orphanize();


            skin.tabbottombar.Orphanize();

            skin.tabclose.style.zIndex = 100;
            skin.tabclose.onclick +=
                delegate
                {
                    s.Context.Close();
                };

            new IStyle(s.TargetResizerPadding)
            {
                left = "0px",
                top = "0px",
                right = "0px",
                bottom = "0px"
            };



            s.TargetInnerBorder.style.backgroundColor = "";

            //background-image: -webkit-linear-gradient(#e3e3e3, #e0e0e0);


            s.ContentContainerPadding.style.backgroundColor = "#e3e3e3";
            //s.ContentContainerPadding.style.top = "25px";
            s.ContentContainerPadding.style.top = "26px";


            s.ContentContainerPadding.style.border = "1px solid rgba(0, 0, 0, 0.16)";


            //s.Caption.style.left = "";
            s.Caption.style.backgroundColor = "";



        }
        public static void LikeAero(FormStyler s)
        {
            // border-radius:25px;

            dynamic TargetOuterBorder_style = s.TargetOuterBorder.style;
            dynamic TargetInnerBorder_style = s.TargetInnerBorder.style;

            var TargetBackground = new IHTMLDiv();

            dynamic TargetBackground_style = TargetBackground.style;


            TargetBackground.style.position = IStyle.PositionEnum.absolute;
            TargetBackground.style.left = "0px";
            TargetBackground.style.top = "0px";
            TargetBackground.style.right = "0px";
            TargetBackground.style.bottom = "0px";
            TargetBackground.style.Opacity = 0.7;

            bg.ToBackground(TargetBackground.style);

            s.TargetOuterBorder.parentNode.insertBefore(TargetBackground, s.TargetOuterBorder.parentNode.firstChild);


            TargetOuterBorder_style.borderRadius = "8px";
            TargetInnerBorder_style.borderRadius = "8px";
            TargetBackground_style.borderRadius = "8px";

            s.TargetOuterBorder.style.boxShadow = "rgba(0, 0, 0, 0.8) 0px 0px 12px 0px";
            s.TargetOuterBorder.style.borderColor = "black";
            s.TargetOuterBorder.style.borderWidth = "1px";


            s.CaptionContent.style.textShadow = "0px 0px 16px white";

            s.TargetInnerBorder.style.borderWidth = "1px";
            s.TargetInnerBorder.style.borderBottomColor = "cyan";
            s.TargetInnerBorder.style.borderRightColor = "cyan";

            s.CloseButton.style.color = JSColor.White;
            s.CloseButton.style.backgroundColor = JSColor.None;
            s.CloseButton.style.borderWidth = "0px";
            s.CloseButtonContent.style.borderWidth = "0px";


            s.TargetResizerPadding.style.left = "4px";
            s.TargetResizerPadding.style.top = "4px";
            s.TargetResizerPadding.style.right = "4px";
            s.TargetResizerPadding.style.bottom = "4px";


            s.TargetInnerBorder.style.backgroundColor = "";

            s.Context.LocationChanged +=
                delegate
                {
                    if (s.Context.WindowState == FormWindowState.Normal)
                        s.ContentContainerPadding.style.backgroundColor = "";
                    else
                    {
                        var cc = s.Context.BackColor;

                        s.ContentContainerPadding.style.backgroundColor = cc.ToString();
                    }
                };
            s.ContentContainerPadding.style.backgroundColor = "";

            s.Caption.style.backgroundColor = "transparent";
        }
 public static void LikeWindowsClassic(FormStyler s)
 {
 }