public void Render(Page p) { //ThreadAssist.Spawn(delegate { string temp; if (p != null) { StringReader sr = new StringReader(p.Content); web.OpenStream(p.Url, "text/html"); //Console.WriteLine(p.Url); //Console.WriteLine(p.GetType()); while ((temp = sr.ReadLine()) != null) { web.AppendData(temp); //Console.Write(temp); } web.CloseStream(); web.ShowAll(); this.ShowAll(); //Console.WriteLine("Wikipedia plugin debug:"); } else { Visible = false; } //}); }
public void Render(string html_code) { string r = ProcessImages(html_code); // if the html code is too big, write it down to a tmp file if (((uint)r.Length) > 50000) { string filename = (tmp_file++) + ".html"; string filepath = Path.Combine(tmpPath, filename); using (FileStream file = new FileStream(filepath, FileMode.Create)) { StreamWriter sw = new StreamWriter(file); sw.Write(r); sw.Close(); } html_panel.LoadUrl(filepath); } else { html_panel.OpenStream("file:///", "text/html"); html_panel.AppendData(r); html_panel.CloseStream(); } }
public MsdnView() : base("Msdn View") { DefaultSize = new Gdk.Size (1024,1024); HPaned hb = new HPaned (); Store = new NodeStore (typeof (TreeNode)); WebControl wc = new WebControl (); ScrolledWindow sw = new ScrolledWindow (); NodeView view = new NodeView (Store); view.HeadersVisible = false; view.AppendColumn ("Name", new CellRendererText (), "text", 0); sw.WidthRequest = 300; InitTree (); Add (hb); hb.Add (sw); hb.Add (wc); sw.Add (view); // Events DeleteEvent += delegate { Application.Quit (); }; view.NodeSelection.Changed += delegate { TreeNode n = (TreeNode) view.NodeSelection.SelectedNode; if (n == null) return; // // Fool msdn's code that tries to detect if it // is in a frame // string html = @" <frameset> <frame src='" + n.Href + @"?frame=true' /> </frameset>"; wc.OpenStream (MsdnClient.BaseUrl, "text/html"); wc.AppendData (html); wc.CloseStream (); }; view.RowExpanded += delegate (object o, RowExpandedArgs args) { TreeNode n = (TreeNode) Store.GetNode (args.Path); n.PopulateChildrenAsync (); }; }