// reference: // http://apike.ca/prog_svg_basic.html // http://apike.ca/prog_svg_shapes.html // http://www.milescript.org/graphicsdemo.html // http://canarlake.org/index.cgi?theme=svg // http://srufaculty.sru.edu/david.dailey/svg/SVGAnimations.htm // http://srufaculty.sru.edu/david.dailey/svg/svg_questions.htm // http://www.w3.org/TR/2000/CR-SVG-20001102/masking.html#ObjectAndGroupOpacityProperties // http://jmvidal.cse.sc.edu/talks/canvassvg/gradient.xml?style=White // http://www.treebuilder.de/default.asp?file=163540.xml // http://www.ibm.com/developerworks/library/x-svgint/ // http://starkravingfinkle.org/projects/richdraw/richdraw_demo.htm // http://www.dynamicdrive.com/dynamicindex11/editor.htm // http://draw.labs.autodesk.com/ADDraw/draw.html // http://yeonisalive.net/javascript/MindWeb001.php public VectorExample() { Native.Document.body.style.backgroundColor = Color.System.ThreeDFace; "h2".AttachToDocument().innerText = "svg + vml example"; #region CreateButton Func<Action, string, IHTMLButton> CreateButton = (h, text) => { var btn = new IHTMLButton(text); btn.AttachToDocument(); Action onclick = delegate { h(); btn.Dispose(); }; btn.onclick += delegate { // onclick(); try { onclick(); } catch (Exception ex) { btn.style.color = Color.Red; btn.innerText = "error: " + ex.Message; } }; return btn; }; #endregion var b1 = CreateButton(Test1, "svg hello world"); b1.disabled = !ISVGElementBase.Settings.IsSupported; var b2 = CreateButton(Test2, "svg advanced"); b2.disabled = !ISVGElementBase.Settings.IsSupported; var b3 = CreateButton(Test3, "vml (IE) hello world"); b3.disabled = !IVMLElementBase.Settings.IsSupported; CreateButton( delegate { b1.disabled = false; b2.disabled = false; b3.disabled = false; } , "Override detection"); }
/// <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) { var button = new IHTMLButton(); button.innerText = "Click me"; button.WhenClicked(async b => { //Native.document.documentElement.style.cursor = IStyle.CursorEnum.wait; Native.document.documentElement.style.cursor = IStyle.CursorEnum.progress; await WebMethod2(); Native.document.documentElement.style.cursor = IStyle.CursorEnum.auto; }); button.AttachToDocument(); }
/// <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) { var button = new IHTMLButton(); button.innerText = "Click me"; button.WhenClicked(async b => { //Native.document.documentElement.style.cursor = IStyle.CursorEnum.wait; Native.document.documentElement.style.cursor = IStyle.CursorEnum.progress; await WebMethod2(); Native.document.documentElement.style.cursor = IStyle.CursorEnum.auto; }); button.AttachToDocument(); }
/// <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) { var b = new IHTMLButton { innerText = "Button"}; b.AttachToDocument(); page.datepicker.onchange += delegate { DateTime d = page.datepicker; new IHTMLPre { innerText = d.ToString() }.AttachToDocument(); }; b.onclick += delegate { DateTime d = page.datepicker; new IHTMLPre { innerText = d.ToString() }.AttachToDocument(); }; }
/// <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) { var b = new IHTMLButton { innerText = "Button" }; b.AttachToDocument(); page.datepicker.onchange += delegate { DateTime d = page.datepicker; new IHTMLPre { innerText = d.ToString() }.AttachToDocument(); }; b.onclick += delegate { DateTime d = page.datepicker; new IHTMLPre { innerText = d.ToString() }.AttachToDocument(); }; }
/// <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) { that = this; this.page = page; Native.window.localStorage["poison"] = "1"; page.Login.Historic( async scope => { var button = new IHTMLButton { innerText = "Login" }; if (that.cookie.BooleanValue == false) { that.page.Login.style.borderLeft = "1em solid red"; //that.page.Login.innerText = "Home"; button.AttachToDocument(); button.onclick += delegate { that.page.Login.style.borderLeft = "1em solid green"; that.cookie.BooleanValue = true; button.disabled = true; }; } else { that.page.Login.style.borderLeft = "1em solid green"; } await scope; button.Orphanize(); that.page.Login.style.borderLeft = ""; } ); page.View1.Historic( async scope => { if (that.cookie.BooleanValue == false) { that.page.View1.style.borderLeft = "1em solid red"; } else { that.page.View1.style.borderLeft = "1em solid green"; } await scope; that.page.View1.style.borderLeft = ""; } ); page.View2.Historic( async scope => { if (that.cookie.BooleanValue == false) { that.page.View2.style.borderLeft = "1em solid red"; } else { that.page.View2.style.borderLeft = "1em solid green"; } await scope; that.page.View2.style.borderLeft = ""; } ); page.Logout.Historic( async scope => { that.page.Logout.style.borderLeft = "1em solid red"; that.cookie.BooleanValue = false; await scope; that.page.Logout.style.borderLeft = ""; } ); }
/// <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) { // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2013/201308/20130826-domainmemory // see also: x:\jsc.svn\examples\javascript\Test\TestThreadStart\TestThreadStart\Application.cs var counter = 0; var btn = new IHTMLButton { innerText = "spawn new thread" }; Native.window.onframe += delegate { btn.innerText = "spawn new thread" + new { loc0 }; }; btn.AttachToDocument().WhenClicked( delegate { counter++; Console.WriteLine(new { loc0, Thread.CurrentThread.ManagedThreadId }); loc0 = "click " + new { counter }; //Thread.CurrentContext.DoCallBack( // delegate // { // // now what? // } //); //new Task().run new Worker( worker => { Console.WriteLine("should not send changes!"); loc0 = loc0; Console.WriteLine("should not send changes?"); // should a trigger see that we changed a static field? loc0 += ", working..."; Console.WriteLine(new { loc0, Thread.CurrentThread.ManagedThreadId }); var s = new Stopwatch(); s.Start(); // spin the cpu // how long do we have to, in order for task manager to notice? // this should keep one cpu utilized atleast at 70% for (int i = 0; i < 5; i++) { var xs = new Stopwatch(); xs.Start(); while (xs.ElapsedMilliseconds < 1000) ; Console.WriteLine("."); loc0 += " " + new { i }; } Console.WriteLine("working ... done " + new { s.Elapsed, Thread.CurrentThread.ManagedThreadId }); loc0 += " done!"; worker.postMessage("done!"); //worker.close(); } ).onmessage += e => { Console.WriteLine("onmessage: " + e.data); }; } ); }
// asus has 2015 that works? /// <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) { // http://www.sitepoint.com/using-fourier-transforms-web-audio-api/ new { }.With( async delegate { var start = new IHTMLButton { "connect" }; var stop = new IHTMLButton { "disconnect" }; var a = new AudioContext(); var o = a.createOscillator(); o.start(0); o.frequency.value = 440; o.type = OscillatorType.sawtooth; o.frequency.valueInput = new IHTMLInput { type = ScriptCoreLib.Shared.HTMLInputTypeEnum.range, min = 1, max = 2000 }.AttachToDocument(); new IHTMLLabel { () => $"frequency: { o.frequency.value }Hz" + $" type: { o.type }" }.AttachToDocument(); //.onchange += // eee => // { // var i = ((IHTMLInput)eee.Element); // o.frequency.value = i.valueAsNumber; // }; new IHTMLHorizontalRule { }.AttachToDocument(); new IHTMLButton { nameof(OscillatorType.sawtooth) }.AttachToDocument().onclick += delegate { o.type = OscillatorType.sawtooth; }; new IHTMLButton { nameof(OscillatorType.sine) }.AttachToDocument().onclick += delegate { o.type = OscillatorType.sine; }; new IHTMLButton { nameof(OscillatorType.square) }.AttachToDocument().onclick += delegate { o.type = OscillatorType.square; }; new IHTMLButton { nameof(OscillatorType.triangle) }.AttachToDocument().onclick += delegate { o.type = OscillatorType.triangle; }; new IHTMLHorizontalRule { }.AttachToDocument(); //s.Add() new IHTMLButton { "Beep()" }.AttachToDocument().onclick += async delegate { //Console.Beep(frequency: 400, duration: 300); o.frequency.value = 400; o.type = OscillatorType.square; o.connect(o.context.destination); await Task.Delay(300); o.disconnect(); }; new IHTMLButton { "Console.Beep()" }.AttachToDocument().onclick += delegate { Console.Beep(); //Console.Beep(frequency: 400, duration: 300); }; new IHTMLButton { () => $"Console.Beep({ o.frequency.value }Hz, 300)" }.AttachToDocument().onclick += delegate { Console.Beep(frequency: (int)o.frequency.value, duration: 300); }; retry: var ee = await start.AttachToDocument().async.onclick; start.Orphanize(); o.connect(a.destination); var e = await stop.AttachToDocument().async.onclick; stop.Orphanize(); o.disconnect(); goto retry; } ); }
/// <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) { @"Hello world".ToDocumentTitle(); var output = new IHTMLTextArea().AttachToDocument(); var gexf = new XElement("gexf"); gexf.Add( new XElement("meta", new XElement("creator", "jsc"), new XElement("description", "NASDAQSNA") ) ); var graph = new XElement("graph", new XAttribute("mode", "static"), new XAttribute("defaultedgetype", "directed") ); gexf.Add(graph); var nodes = new XElement("nodes"); graph.Add(nodes); var edges = new XElement("edges"); graph.Add(edges); output.value = gexf.ToString(); output.onfocus += delegate { output.value = gexf.ToString(); }; output.onmouseover += delegate { output.value = gexf.ToString(); }; var NumericNodeIdLookup = new List<string>(); Func<string, int> GetNumericNodeId = k => { if (!NumericNodeIdLookup.Contains(k)) NumericNodeIdLookup.Add(k); return NumericNodeIdLookup.IndexOf(k); }; #region AddRelatedCompanies Func<IHTMLDiv, string, Action, Task> AddRelatedCompanies = null; AddRelatedCompanies = (c, qid, done) => { var nqid = GetNumericNodeId(qid).ToString(); var cc = new IHTMLDiv(); cc.style.marginLeft = "2em"; var service = new ApplicationWebService { qid = qid, yield = (id, CompanyName, Price) => { var nid = GetNumericNodeId(id).ToString(); if (nodes.Elements().Any(k => k.Attribute("id").Name.LocalName == nid)) { } else { nodes.Add( new XElement("node", new XAttribute("id", nid), new XAttribute("label", CompanyName) ) ); } var btn = new IHTMLButton { innerText = id + " " + CompanyName + " " + Price }; btn.style.display = IStyle.DisplayEnum.block; if (qid == id) { btn.disabled = true; if (c == null) { btn.AttachToDocument(); cc.AttachToDocument(); } else { //btn.AttachTo(c); cc.AttachTo(c); } if (done != null) done(); } else { edges.Add( new XElement("edge", new XAttribute("source", nqid), new XAttribute("target", nid) ) ); btn.AttachTo(cc); var ccc = new IHTMLDiv(); ccc.AttachTo(cc); int cx = 0; ccc.ToggleVisible(); btn.WhenClicked( async delegate { if (cx == 0) { btn.style.color = JSColor.Red; await AddRelatedCompanies(ccc, id, delegate { btn.style.color = JSColor.Blue; } ); } cx++; ccc.ToggleVisible(); } ); } } }; return service.GetRelatedCompanies(); }; #endregion AddRelatedCompanies(null, "NASDAQ:FB", null); AddRelatedCompanies(null, "NASDAQ:GOOG", null); }
/// <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 r = new Random(); var id = "" + r.Next(); var x = r.Next(400); var y = r.Next(400); var btn = new IHTMLButton { innerText = "this is id " + id + " at " + x + ", " + y }; btn.AttachToDocument(); btn.style.SetLocation(x, y); btn.onclick += delegate { btn.disabled = true; service.UpdateLobby(id, x + "", y + "", delegate { btn.disabled = false; } ); }; page.ClearLobby.onclick += delegate { page.ClearLobby.disabled = true; service.ClearLobby( delegate { page.ClearLobby.disabled = false; } ); }; var a = new List<IHTMLButton>(); page.RefreshLobby.onclick += delegate { a.WithEach( k => { k.Orphanize(); } ); a.Clear(); page.RefreshLobby.disabled = true; service.EnumerateLobby( (_id, _x, _y) => { if (_id == "") { page.RefreshLobby.disabled = false; return; } if (_id == id) return; var shadow = new IHTMLButton { innerText = "id " + _id + " at " + _x + ", " + _y }; shadow.AttachToDocument(); shadow.style.SetLocation(Convert.ToInt32(_x), Convert.ToInt32(_y)); a.Add(shadow); } ); }; @"Hello world".ToDocumentTitle(); // Send data from JavaScript to the server tier service.WebMethod2( @"A string from JavaScript.", value => value.ToDocumentTitle() ); }
public MatrixTransformCExample() { var btn = new IHTMLButton("+"); { var r = new XRectangle(); r.Element.style.SetLocation(400, 50); r.Content.style.SetSize(400, 100); r.Element.style.Opacity = 0.3; } { var r = new XRectangle { Text = "center" }; r.Element.style.SetLocation(400, 50); r.Content.style.SetSize(400, 100); var angle = 22; // rotate at top left r.ApplyMatrix(0, 0, angle.DegreesToRadians(), 0, 0); btn.onclick += delegate { angle += 5; r.ApplyMatrix(0, 0, angle.DegreesToRadians(), 0, 0); }; } { var r = new XRectangle { Text = "center offset to left" }; r.Element.style.SetLocation(400, 50); r.Content.style.SetSize(400, 100); r.Content.style.backgroundColor = "blue"; var angle = 22; // rotate at top left r.ApplyMatrix(0, 0, angle.DegreesToRadians(), -400, 0); btn.onclick += delegate { angle += 5; r.ApplyMatrix(0, 0, angle.DegreesToRadians(), -400, 0); }; } { var r = new XRectangle(); r.Element.style.SetLocation(400, 200); r.Content.style.SetSize(400, 100); r.Element.style.Opacity = 0.3; } { var r = new XRectangle { Text = "left top" }; r.Element.style.SetLocation(400, 200); r.Content.style.SetSize(400, 100); var angle = 22; // rotate at center r.ApplyMatrix(-200, -50, angle.DegreesToRadians(), 0, 0); btn.onclick += delegate { angle += 5; r.ApplyMatrix(-200, -50, angle.DegreesToRadians(), 0, 0); }; } { var r = new XRectangle(); r.Element.style.SetLocation(400, 550); r.Content.style.SetSize(400, 100); r.Element.style.Opacity = 0.3; } { var r = new XRectangle { Text = "right bottom" }; r.Element.style.SetLocation(400, 550); r.Content.style.SetSize(400, 100); var angle = 22; // rotate at center r.ApplyMatrix(200, 50, angle.DegreesToRadians(), 0, 0); btn.onclick += delegate { angle += 5; r.ApplyMatrix(200, 50, angle.DegreesToRadians(), 0, 0); }; } { var r = new XRectangle { Text = "right bottom offset right" }; r.Content.style.backgroundColor = "blue"; r.Element.style.SetLocation(400, 550); r.Content.style.SetSize(400, 100); var angle = 22; // rotate at center r.ApplyMatrix(200, 50, angle.DegreesToRadians(), 400, 0); btn.onclick += delegate { angle += 5; r.ApplyMatrix(200, 50, angle.DegreesToRadians(), 400, 0); }; } btn.AttachToDocument(); btn.style.SetLocation(32, 32); }
public MatrixTransformCExample() { var btn = new IHTMLButton("+"); { var r = new XRectangle(); r.Element.style.SetLocation(400, 50); r.Content.style.SetSize(400, 100); r.Element.style.Opacity = 0.3; } { var r = new XRectangle { Text = "center" }; r.Element.style.SetLocation(400, 50); r.Content.style.SetSize(400, 100); var angle = 22; // rotate at top left r.ApplyMatrix(0, 0, angle.DegreesToRadians(), 0, 0); btn.onclick += delegate { angle += 5; r.ApplyMatrix(0, 0, angle.DegreesToRadians(), 0, 0); }; } { var r = new XRectangle { Text = "center offset to left" }; r.Element.style.SetLocation(400, 50); r.Content.style.SetSize(400, 100); r.Content.style.backgroundColor = "blue"; var angle = 22; // rotate at top left r.ApplyMatrix(0, 0, angle.DegreesToRadians(), -400, 0); btn.onclick += delegate { angle += 5; r.ApplyMatrix(0, 0, angle.DegreesToRadians(), -400, 0); }; } { var r = new XRectangle(); r.Element.style.SetLocation(400, 200); r.Content.style.SetSize(400, 100); r.Element.style.Opacity = 0.3; } { var r = new XRectangle { Text = "left top" }; r.Element.style.SetLocation(400, 200); r.Content.style.SetSize(400, 100); var angle = 22; // rotate at center r.ApplyMatrix(-200, -50, angle.DegreesToRadians(), 0, 0); btn.onclick += delegate { angle += 5; r.ApplyMatrix(-200, -50, angle.DegreesToRadians(), 0, 0); }; } { var r = new XRectangle(); r.Element.style.SetLocation(400, 550); r.Content.style.SetSize(400, 100); r.Element.style.Opacity = 0.3; } { var r = new XRectangle { Text = "right bottom" }; r.Element.style.SetLocation(400, 550); r.Content.style.SetSize(400, 100); var angle = 22; // rotate at center r.ApplyMatrix(200, 50, angle.DegreesToRadians(), 0, 0); btn.onclick += delegate { angle += 5; r.ApplyMatrix(200, 50, angle.DegreesToRadians(), 0, 0); }; } { var r = new XRectangle { Text = "right bottom offset right" }; r.Content.style.backgroundColor = "blue"; r.Element.style.SetLocation(400, 550); r.Content.style.SetSize(400, 100); var angle = 22; // rotate at center r.ApplyMatrix(200, 50, angle.DegreesToRadians(), 400, 0); btn.onclick += delegate { angle += 5; r.ApplyMatrix(200, 50, angle.DegreesToRadians(), 400, 0); }; } btn.AttachToDocument(); btn.style.SetLocation(32, 32); }
/// <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) { that = this; this.page = page; Native.window.localStorage["poison"] = "1"; page.Login.Historic( async scope => { var button = new IHTMLButton { innerText = "Login" }; if (that.cookie.BooleanValue == false) { that.page.Login.style.borderLeft = "1em solid red"; //that.page.Login.innerText = "Home"; button.AttachToDocument(); button.onclick += delegate { that.page.Login.style.borderLeft = "1em solid green"; that.cookie.BooleanValue = true; button.disabled = true; }; } else { that.page.Login.style.borderLeft = "1em solid green"; } await scope; button.Orphanize(); that.page.Login.style.borderLeft = ""; } ); page.View1.Historic( async scope => { if (that.cookie.BooleanValue == false) { that.page.View1.style.borderLeft = "1em solid red"; } else { that.page.View1.style.borderLeft = "1em solid green"; } await scope; that.page.View1.style.borderLeft = ""; } ); page.View2.Historic( async scope => { if (that.cookie.BooleanValue == false) { that.page.View2.style.borderLeft = "1em solid red"; } else { that.page.View2.style.borderLeft = "1em solid green"; } await scope; that.page.View2.style.borderLeft = ""; } ); page.Logout.Historic( async scope => { that.page.Logout.style.borderLeft = "1em solid red"; that.cookie.BooleanValue = false; await scope; that.page.Logout.style.borderLeft = ""; } ); }
/// <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) { @"Hello world".ToDocumentTitle(); var output = new IHTMLTextArea().AttachToDocument(); var gexf = new XElement("gexf"); gexf.Add( new XElement("meta", new XElement("creator", "jsc"), new XElement("description", "NASDAQSNA") ) ); var graph = new XElement("graph", new XAttribute("mode", "static"), new XAttribute("defaultedgetype", "directed") ); gexf.Add(graph); var nodes = new XElement("nodes"); graph.Add(nodes); var edges = new XElement("edges"); graph.Add(edges); output.value = gexf.ToString(); output.onfocus += delegate { output.value = gexf.ToString(); }; output.onmouseover += delegate { output.value = gexf.ToString(); }; var NumericNodeIdLookup = new List <string>(); Func <string, int> GetNumericNodeId = k => { if (!NumericNodeIdLookup.Contains(k)) { NumericNodeIdLookup.Add(k); } return(NumericNodeIdLookup.IndexOf(k)); }; #region AddRelatedCompanies Func <IHTMLDiv, string, Action, Task> AddRelatedCompanies = null; AddRelatedCompanies = (c, qid, done) => { var nqid = GetNumericNodeId(qid).ToString(); var cc = new IHTMLDiv(); cc.style.marginLeft = "2em"; var service = new ApplicationWebService { qid = qid, yield = (id, CompanyName, Price) => { var nid = GetNumericNodeId(id).ToString(); if (nodes.Elements().Any(k => k.Attribute("id").Name.LocalName == nid)) { } else { nodes.Add( new XElement("node", new XAttribute("id", nid), new XAttribute("label", CompanyName) ) ); } var btn = new IHTMLButton { innerText = id + " " + CompanyName + " " + Price }; btn.style.display = IStyle.DisplayEnum.block; if (qid == id) { btn.disabled = true; if (c == null) { btn.AttachToDocument(); cc.AttachToDocument(); } else { //btn.AttachTo(c); cc.AttachTo(c); } if (done != null) { done(); } } else { edges.Add( new XElement("edge", new XAttribute("source", nqid), new XAttribute("target", nid) ) ); btn.AttachTo(cc); var ccc = new IHTMLDiv(); ccc.AttachTo(cc); int cx = 0; ccc.ToggleVisible(); btn.WhenClicked( async delegate { if (cx == 0) { btn.style.color = JSColor.Red; await AddRelatedCompanies(ccc, id, delegate { btn.style.color = JSColor.Blue; } ); } cx++; ccc.ToggleVisible(); } ); } } }; return(service.GetRelatedCompanies()); }; #endregion AddRelatedCompanies(null, "NASDAQ:FB", null); AddRelatedCompanies(null, "NASDAQ:GOOG", null); }
/// <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) { // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2013/201308/20130826-domainmemory // see also: x:\jsc.svn\examples\javascript\Test\TestThreadStart\TestThreadStart\Application.cs var counter = 0; var btn = new IHTMLButton { innerText = "spawn new thread" }; Native.window.onframe += delegate { btn.innerText = "spawn new thread" + new { loc0 }; }; btn.AttachToDocument().WhenClicked( delegate { counter++; Console.WriteLine(new { loc0, Thread.CurrentThread.ManagedThreadId }); loc0 = "click " + new { counter }; //Thread.CurrentContext.DoCallBack( // delegate // { // // now what? // } //); //new Task().run new Worker( worker => { Console.WriteLine("should not send changes!"); loc0 = loc0; Console.WriteLine("should not send changes?"); // should a trigger see that we changed a static field? loc0 += ", working..."; Console.WriteLine(new { loc0, Thread.CurrentThread.ManagedThreadId }); var s = new Stopwatch(); s.Start(); // spin the cpu // how long do we have to, in order for task manager to notice? // this should keep one cpu utilized atleast at 70% for (int i = 0; i < 5; i++) { var xs = new Stopwatch(); xs.Start(); while (xs.ElapsedMilliseconds < 1000) { ; } Console.WriteLine("."); loc0 += " " + new { i }; } Console.WriteLine("working ... done " + new { s.Elapsed, Thread.CurrentThread.ManagedThreadId }); loc0 += " done!"; worker.postMessage("done!"); //worker.close(); } ).onmessage += e => { Console.WriteLine("onmessage: " + e.data); }; } ); }