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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 812 - (show annotations) (download)
Tue Apr 15 14:52:10 2014 UTC (5 years, 9 months ago) by william
File size: 3243 byte(s)
+ update logging to use Enterpise.Logging -- more work is still needed

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

  ViewVC Help
Powered by ViewVC 1.1.22