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 Color AddLum(this Color e, int v) { var c = JSColor.FromRGB(e.R.ToByte(), e.G.ToByte(), e.B.ToByte()).ToHLS(); c.L = (c.L + v).Min(240).Max(0).ToByte(); var x = c.ToRGB(); return(Color.FromRGB(x.R, x.G, x.B)); }
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; }
private static TreeNode ApplyLocalName(TreeNode t, XElement cc) { t.IsExpanded = true; t.Element.TextArea.Clear(); var c = new IHTMLCode(); t.Element.TextArea.Add(c); t.Element.ButtonArea.Hide(); t.Element.IconArea.Hide(); Action <string, JSColor> Write = (Text, Color) => { var cs = new IHTMLSpan { innerText = Text }; cs.style.color = Color; cs.AttachTo(c); }; Write("<", JSColor.Blue); Write(cc.Name.LocalName, JSColor.FromRGB(0xa0, 0, 0)); foreach (var item in cc.Attributes().ToArray()) { Write(" ", JSColor.None); Write("foo", JSColor.Red); Write("='", JSColor.Blue); Write(item.Value, JSColor.Blue); Write("'", JSColor.Blue); } if (!cc.Elements().Any()) { Write(">", JSColor.Blue); Write(cc.Value, JSColor.None); Write("</", JSColor.Blue); Write(cc.Name.LocalName, JSColor.FromRGB(0xa0, 0, 0)); Write(">", JSColor.Blue); } else { Write("/>", JSColor.Blue); } return(t); }
private void AddType(IHTMLDiv parent, CompilationType 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 = default(IHTMLImage); if (type.IsInterface) { i = new PublicInterface(); } else { i = new PublicClass(); } i.AttachTo(div); i.style.verticalAlign = "middle"; i.style.marginRight = "0.5em"; var s = new IHTMLAnchor { innerText = type.Name, title = "" + type.MetadataToken }.AttachTo(div); if (!string.IsNullOrEmpty(type.HTMLElement)) { var c = new IHTMLCode(); Action <string, JSColor> Write = (Text, Color) => { var cs = new IHTMLSpan { innerText = Text }; cs.style.color = Color; cs.AttachTo(c); }; Write("<", JSColor.Blue); Write(type.HTMLElement, JSColor.FromRGB(0xa0, 0, 0)); Write("/>", JSColor.Blue); //c.style.marginLeft = "1em"; c.style.Float = ScriptCoreLib.JavaScript.DOM.IStyle.FloatEnum.right; c.AttachTo(s); } s.href = "#"; s.style.textDecoration = "none"; s.style.color = JSColor.System.WindowText; Action onclick = delegate { }; s.onclick += e => { e.PreventDefault(); s.focus(); if (TouchTypeSelected != null) { TouchTypeSelected(type); } UpdateLocation(type.FullName + " - " + type.Summary + " - HTML:" + type.HTMLElement); 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 = "1em"; Func <IHTMLDiv> Group = () => new IHTMLDiv().AttachTo(children); var Groups = new { Nested = Group(), Constructors = Group(), Methods = Group(), Events = Group(), Fields = Group(), Properties = Group(), }; type.GetNestedTypes().ForEach( (Current, Next) => { AddType(Groups.Nested, Current, UpdateLocation); ScriptCoreLib.Shared.Avalon.Extensions.AvalonSharedExtensions.AtDelay( 50, Next ); } ); type.GetConstructors().ForEach( (Current, Next) => { AddTypeConstructor(Groups.Constructors, Current, UpdateLocation); ScriptCoreLib.Shared.Avalon.Extensions.AvalonSharedExtensions.AtDelay( 50, Next ); } ); var HiddenMethods = new List <int>(); Action <CompilationMethod> AddIfAny = SourceMethod => { if (SourceMethod == null) { return; } HiddenMethods.Add(SourceMethod.MetadataToken); }; Action AfterEvents = delegate { type.GetMethods().ForEach( (Current, Next) => { if (!HiddenMethods.Contains(Current.MetadataToken)) { AddTypeMethod(Groups.Methods, Current, UpdateLocation); } ScriptCoreLib.Shared.Avalon.Extensions.AvalonSharedExtensions.AtDelay( 50, Next ); } ); }; Action AfterProperties = delegate { type.GetEvents().ForEach( (Current, Next) => { AddIfAny(Current.GetAddMethod()); AddIfAny(Current.GetRemoveMethod()); AddTypeEvent(Groups.Events, Current, UpdateLocation); ScriptCoreLib.Shared.Avalon.Extensions.AvalonSharedExtensions.AtDelay( 50, Next ); } )(AfterEvents); }; type.GetProperties().ForEach( (Current, Next) => { AddIfAny(Current.GetSetMethod()); AddIfAny(Current.GetGetMethod()); AddTypeProperty(Groups.Properties, Current, UpdateLocation); ScriptCoreLib.Shared.Avalon.Extensions.AvalonSharedExtensions.AtDelay( 50, Next ); } )(AfterProperties); type.GetFields().ForEach( (Current, Next) => { AddTypeField(Groups.Fields, 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; }; }
/// <summary> /// This is a javascript application. /// </summary> /// <param name="page">HTML document rendered by the web server which can now be enhanced.</param> public Application(IDefaultPage page) { var SpiderModelContent = new SpiderModel.ApplicationContent(); page.program_13_turn_left.onclick += delegate { SpiderModelContent.po = 13; }; page.program_14_turn_right.onclick += delegate { SpiderModelContent.po = 14; }; page.program_15_go_backwards.onclick += delegate { SpiderModelContent.po = 15; }; page.program_16_go_forwards.onclick += delegate { SpiderModelContent.po = 16; }; page.program_53_mayday.onclick += delegate { SpiderModelContent.po = 53; }; page.program_43_high_five_calibration_stand.onclick += delegate { SpiderModelContent.po = 43; }; page.stop.onclick += delegate { SpiderModelContent.po = 0;; }; new Timer( tttt => { var pp = SpiderModelContent.pp; if (tttt.Counter % 2 == 0) { pp = 0; } if (pp == 13) { page.program_13_turn_left.style.color = JSColor.Blue; } else { page.program_13_turn_left.style.color = JSColor.None; } if (pp == 14) { page.program_14_turn_right.style.color = JSColor.Blue; } else { page.program_14_turn_right.style.color = JSColor.None; } if (pp == 15) { page.program_15_go_backwards.style.color = JSColor.Blue; } else { page.program_15_go_backwards.style.color = JSColor.None; } if (pp == 16) { page.program_16_go_forwards.style.color = JSColor.Blue; } else { page.program_16_go_forwards.style.color = JSColor.None; } }, 300, 150 ); #region program_60 page.program_60.onclick += delegate { #region po Action <int> po = v => { page.program_60.innerText = "program_60: " + v; SpiderModelContent.po = v; }; #endregion #region po_to_po Action <int, int> po_to_po = (from, to) => { if (SpiderModelContent.po != from) { return; } po(to); }; #endregion #region po_to_po_at Action <int, int, int> po_to_po_at = (from, to, xdelay) => { new Timer(delegate { po_to_po(from, to); }, xdelay * 1000, 0); }; #endregion // turn left until 3 po(13); // wait 3 sec and go backwards until 6 po_to_po_at(13, 15, 3); // wait 6 sec and turn right po_to_po_at(15, 14, 3 + 6); // wait 6 sec and go forwards until 6 po_to_po_at(14, 16, 3 + 6 + 6); // wait 3 sec and stop po_to_po_at(16, 0, 3 + 6 + 6 + 6); }; #endregion #region program_61 page.program_61.onclick += delegate { #region po Action <int> po = v => { page.program_61.innerText = "program_61: " + v; SpiderModelContent.po = v; }; #endregion #region po_to_po Action <int, int> po_to_po = (from, to) => { if (SpiderModelContent.po != from) { return; } po(to); }; #endregion #region po_to_po_at Action <int, int, int> po_to_po_at = (from, to, xdelay) => { new Timer(delegate { po_to_po(from, to); }, xdelay * 1000, 0); }; #endregion // turn left until 3 po(14); // wait 3 sec and go backwards until 6 po_to_po_at(14, 15, 3); // wait 6 sec and turn right po_to_po_at(15, 13, 3 + 6); // wait 6 sec and go forwards until 6 po_to_po_at(13, 16, 3 + 6 + 6); // wait 3 sec and stop po_to_po_at(16, 0, 3 + 6 + 6 + 6); }; #endregion @"Hello world".ToDocumentTitle(); #region sidebars var LeftLR = new IHTMLDiv(); LeftLR.style.position = IStyle.PositionEnum.absolute; LeftLR.style.left = "0"; LeftLR.style.top = "0"; LeftLR.style.bottom = "0"; LeftLR.style.width = "4em"; LeftLR.style.Opacity = 0.5; LeftLR.AttachToDocument(); var LeftIR = new IHTMLDiv(); LeftIR.style.position = IStyle.PositionEnum.absolute; LeftIR.style.left = "0"; LeftIR.style.top = "0"; LeftIR.style.height = "1em"; LeftIR.style.width = "4em"; LeftIR.style.Opacity = 0.8; LeftIR.AttachToDocument(); LeftIR.style.backgroundColor = JSColor.FromRGB(0xB0, 0, 0); var RightLR = new IHTMLDiv(); RightLR.style.position = IStyle.PositionEnum.absolute; RightLR.style.right = "0"; RightLR.style.top = "0"; RightLR.style.bottom = "0"; RightLR.style.Opacity = 0.5; RightLR.style.width = "4em"; RightLR.AttachToDocument(); var RightIR = new IHTMLDiv(); RightIR.style.position = IStyle.PositionEnum.absolute; RightIR.style.right = "0"; RightIR.style.top = "0"; RightIR.style.height = "1em"; RightIR.style.width = "4em"; RightIR.style.Opacity = 0.8; RightIR.AttachToDocument(); RightIR.style.backgroundColor = JSColor.FromRGB(0xB0, 0, 0); LeftLR.style.backgroundColor = JSColor.FromRGB(0x80, 0, 0); RightLR.style.backgroundColor = JSColor.FromRGB(0x80, 0, 0); #endregion page.PageContainer.AttachToDocument(); page.PageContainer.style.color = JSColor.White; page.PageContainer.style.textShadow = "#000 0px 0px 3px"; page.ElShadow.style.textShadow = "#000 0px 0px 3px"; #region AtResize Action AtResize = delegate { page.PageContainer.style.SetLocation(0, 0, Native.Window.Width, Native.Window.Height); }; AtResize(); Native.Window.onresize += delegate { AtResize(); }; #endregion var delay = new Timer( delegate { Native.Document.body.style.cursor = IStyle.CursorEnum.wait; } ); var COM46_Line_value = ""; Func <double, double> sin = Math.Sin; #region deviceorientation var gamma = 0.0; var beta = 0.0; var alpha = 0.0; Window.deviceorientation += e => { gamma = e.gamma; beta = e.beta; alpha = e.alpha; if (beta < 20) { SpiderModelContent.po = 16; } if (beta > 60) { SpiderModelContent.po = 15; } if (gamma > 30) { SpiderModelContent.po = 14; } if (gamma < -30) { SpiderModelContent.po = 13; } }; #endregion #region COM46_Line_value_loop Action COM46_Line_value_loop = null; COM46_Line_value_loop = delegate { var t = SpiderModelContent.t; page.Content2.innerText = COM46_Line_value; page.Content.innerText = "" //+ "\n: \t" + + "\nt: \t" + System.Convert.ToInt32((double)SpiderModelContent.t) + "\np: \t" + SpiderModelContent.p + "\npo: \t" + SpiderModelContent.po + "\ncamera_z: \t" + System.Convert.ToInt32((double)SpiderModelContent.camera_z) //+ "\nalpha: \t" + alpha //+ "\nbeta: \t" + beta //+ "\ngamma: \t" + gamma + "\n" + "\nRED leg1down_vertical_deg: \t" + System.Convert.ToInt32((double)SpiderModelContent.leg1down_vertical_deg) + "\nGREEN leg2down_vertical_deg: \t" + System.Convert.ToInt32((double)SpiderModelContent.leg2down_vertical_deg) + "\nBLUE leg3down_vertical_deg: \t" + System.Convert.ToInt32((double)SpiderModelContent.leg3down_vertical_deg) + "\nWHITE leg4down_vertical_deg: \t" + System.Convert.ToInt32((double)SpiderModelContent.leg4down_vertical_deg) + "\n" + "\nRED leg1up_sideway_deg: \t" + System.Convert.ToInt32((double)SpiderModelContent.leg1up_sideway_deg) + "\nGREEN leg2up_sideway_deg: \t" + System.Convert.ToInt32((double)SpiderModelContent.leg2up_sideway_deg) + "\nBLUE leg3up_sideway_deg: \t" + System.Convert.ToInt32((double)SpiderModelContent.leg3up_sideway_deg) + "\nWHITE leg4up_sideway_deg: \t" + System.Convert.ToInt32((double)SpiderModelContent.leg4up_sideway_deg); Native.Window.requestAnimationFrame += COM46_Line_value_loop; }; Native.Window.requestAnimationFrame += COM46_Line_value_loop; #endregion #region Connect page.Connect.onclick += delegate { SpiderModelContent.t_fix = 0; "Connect".ToDocumentTitle(); SpiderModelContent.po = 0;; service.AtFocus(); }; #endregion #region Disconnect page.Disconnect.onclick += delegate { "Disconnect".ToDocumentTitle(); SpiderModelContent.po = 0;; service.AtBlur(); }; #endregion Action poll = null; poll = delegate { delay.StartTimeout(400); // Send data from JavaScript to the server tier service.WebMethod2( "" + SpiderModelContent.po, COM46_Line => { Native.Document.body.style.cursor = IStyle.CursorEnum.@default; delay.Stop(); COM46_Line_value = COM46_Line.Replace("\t", "\n"); // jsc: why string.split with each not working?? var a = COM46_Line.Split(';'); byte RightLR_value = 0; byte LeftLR_value = 0; var t = 0f; #region parse RightLR, LeftLS, LeftIR, RightIR for (int i = 0; i < a.Length; i++) { var u = a[i]; u.TakeUntilOrEmpty(":").Trim().With( key => { var _value = u.SkipUntilOrEmpty(":").Trim(); // 1024 is dark #region RightLR if (key == "RS") { var value_int32 = int.Parse(_value); var value_1024 = (1024 - Math.Min(int.Parse(_value), 1024)); // jsc: please do the masking when casting to byte yyourself, thanks :) RightLR_value = (byte)((255 * value_1024 / 1024) & 0xff); RightLR_value = (byte)Math.Min(255, RightLR_value * 2); if (RightLR_value == 255) { RightLR.style.backgroundColor = JSColor.Cyan; } else { RightLR.style.backgroundColor = JSColor.FromGray(RightLR_value); } } #endregion #region LeftLS if (key == "LS") { var value_int32 = int.Parse(_value); var value_1024 = (1024 - Math.Min(int.Parse(_value), 1024)); // jsc: please do the masking when casting to byte yyourself, thanks :) LeftLR_value = (byte)((255 * value_1024 / 1024) & 0xff); LeftLR_value = (byte)Math.Min(255, LeftLR_value * 2); //LeftLR.innerText = "" + ivalue; if (LeftLR_value == 255) { LeftLR.style.backgroundColor = JSColor.Cyan; } else { LeftLR.style.backgroundColor = JSColor.FromGray(LeftLR_value); } } #endregion #region LeftIR if (key == "LI") { var value_int32 = int.Parse(_value); if (value_int32 > 400) { LeftIR.style.backgroundColor = JSColor.Red; } else if (value_int32 > 200) { LeftIR.style.backgroundColor = JSColor.Yellow; } else { LeftIR.style.backgroundColor = JSColor.Green; } LeftIR.style.height = value_int32 + "px"; SpiderModelContent.tween_red_obstacle_L_y((1 - value_int32 / 600) * 24); } #endregion #region RightIR if (key == "RI") { var value_int32 = int.Parse(_value); if (value_int32 > 400) { RightIR.style.backgroundColor = JSColor.Red; } else if (value_int32 > 200) { RightIR.style.backgroundColor = JSColor.Yellow; } else { RightIR.style.backgroundColor = JSColor.Green; } RightIR.style.height = value_int32 + "px"; SpiderModelContent.tween_red_obstacle_R_y((1 - value_int32 / 600) * 24); } #endregion if (key == "t") { t = (float)double.Parse(_value); } if (key == "pp") { SpiderModelContent.p = int.Parse(_value); } } ); } #endregion if (t != 0) { if (SpiderModelContent.t_local != 0) { if (SpiderModelContent.t_fix == 0) { SpiderModelContent.t_fix = t - SpiderModelContent.t_local; } } } // dark 70 .. 255 bright SpiderModelContent.tween_white_arrow_y( 50 * (1 - ((Math.Max(LeftLR_value, RightLR_value) - 70) / (255 - 70))) ); SpiderModelContent.tween_white_arrow_x( (LeftLR_value - 60) * -20f / (255 - 60) + (RightLR_value - 60) * 20f / (255 - 60) ); #region next new Timer( delegate { Native.Window.requestAnimationFrame += poll; } ).StartTimeout(UpdateSpeed); #endregion } ); page.FastUpdates.onclick += delegate { UpdateSpeed = 50; }; page.SlowUpdates.onclick += delegate { UpdateSpeed = 500; }; }; Native.Window.requestAnimationFrame += poll; }
// ScriptCoreLib.JavaScript.DOM.IStyleSheet.get_all // :8939/view-source:50114 1792ms ItemGroupReferenes... //2015-03-10 10:30:46.599 :8939/view-source:120275 Uncaught TypeError: Cannot read property '_4ggABg6gjTWKCO_aNXgMMAA' of null //// ScriptCoreLib.Ultra.Studio.SolutionFileComment.WriteTo //type$mg7i9CBGlTCpHMdiX219pQ.sgEABiBGlTCpHMdiX219pQ = function(b, c, d) //{ // var a = [this], e, f, g, h; // e = a[0].IsActiveFilter != null; // f = !a[0].IsActiveFilter._4ggABg6gjTWKCO_aNXgMMAA(d); /// <summary> /// This is a javascript application. /// </summary> /// <param name="page">HTML document rendered by the web server which can now be enhanced.</param> public Application(IApp page) { #region 2013 FormStyler.AtFormCreated = s => { // border> 8E9BBC // caption 4D6082 s.TargetOuterBorder.style.boxShadow = "rgba(0, 0, 0, 0.2) 0px 0px 6px 0px"; s.TargetOuterBorder.style.borderColor = JSColor.FromRGB(142, 155, 188); s.TargetInnerBorder.style.borderWidth = "0px"; s.CloseButton.style.color = JSColor.FromRGB(206, 212, 221); 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.Caption.style.backgroundColor = JSColor.FromRGB(77, 96, 130); s.CaptionShadow.style.backgroundColor = JSColor.FromRGB(77, 96, 130); }; #endregion //--------------------------- //Microsoft Visual Studio Express 2012 for Windows Desktop //--------------------------- //An exception has been encountered. This may be caused by an extension. //You can get more information by examining the file 'C:\Users\Arvo\AppData\Roaming\Microsoft\WDExpress\11.0\ActivityLog.xml'. //--------------------------- //OK //--------------------------- #if FEATURE_CHROME #region ChromeTCPServer dynamic self = Native.self; dynamic self_chrome = self.chrome; if (null != (object)self_chrome) { object self_chrome_socket = self_chrome.socket; if (self_chrome_socket != null) { chrome.Notification.DefaultIconUrl = new HTML.Images.FromAssets.Preview().src; chrome.Notification.DefaultTitle = "TestSolutionBuilderV1"; ChromeTCPServer.TheServerWithStyledForm.Invoke( AppSource.Text, AtFormCreated: s => { // border> 8E9BBC // caption 41 s.TargetOuterBorder.style.boxShadow = "rgba(0, 0, 0, 0.2) 0px 0px 6px 0px"; s.TargetOuterBorder.style.borderColor = JSColor.FromRGB(12, 32, 45); 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.Caption.style.backgroundColor = JSColor.FromRGB(41, 57, 85); s.CaptionShadow.style.backgroundColor = JSColor.FromRGB(41, 57, 85); } ); return; } } #endregion #endif //page.Content = new StudioView(null).Content; new StudioView(null).Content.AttachToDocument(); }
//public readonly ApplicationWebService service = new ApplicationWebService(); /// <summary> /// This is a javascript application. /// </summary> /// <param name="page">HTML document rendered by the web server which can now be enhanced.</param> public Application(IDefault page) { // Unhandled Exception: System.InvalidOperationException: Method: get_InternalSiblingsIncludingThis, // Type: ScriptCoreLib.JavaScript.BCLImplementation.System.Windows.Forms.__Control; emmiting failed : System.Exception: recursion detected at stack 32 #region AtFormCreated FormStyler.AtFormCreated = s => { // now shadow s.TargetOuterBorder.style.boxShadow = ""; //s.TargetOuterBorder.style.borderColor = JSColor.FromRGB(0, 122, 0); //toolbar_color = Color.FromRGB(0, 0x80, 0) Toolbar.JavaScript.Extensions.SetDialogColor( s.TargetOuterBorder, ScriptCoreLib.Shared.Drawing.Color.FromRGB(0, 0x80, 0), true ); s.TargetInnerBorder.style.borderWidth = "0px"; s.TargetInnerBorder.style.backgroundColor = JSColor.None; s.CloseButton.style.color = JSColor.FromRGB(0, 80, 0); 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"; // browser popup will use this color ((__Form)s.Context).HTMLTargetContainerRef.style.backgroundColor = JSColor.FromRGB(0, 0x80, 0); s.Caption.style.backgroundColor = JSColor.None; //FormStyler.LikeVisualStudioMetro(s); }; #endregion #region TheServer dynamic self = Native.self; dynamic self_chrome = self.chrome; object self_chrome_socket = self_chrome.socket; if (self_chrome_socket != null) { FormStyler.AtFormCreated = s => { s.Context.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; //var x = new ChromeTCPServerWithFrameNone.HTML.Pages.AppWindowDrag().AttachTo(s.Context.GetHTMLTarget()); var x = new ChromeTCPServerWithFrameNone.HTML.Pages.AppWindowDragWithShadow().AttachTo(s.Context.GetHTMLTarget()); }; chrome.Notification.DefaultTitle = "IsometricTycoonViewWithToolbar"; ChromeTCPServer.TheServerWithStyledForm.Invoke( DefaultSource.Text, AtFormCreated: FormStyler.AtFormCreated ); return; } #endregion //global::DiagnosticsConsole.ApplicationContent.BindKeyboardToDiagnosticsConsole(); new gong().AttachToDocument().play(); new ThreeDStuff.js.Tycoon4(); }
public __Form() { Console.WriteLine("event: enter new " + this.GetType().Name + "()"); //IStyleSheet.all.disabled = true; this.InternalTrackInitializeComponents = delegate { ConstructorStopwatch.Stop(); // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2014/201402/20140205 // will this help us? no? //IStyleSheet.all.disabled = false; //Console.WriteLine("event: new " + new { this.GetType().Name } + " InternalResumeLayout " + new { ConstructorStopwatch.ElapsedMilliseconds }); Console.WriteLine("event: new " + this.GetType().Name + "() " + new { ConstructorStopwatch.ElapsedMilliseconds }); //474ms new { Name = FooActivity } InternalResumeLayout { ElapsedMilliseconds = 464 } new XAttribute( "ConstructorStopwatch", new { ConstructorStopwatch.ElapsedMilliseconds }.ToString() ).AttachTo(this.HTMLTargetRef); }; //25:584ms event: exit DataGridView .ctor { ElapsedMilliseconds = 525 } view-source:35983 //48:1043ms event: exit DataGridView .ctor { ElapsedMilliseconds = 445 } view-source:35983 //95:1509ms event: exit DataGridView .ctor { ElapsedMilliseconds = 420 } view-source:35983 //96:1713ms at FlowLayoutPanel InternalResumeLayout { ElapsedMilliseconds = 628, Name = flowLayoutPanel1, Controls = 2 } view-source:35955 //97:1724ms at FlowLayoutPanel InternalResumeLayout { ElapsedMilliseconds = 1674, Name = flowLayoutPanel1, Controls = 9 } view-source:35955 //97:1724ms at FlowLayoutPanel InternalResumeLayout { ElapsedMilliseconds = 1137, Name = flowLayoutPanel2, Controls = 3 } view-source:35996 //97:1724ms at FlowLayoutPanel InternalResumeLayout { ElapsedMilliseconds = 1128, Name = flowLayoutPanel3, Controls = 1 } view-source:35996 //97:1724ms event: new FooActivity() { ElapsedMilliseconds = 1706 } this.StartPosition = FormStartPosition.CenterScreen; var TargetElement = new IHTMLDiv { // do this ahead of time // type inheritance? className = typeof(Form).Name + " " + this.GetType().Name }; // thanks host, but we do our own resizers // http://stackoverflow.com/questions/13224184/css-resize-handles-with-resize-both-property // http://www.w3schools.com/cssref/css3_pr_resize.asp //TargetElement.style.resize = "none !important"; TargetElement.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute; TargetElement.style.left = "0px"; TargetElement.style.top = "0px"; HTMLTarget = TargetElement; // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2013/201312/20131222-form outer_css = TargetElement.css; #region TargetOuterBorder TargetOuterBorder = new IHTMLDiv().AttachTo(TargetElement); //HTMLTarget.style.backgroundColor = Shared.Drawing.Color.System.ThreeDFace; TargetOuterBorder.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute; TargetOuterBorder.style.left = "0px"; TargetOuterBorder.style.top = "0px"; TargetOuterBorder.style.bottom = "0px"; TargetOuterBorder.style.right = "0px"; TargetOuterBorder.style.borderWidth = "1px"; TargetOuterBorder.style.borderStyle = "solid"; TargetOuterBorder.style.borderBottomColor = "#424142"; TargetOuterBorder.style.borderRightColor = "#424142"; TargetOuterBorder.style.borderLeftColor = "#D6D3CE"; TargetOuterBorder.style.borderTopColor = "#D6D3CE"; //HTMLTarget.style.SetLocation(64, 64, 100, 100); TargetOuterBorder.style.padding = "0"; #endregion #region TargetInnerBorder var TargetInnerBorder = new IHTMLDiv().AttachTo(TargetOuterBorder); ////HTMLTarget.style.backgroundColor = Shared.Drawing.Color.System.ThreeDFace; TargetInnerBorder.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute; TargetInnerBorder.style.left = "0px"; TargetInnerBorder.style.top = "0px"; TargetInnerBorder.style.bottom = "0px"; TargetInnerBorder.style.right = "0px"; TargetInnerBorder.style.borderWidth = "1px"; TargetInnerBorder.style.borderStyle = "solid"; TargetInnerBorder.style.borderLeftColor = "#FFFFFF"; TargetInnerBorder.style.borderTopColor = "#FFFFFF"; TargetInnerBorder.style.borderRightColor = "#848284"; TargetInnerBorder.style.borderBottomColor = "#848284"; // ? //TargetInnerBorder.style.backgroundColor = "#D6D3CE"; //HTMLTarget.style.SetLocation(64, 64, 100, 100); #endregion #region TargetResizerPadding TargetResizerPadding = new IHTMLDiv().AttachTo(TargetInnerBorder); TargetResizerPadding.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute; TargetResizerPadding.style.left = "2px"; TargetResizerPadding.style.top = "2px"; TargetResizerPadding.style.bottom = "2px"; TargetResizerPadding.style.right = "2px"; #endregion #region TargetNoBorder TargetNoBorder = new IHTMLDiv().AttachTo(TargetResizerPadding); TargetNoBorder.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute; TargetNoBorder.style.left = "0px"; TargetNoBorder.style.top = "0px"; TargetNoBorder.style.bottom = "0"; TargetNoBorder.style.right = "0"; #endregion TargetOuterBorder.style.boxShadow = "black 3px 3px 6px -3px"; #region caption //IHTMLImage icon = "assets/ScriptCoreLib.Windows.Forms/App.ico"; icon.style.SetLocation(5, 5, 16, 16); //caption.style.backgroundColor = JSColor.System.ActiveCaption; Caption.style.backgroundColor = JSColor.FromRGB(0x08, 0x24, 0x6B); Caption.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute; Caption.style.left = 0 + "px"; Caption.style.top = 0 + "px"; Caption.style.right = 0 + "px"; Caption.style.height = "26px"; Caption.style.margin = "0px"; //Caption.style.paddingTop = "6px"; //Caption.style.paddingLeft = "26px"; Caption.style.font = new Font("Segoe UI", 9.0F, FontStyle.Regular, GraphicsUnit.Point, 0).ToCssString(); CaptionShadow = (IHTMLDiv)Caption.cloneNode(false); CaptionShadow.style.backgroundColor = JSColor.Black; CaptionShadow.style.Opacity = 0; CaptionContent = new IHTMLHeader1(); CaptionContent.style.color = Shared.Drawing.Color.White; CaptionContent.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute; CaptionContent.style.left = 0 + "px"; CaptionContent.style.top = 0 + "px"; CaptionContent.style.right = 0 + "px"; CaptionContent.style.height = "26px"; CaptionContent.style.margin = "0px"; CaptionContent.style.fontSize = "1em"; CaptionContent.style.fontWeight = "100"; CaptionContent.style.backgroundColor = JSColor.None; CaptionContent.style.font = DefaultFont.ToCssString(); (CaptionContent.style as dynamic).textOverflow = "ellipsis"; //CaptionContent.style.WithDynamic( // style => style.textOverflow = "ellipsis" //); CaptionContent.style.lineHeight = "26px"; CaptionContent.style.left = "26px"; CaptionContent.style.right = "30px"; CaptionContent.style.overflow = IStyle.OverflowEnum.hidden; CaptionForeground = (IHTMLDiv)Caption.cloneNode(false); CaptionForeground.style.backgroundColor = ScriptCoreLib.Shared.Drawing.Color.FromRGB(255, 0, 255); CaptionForeground.style.Opacity = 0; CaptionForeground.className = "caption"; CaptionForeground.style.right = "26px"; // http://dojotoolkit.org/pipermail/dojo-checkins/2005-December/002867.html // new IFunction(@" // try { this.style.MozUserSelect = 'none'; } catch (e) { } // try { this.style.KhtmlUserSelect = 'none'; } catch (e) { } // try { this.unselectable = 'on'; } catch (e) { } // " // ).apply(caption_foreground); // caption_foreground.onselectstart += // (e) => // { // e.PreventDefault(); // e.StopPropagation(); // }; #endregion // http://developer.apple.com/mac/library/documentation/AppleApplications/Reference/Dashboard_Ref/Dashboard_Ref.pdf // for some reason we cannot exclude caption // from apple dashboard //caption_foreground.style.appleDashboardRegion = "none"; //container.style.backgroundColor = "#A0A0A0"; //container.style.appleDashboardRegion = "dashboard-region(control rectangle)"; #region ContentContainer //ContentContainerPadding.title = "ContentContainerPadding"; ContentContainerPadding.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute; ContentContainerPadding.style.left = 0 + "px"; ContentContainerPadding.style.top = (26 + innerborder + 0) + "px"; ContentContainerPadding.style.right = 0 + "px"; ContentContainerPadding.style.bottom = 0 + "px"; ContentContainer = new IHTMLDiv().AttachTo(ContentContainerPadding); //ContentContainer.title = "ContentContainer"; ContentContainer.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute; ContentContainer.style.left = 0 + "px"; ContentContainer.style.top = 0 + "px"; ContentContainer.style.right = 0 + "px"; ContentContainer.style.bottom = 0 + "px"; ContentContainer.style.overflow = IStyle.OverflowEnum.hidden; // is this needed? //ContentContainer.style.zIndex = 1000; var ContentContainerShadow = new IHTMLDiv().AttachTo(ContentContainerPadding); //ContentContainerShadow.title = "ContentContainerShadow"; ContentContainerShadow.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute; ContentContainerShadow.style.left = 0 + "px"; ContentContainerShadow.style.top = 0 + "px"; ContentContainerShadow.style.right = 0 + "px"; ContentContainerShadow.style.bottom = 0 + "px"; ContentContainerShadow.style.overflow = IStyle.OverflowEnum.hidden; ContentContainerShadow.style.backgroundColor = JSColor.Red; ContentContainerShadow.style.Opacity = 0.0; ContentContainerShadow.style.display = IStyle.DisplayEnum.none; ContentContainerShadow.style.zIndex = 1001; #endregion InternalMouseCapured += delegate { // is this enough to capture resizer in a chrome AppWindow? ContentContainerShadow.style.display = IStyle.DisplayEnum.block; }; InternalMouseReleased += delegate { ContentContainerShadow.style.display = IStyle.DisplayEnum.none; }; #region ResizeGripElement ResizeGripElement = new IHTMLDiv().AttachTo(ContentContainerPadding); ResizeGripElement.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute; ResizeGripElement.style.width = "12px"; ResizeGripElement.style.height = "12px"; ResizeGripElement.style.bottom = "0px"; ResizeGripElement.style.right = "0px"; ResizeGripElement.style.cursor = IStyle.CursorEnum.se_resize; new IHTMLImage { src = "assets/ScriptCoreLib.Windows.Forms/FormResizeGrip.png" }.ToBackground(ResizeGripElement); ResizeGripElement.style.zIndex = 1002; #endregion #region ResizeGripDrag ResizeGripDrag = new ScriptCoreLib.JavaScript.Controls.DragHelper(ResizeGripElement); ResizeGripDrag.Enabled = true; #region AtSizeChanged Action AtSizeChanged = delegate { var Size = this.Size; ResizeGripDrag.Position = new Shared.Drawing.Point(Size.Width, Size.Height); }; this.SizeChanged += delegate { AtSizeChanged(); }; AtSizeChanged(); #endregion ResizeGripDrag.DragStart += delegate { Capture = true; InternalMouseCapured(); }; ResizeGripDrag.DragMove += delegate { this.Size = new Size(ResizeGripDrag.Position.X, ResizeGripDrag.Position.Y); }; ResizeGripDrag.DragStop += delegate { Capture = false; InternalMouseReleased(); }; #endregion #region CloseButton InternalCloseButton = new IHTMLDiv { name = "CloseButton" }; InternalCloseButton.style.textAlign = IStyle.TextAlignEnum.center; InternalCloseButton.style.fontWeight = "bold"; //InternalCloseButton.style.cursor = IStyle.CursorEnum.@default; InternalCloseButton.style.cursor = IStyle.CursorEnum.pointer; InternalCloseButtonContent = new IHTMLDiv { }.AttachTo(InternalCloseButton); InternalCloseButtonContent.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute; InternalCloseButtonContent.style.left = "0px"; InternalCloseButtonContent.style.top = "0px"; InternalCloseButtonContent.style.bottom = "0"; InternalCloseButtonContent.style.right = "0"; InternalCloseButtonContent.title = "Close"; InternalCloseButtonContent.innerHTML = "×"; InternalCloseButton.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute; //CloseButton.style.backgroundColor = JSColor.System.ThreeDFace; InternalCloseButton.style.backgroundColor = "#D6D3CE"; InternalCloseButton.style.height = "18px"; InternalCloseButton.style.width = "18px"; InternalCloseButton.style.right = (innerborder + 3) + "px"; InternalCloseButton.style.top = (innerborder + 2) + "px"; InternalCloseButton.style.borderWidth = "1px"; InternalCloseButton.style.borderStyle = "solid"; InternalCloseButton.style.borderRightColor = "#424142"; InternalCloseButton.style.borderBottomColor = "#424142"; InternalCloseButton.style.borderLeftColor = "#FFFFFF"; InternalCloseButton.style.borderTopColor = "#FFFFFF"; InternalCloseButtonContent.style.borderWidth = "1px"; InternalCloseButtonContent.style.borderStyle = "solid"; InternalCloseButtonContent.style.borderLeftColor = "#D6D3CE"; InternalCloseButtonContent.style.borderTopColor = "#D6D3CE"; InternalCloseButtonContent.style.borderRightColor = "#848284"; InternalCloseButtonContent.style.borderBottomColor = "#848284"; #region CloseButton onclick InternalCloseButton.css.hover[IHTMLElement.HTMLElementEnum.div].style.color = "red"; //InternalCloseButton.onmouseover += // delegate // { // InternalCloseButtonContent.style.color = JSColor.Red; // }; //InternalCloseButton.onmouseout += // delegate // { // InternalCloseButtonContent.style.color = JSColor.None; // }; InternalCloseButton.onmousedown += e => { e.stopPropagation(); e.preventDefault(); }; InternalCloseButton.onclick += delegate { InternalClose(reason: CloseReason.UserClosing); }; #endregion #endregion TargetNoBorder.appendChild( ContentContainerPadding, Caption, CaptionShadow, CaptionContent, icon, CaptionForeground , InternalCloseButton ); CaptionForeground.oncontextmenu += e => { // can we show our own menu? e.preventDefault(); e.stopPropagation(); }; #region InternalCaptionDrag InternalCaptionDrag = new ScriptCoreLib.JavaScript.Controls.DragHelper(CaptionForeground); // http://forum.mootools.net/topic.php?id=534 // disable text selection // look at http://forkjavascript.com/ InternalCaptionDrag.Enabled = true; #endregion var BeforePosition = new Shared.Drawing.Point(0, 0); var FirstMove = false; var AnyMove = false; var DragStartMaximized = false; var DragStartMaximizedY = 0; this.MaximizeBox = true; this.InternalControlBox = true; #region DragStart InternalCaptionDrag.DragStartValidate += e => { // if there is no max, then there is no restore. then do not allow to // drag back either e.Value = this.MaximizeBox; }; InternalCaptionDrag.DragStart += delegate { TargetNoBorder.style.cursor = IStyle.CursorEnum.move; CaptionForeground.style.cursor = IStyle.CursorEnum.move; Native.Document.body.style.cursor = IStyle.CursorEnum.move; BeforePosition = InternalCaptionDrag.Position; FirstMove = true; DragStartMaximized = this.WindowState == FormWindowState.Maximized; //if (DragStartMaximized) // DragStartMaximizedY = this.InternalRestoreLocation.Y; // offsetWidth: 1045 //Console.WriteLine(new { BeforePosition, DragStartMaximized }); Capture = true; InternalMouseCapured(); }; #endregion #region WindowState Action InternalEnterFullscreen = delegate { Console.WriteLine("InternalEnterFullscreen WindowState <- Maximized"); this.WindowState = FormWindowState.Maximized; }; Action InternalExitFullscreen = delegate { Console.WriteLine("InternalExitFullscreen WindowState <- Normal"); this.WindowState = FormWindowState.Normal; }; #endregion #region DragMove InternalCaptionDrag.DragMove += delegate { if (!Capture) { return; } //Console.WriteLine(new { InternalCaptionDrag.Position, BeforePosition, DragStartMaximized }); // { Position = [192, 205.5], BeforePosition = [192, 205.5], DragStartMaximized = true } if (InternalCaptionDrag.Position.X == BeforePosition.X) { if (InternalCaptionDrag.Position.Y == BeforePosition.Y) { //Console.WriteLine("FirstMove without move"); return; } } // { InternalHostHeight = 0, y = 301 } //var MinimizeY = InternalHostHeight - 26; var y = InternalCaptionDrag.Position.Y; //Console.WriteLine(new { InternalHostHeight, y }); //y = Math.Min(MinimizeY, Math.Max(-4, y)); y = Math.Max(-4, y); if (FirstMove) { FirstMove = false; if (this.WindowState == FormWindowState.Maximized) { //Capture = false; //this.InternalRestoreLocation = new Point(InternalCaptionDrag.Position.X, y); // we have a small glitch here Console.WriteLine("InternalCaptionDrag.DragMove FirstMove " + new { this.InternalRestoreLocation }); InternalExitFullscreen(); //return; } } AnyMove = true; //if (Native.Document.fullscreenElement == TargetNoBorder) this.Location = new Point(InternalCaptionDrag.Position.X, y); //Console.WriteLine(new { Location }); if (y < 0) { CaptionShadow.Show(); } //else //{ // if (y < MinimizeY) // CaptionShadow.Hide(); // else // CaptionShadow.Show(); //} }; #endregion #region DragStop InternalCaptionDrag.DragStop += delegate { if (!Capture) { return; } Capture = false; InternalMouseReleased(); if (!AnyMove) { return; } // tested by // X:\jsc.svn\examples\javascript\MatrixTransformBExample\MatrixTransformBExperiment\Application.cs //var Location = this.Location; //this.Text = new { drag.Position.X, drag.Position.Y }.ToString(); TargetNoBorder.style.cursor = IStyle.CursorEnum.@default; CaptionForeground.style.cursor = IStyle.CursorEnum.@default; Native.document.body.style.cursor = IStyle.CursorEnum.@default; //var MinimizeY = InternalHostHeight - 26; var y = InternalCaptionDrag.Position.Y; //if (this.HTMLTarget.parentNode != Native.document.body) //{ // // this window is in a nested element, or even in another window. // // bail! // return; //} if (y < 0) { InternalCaptionDrag.Position = BeforePosition; InternalEnterFullscreen(); this.InternalRestoreLocation = new Point(BeforePosition.X, BeforePosition.Y); } //else if (y >= MinimizeY) //{ // if (this.WindowState != FormWindowState.Minimized) // { // // do we need this? // var cs = this.ClientSize; // var ll = this.Location; // //drag.Position = BeforePosition; // //this.Location = new Point(BeforePosition.X, BeforePosition.Y); // this.WindowState = FormWindowState.Minimized; // //this.InternalRestoreClientSIze = cs; // this.InternalRestoreLocation = ll; // } //} else { //Console.WriteLine("to Normal ? " + new { this.WindowState }); if (this.WindowState == FormWindowState.Minimized) { var cs = this.ClientSize; var ll = this.Location; this.WindowState = FormWindowState.Normal; //this.ClientSize = cs; this.Location = ll; } } }; #endregion #region MiddleClick InternalCaptionDrag.MiddleClick += delegate { Capture = false; if (!this.MaximizeBox) { // X:\jsc.svn\examples\javascript\forms\FormsWithVisibleTitle\FormsWithVisibleTitle\Application.cs // not supposed to restore return; } if (this.WindowState == FormWindowState.Minimized) { this.WindowState = FormWindowState.Normal; return; } if (this.WindowState == FormWindowState.Maximized) { Console.WriteLine("InternalCaptionDrag.MiddleClick InternalExitFullscreen"); InternalExitFullscreen(); } else { Console.WriteLine("InternalCaptionDrag.MiddleClick InternalEnterFullscreen"); InternalEnterFullscreen(); } }; #endregion #region ondblclick CaptionForeground.ondblclick += delegate { Capture = false; if (!this.MaximizeBox) { // X:\jsc.svn\examples\javascript\forms\FormsWithVisibleTitle\FormsWithVisibleTitle\Application.cs // not supposed to restore return; } if (this.WindowState == FormWindowState.Minimized) { this.WindowState = FormWindowState.Normal; return; } if (this.WindowState == FormWindowState.Maximized) { InternalExitFullscreen(); } else { InternalEnterFullscreen(); } }; #endregion // to be replaiced with #shadow-root content select? this.InternalStyler = new FormStyler { Context = this, Caption = Caption, CaptionContent = CaptionContent, CaptionShadow = CaptionShadow, CloseButton = InternalCloseButton, CloseButtonContent = InternalCloseButtonContent, TargetInnerBorder = TargetInnerBorder, TargetOuterBorder = TargetOuterBorder, ContentContainerPadding = ContentContainerPadding, TargetResizerPadding = TargetResizerPadding }; //HTMLTarget.style.backgroundColor = "#B0B0B0"; this.BackColor = Color.FromArgb(0xD6, 0xD3, 0xCE); this.Size = new Size(400, 400); FormStyler.RaiseAtFormCreated( this.InternalStyler ); //this.ControlAdded += // (sender, args) => // { // if (InternalTrackInitializeComponents) // { // // report what controls are being added and // Console.WriteLine("at Form ControlAdded " + new // { // ConstructorStopwatch.ElapsedMilliseconds, // Control = args.Control.GetType().Name, // this.GetType().Name // }); // } // }; //312ms at Form InternalResumeLayout { FormConstructorStopwatch = 0.00:00:00, Name = FooActivity } //Console.WriteLine("exit Form .ctor " + new { ConstructorStopwatch.ElapsedMilliseconds, this.GetType().Name }); }