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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 838 - (show annotations) (download)
Tue Sep 16 00:57:18 2014 UTC (6 years, 9 months ago) by william
File size: 3311 byte(s)
+ add an icon resource

1 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 using RomCheater.Core;
11 using RomCheater.Logging;
12 using Enterprise.Logging;
13
14 namespace RomCheater.Docking
15 {
16 public partial class FloatingWebBrowser : DockContent, IWebBrowserInterface
17 {
18 private IWebBrowserProvider BackingProvider = WebBrowserProvider.Empty;
19 public FloatingWebBrowser()
20 {
21 InitializeComponent();
22 this.Icon = Core.Properties.Resources.romcheater_icon;
23 this.BackingProvider = new WebBrowserProvider(this);
24 init();
25 }
26
27
28
29 private void btnGo_Click(object sender, EventArgs e)
30 {
31 string url = txtWebAddress.Text;
32 this.Navigate(url);
33 }
34
35
36
37
38 public IWebBrowserInterface Provider
39 {
40 get { return this.BackingProvider.GetProvider(); }
41 }
42
43 private void init()
44 {
45 init_events();
46
47 lblWebAddress.Font = this.Font;
48 txtWebAddress.Font = this.Font;
49 btnGo.Font = this.Font;
50
51 }
52
53 private void init_events()
54 {
55 this.webBrowser.Navigating += new WebBrowserNavigatingEventHandler(Provider_Navigating);
56 this.webBrowser.Navigated += new WebBrowserNavigatedEventHandler(Provider_Navigated);
57 this.webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(Provider_DocumentCompleted);
58 this.txtWebAddress.KeyDown += new KeyEventHandler(txtWebAddress_KeyDown);
59 }
60
61
62
63 #region Provider Events
64 void txtWebAddress_KeyDown(object sender, KeyEventArgs e)
65 {
66 if (e.KeyCode == Keys.Enter)
67 {
68 string url = txtWebAddress.Text;
69 this.Navigate(url);
70 }
71 }
72
73 void Provider_Navigated(object sender, WebBrowserNavigatedEventArgs e)
74 {
75 gLog.Debug.WriteLine("Navigated to Url: {0}", e.Url.ToString());
76 txtWebAddress.Text = e.Url.ToString();
77 }
78
79 void Provider_Navigating(object sender, WebBrowserNavigatingEventArgs e)
80 {
81 gLog.Debug.WriteLine("Navigating to Url: {0}", e.Url.ToString());
82 }
83 void Provider_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
84 {
85 gLog.Debug.WriteLine("Loaded Document at Url: {0}", e.Url.ToString());
86 }
87 #endregion
88
89 #region IWebBrowserInterface Members
90 public void Navigate(string urlString)
91 {
92 gLog.Debug.WriteLine("called::Navigate(string urlString)::{0}", urlString);
93 //this.Provider.Navigate(urlString);
94 this.webBrowser.Navigate(urlString);
95 }
96 public void Navigate(Uri url) { Navigate(url.ToString()); }
97 #endregion
98
99 private void FloatingWebBrowser_Shown(object sender, EventArgs e)
100 {
101 this.BackingProvider = new WebBrowserProvider(this);
102 //init();
103 }
104
105
106 }
107 }

  ViewVC Help
Powered by ViewVC 1.1.22