/[RomCheater]/trunk/RomCheater.Core/IWebBrowserProvider.cs
ViewVC logotype

Diff of /trunk/RomCheater.Core/IWebBrowserProvider.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 696 by william, Mon Jun 17 11:47:23 2013 UTC revision 697 by william, Mon Jun 17 12:03:50 2013 UTC
# Line 3  using System.Collections.Generic; Line 3  using System.Collections.Generic;
3  using System.Linq;  using System.Linq;
4  using System.Text;  using System.Text;
5  using System.Windows.Forms;  using System.Windows.Forms;
6    using RomCheater.Logging;
7    
8  namespace RomCheater.Core  namespace RomCheater.Core
9  {  {
# Line 11  namespace RomCheater.Core Line 12  namespace RomCheater.Core
12          IWebBrowserInterface GetProvider();          IWebBrowserInterface GetProvider();
13      }      }
14      public interface IWebBrowserInterface      public interface IWebBrowserInterface
15      {      {        
         //WebBrowser Provider { get; }  
16          void Navigate(string urlString);              void Navigate(string urlString);    
17          void Navigate(Uri url);          void Navigate(Uri url);
         //void Navigate(string urlString, bool newWindow);  
         //void Navigate(string urlString, string targetFrameName);  
         //void Navigate(Uri url, bool newWindow);  
         //void Navigate(Uri url, string targetFrameName);          
         //void Navigate(string urlString, string targetFrameName, byte[] postData, string additionalHeaders);  
         //void Navigate(Uri url, string targetFrameName, byte[] postData, string additionalHeaders);  
   
18      }      }
19    
     //public class WebBrowserProvider : IWebBrowserProvider  
     //{  
     //    public WebBrowserProvider(IWebBrowserInterface provider)  
     //    {  
     //        _provider = provider;  
     //    }  
   
     //    #region IWebBrowserProvider Members  
     //    private IWebBrowserInterface _provider;  
     //    public IWebBrowserInterface GetProvider()  
     //    {  
     //        return _provider;  
     //    }  
     //    #endregion  
     //}  
   
20      public class EmptyWebBrowserProvider : BaseWebBrowserProvider, IWebBrowserInterface      public class EmptyWebBrowserProvider : BaseWebBrowserProvider, IWebBrowserInterface
21      {      {
22          public EmptyWebBrowserProvider() :base()          public EmptyWebBrowserProvider() :base()
# Line 70  namespace RomCheater.Core Line 47  namespace RomCheater.Core
47          public WebBrowser Provider { get { return _Provider; } protected set { _Provider = value; } }          public WebBrowser Provider { get { return _Provider; } protected set { _Provider = value; } }
48    
49          #region Extensions to WebBrowser provider          #region Extensions to WebBrowser provider
50          public void Navigate(string urlString) { this.Provider.Navigate(urlString); }          public void Navigate(string urlString) { NavigateInternal(urlString); }
51          public void Navigate(Uri url) { this.Provider.Navigate(url); }          public void Navigate(Uri url) { NavigateInternal(url.ToString()); }
52          //public void Navigate(string urlString, bool newWindow) { this.Provider.Navigate(urlString, newWindow); }  
53          //public void Navigate(string urlString, string targetFrameName) { this.Provider.Navigate(urlString, targetFrameName); }          private void NavigateInternal(string url)
54          //public void Navigate(Uri url, bool newWindow) { this.Provider.Navigate(url, newWindow); }          {
55          //public void Navigate(Uri url, string targetFrameName) { this.Provider.Navigate(url, targetFrameName); }              try
56          //public void Navigate(string urlString, string targetFrameName, byte[] postData, string additionalHeaders) { this.Provider.Navigate(urlString, targetFrameName, postData, additionalHeaders); }              {
57          //public void Navigate(Uri url, string targetFrameName, byte[] postData, string additionalHeaders) { this.Provider.Navigate(url, targetFrameName, postData, additionalHeaders); }                  Uri uri = new Uri(url);
58                    this.Provider.Navigate(uri);
59                }
60                catch (UriFormatException ex)
61                {
62                    MessageBox.Show(string.Format("Could not navigate to url: '{0}'", url), string.Format("A Uri Format Exception Occurred in '{0}'", this.GetType().Name), MessageBoxButtons.OK, MessageBoxIcon.Error);
63                    logger.Error.WriteLine("Unable to navigate to url: '{0}'", url);
64                    logger.VerboseError.WriteLine(ex.ToString());
65                }
66            }
67    
68          #endregion          #endregion
69          #endregion          #endregion
70    

Legend:
Removed from v.696  
changed lines
  Added in v.697

  ViewVC Help
Powered by ViewVC 1.1.22