// will HTML5 enable a more nicer solution? internal static void CombineDelegate(IHTMLApplet a, Action value) { new Timer( t => { Tick(a, value, t); }, 1, 100 ); }
private static void Tick(IHTMLApplet a, Action value, Timer t) { // http://www.rgagnon.com/javadetails/java-0176.html // in IE: isActive returns an error if the applet IS loaded, // false if not loaded // in NS: isActive returns true if loaded, an error if not loaded, var ie = (bool)new IFunction( "/*@cc_on return true; @*/ return false;" ).apply(null); var r = false; try { r = a.isActive(); } catch { r = ie; } if (r) { t.Stop(); if (value != null) { value(); } // note: this actually works! :) //Native.Window.alert("onload!"); } }
private static void Tick(IHTMLApplet a, Action value, Timer t) { // http://www.rgagnon.com/javadetails/java-0176.html // in IE: isActive returns an error if the applet IS loaded, // false if not loaded // in NS: isActive returns true if loaded, an error if not loaded, var ie = (bool)new IFunction( "/*@cc_on return true; @*/ return false;" ).apply(null); var r = false; try { r = a.isActive(); } catch { r = ie; } if (r) { t.Stop(); if (value != null) value(); // note: this actually works! :) //Native.Window.alert("onload!"); } }