public PlatformWpf() : base(null, true) { var app = new Application (); var slCanvas = new Canvas (); var win = new Window { Title = Title, Width = Width, Height = Height, Content = slCanvas }; var cirrusCanvas = new CirrusCanvas(slCanvas, Width, Height); MainCanvas = cirrusCanvas; win.Show (); EntryPoint.Invoke (null, null); var timer = new DispatcherTimer (); timer.Tick += runDelegate; timer.Interval = TimeSpan.FromMilliseconds (1); timer.Start (); app.Run (); }
void OnStartup(object sender, StartupEventArgs e) { ScriptObject boundingRect = (ScriptObject)HtmlPage.Plugin.Invoke("getBoundingClientRect"); int width = Convert.ToInt32(boundingRect.GetProperty("width")); if (width == 0) width = Convert.ToInt32(boundingRect.GetProperty("right")) - Convert.ToInt32(boundingRect.GetProperty("left")); int height = Convert.ToInt32(boundingRect.GetProperty("height")); if (height == 0) height = Convert.ToInt32(boundingRect.GetProperty("bottom")) - Convert.ToInt32(boundingRect.GetProperty("top")); Canvas silverlightCanvas = new Canvas(); this.RootVisual = silverlightCanvas; CirrusCanvas canvas = new CirrusCanvas(silverlightCanvas, width, height); HtmlPage.RegisterScriptableObject("canvas", canvas); }