mercredi 13 juillet 2016

.Net WebBrowser architecture

I'm using .Net webBrowser for html parsing

in my program i have one MainForm (form object) and the program class that initializing the MainForm.

in the form i have the webBrowser initialization and when i entering to the web site i need to handle different page's (get data from it/download files and more)

today i have all that cases in the form itself separated by regions as functions :

public partial class MainForm : Form
{
   if(DoTypeA())
   {
      ...
   }
   ...
   #region TYPEA
   private bool DoTypeA()
   {
      HtmlDocument doc = webBrowser.Document ....
      ...
   }
   #endregion TYPEA
   ...
}

in type A i have redirection to the page and lot of data parsing from it

can i separate that functionality in different class ? for making the code cleaner.

The problem is that the webBrowser and all it's events happening in the form class.

What could be the best Design patter / Architecture pattern for that case.

Thank you.

Aucun commentaire:

Enregistrer un commentaire