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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

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 812 using Enterprise.Logging;
13 william 695
14     namespace RomCheater.Docking
15     {
16 william 696 public partial class FloatingWebBrowser : DockContent, IWebBrowserInterface
17 william 695 {
18 william 738 private IWebBrowserProvider BackingProvider = WebBrowserProvider.Empty;
19 william 695 public FloatingWebBrowser()
20     {
21     InitializeComponent();
22 william 699 this.BackingProvider = new WebBrowserProvider(this);
23 william 697 init();
24 william 695 }
25 william 696
26    
27    
28     private void btnGo_Click(object sender, EventArgs e)
29     {
30 william 697 string url = txtWebAddress.Text;
31     this.Navigate(url);
32 william 696 }
33    
34    
35    
36    
37     public IWebBrowserInterface Provider
38     {
39 william 738 get { return this.BackingProvider.GetProvider(); }
40 william 696 }
41    
42 william 697 private void init()
43     {
44     init_events();
45 william 696
46 william 697 lblWebAddress.Font = this.Font;
47     txtWebAddress.Font = this.Font;
48     btnGo.Font = this.Font;
49    
50     }
51    
52 william 696 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 william 698 this.txtWebAddress.KeyDown += new KeyEventHandler(txtWebAddress_KeyDown);
58 william 696 }
59    
60 william 698
61 william 696
62     #region Provider Events
63 william 698 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 william 696 void Provider_Navigated(object sender, WebBrowserNavigatedEventArgs e)
73     {
74 william 812 gLog.Debug.WriteLine("Navigated to Url: {0}", e.Url.ToString());
75 william 698 txtWebAddress.Text = e.Url.ToString();
76 william 696 }
77    
78     void Provider_Navigating(object sender, WebBrowserNavigatingEventArgs e)
79     {
80 william 812 gLog.Debug.WriteLine("Navigating to Url: {0}", e.Url.ToString());
81 william 696 }
82     void Provider_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
83     {
84 william 812 gLog.Debug.WriteLine("Loaded Document at Url: {0}", e.Url.ToString());
85 william 696 }
86     #endregion
87    
88     #region IWebBrowserInterface Members
89     public void Navigate(string urlString)
90     {
91 william 812 gLog.Debug.WriteLine("called::Navigate(string urlString)::{0}", urlString);
92 william 699 //this.Provider.Navigate(urlString);
93     this.webBrowser.Navigate(urlString);
94 william 696 }
95 william 698 public void Navigate(Uri url) { Navigate(url.ToString()); }
96 william 696 #endregion
97 william 698
98 william 741 private void FloatingWebBrowser_Shown(object sender, EventArgs e)
99     {
100 william 742 this.BackingProvider = new WebBrowserProvider(this);
101 william 746 //init();
102 william 741 }
103    
104 william 698
105 william 695 }
106     }

  ViewVC Help
Powered by ViewVC 1.1.22