/[RomCheater]/trunk/RomCheater/Docking/FloatingWebBrowser.cs
ViewVC logotype

Annotation of /trunk/RomCheater/Docking/FloatingWebBrowser.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 699 - (hide annotations) (download)
Mon Jun 17 12:40:47 2013 UTC (7 years, 4 months ago) by william
File size: 2930 byte(s)
+ work out passing around the webbrowser through the config plugin

1 william 695 using System;
2     using System.Collections.Generic;
3     using System.ComponentModel;
4     using System.Data;
5     using System.Drawing;
6     using System.Linq;
7     using System.Text;
8     using System.Windows.Forms;
9     using WeifenLuo.WinFormsUI.Docking;
10 william 696 using RomCheater.Core;
11 william 697 using RomCheater.Logging;
12 william 695
13     namespace RomCheater.Docking
14     {
15 william 696 public partial class FloatingWebBrowser : DockContent, IWebBrowserInterface
16 william 695 {
17 william 696 private WebBrowserProvider BackingProvider = new WebBrowserProvider();
18 william 695 public FloatingWebBrowser()
19     {
20     InitializeComponent();
21 william 699 this.BackingProvider = new WebBrowserProvider(this);
22 william 697 init();
23 william 695 }
24 william 696
25    
26    
27     private void btnGo_Click(object sender, EventArgs e)
28     {
29 william 697 string url = txtWebAddress.Text;
30     this.Navigate(url);
31 william 696 }
32    
33    
34    
35    
36     public IWebBrowserInterface Provider
37     {
38     get { return this.BackingProvider; }
39     }
40    
41 william 697 private void init()
42     {
43     init_events();
44 william 696
45 william 697 lblWebAddress.Font = this.Font;
46     txtWebAddress.Font = this.Font;
47     btnGo.Font = this.Font;
48    
49     }
50    
51 william 696 private void init_events()
52     {
53     this.webBrowser.Navigating += new WebBrowserNavigatingEventHandler(Provider_Navigating);
54     this.webBrowser.Navigated += new WebBrowserNavigatedEventHandler(Provider_Navigated);
55     this.webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(Provider_DocumentCompleted);
56 william 698 this.txtWebAddress.KeyDown += new KeyEventHandler(txtWebAddress_KeyDown);
57 william 696 }
58    
59 william 698
60 william 696
61     #region Provider Events
62 william 698 void txtWebAddress_KeyDown(object sender, KeyEventArgs e)
63     {
64     if (e.KeyCode == Keys.Enter)
65     {
66     string url = txtWebAddress.Text;
67     this.Navigate(url);
68     }
69     }
70    
71 william 696 void Provider_Navigated(object sender, WebBrowserNavigatedEventArgs e)
72     {
73 william 698 logger.Debug.WriteLine("Navigated to Url: {0}", e.Url.ToString());
74     txtWebAddress.Text = e.Url.ToString();
75 william 696 }
76    
77     void Provider_Navigating(object sender, WebBrowserNavigatingEventArgs e)
78     {
79 william 698 logger.Debug.WriteLine("Navigating to Url: {0}", e.Url.ToString());
80 william 696 }
81     void Provider_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
82     {
83 william 698 logger.Debug.WriteLine("Loaded Document at Url: {0}", e.Url.ToString());
84 william 696 }
85     #endregion
86    
87     #region IWebBrowserInterface Members
88     public void Navigate(string urlString)
89     {
90 william 699 //this.Provider.Navigate(urlString);
91     this.webBrowser.Navigate(urlString);
92 william 696 }
93 william 698 public void Navigate(Uri url) { Navigate(url.ToString()); }
94 william 696 #endregion
95 william 698
96    
97 william 695 }
98     }

  ViewVC Help
Powered by ViewVC 1.1.22