Scrapping running hadless or viewable
This commit is contained in:
@ -22,7 +22,7 @@ namespace RepositoryPattern
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Container = Configure();
|
||||
Application.Run(new frmInitial(Container.Resolve<IProductRepository>(),Container.Resolve<IStockMemberRepository>()));
|
||||
Application.Run(new frmInitial(Container.Resolve<IProductRepository>(),Container.Resolve<IStockMemberRepository>(),Container.Resolve<IStockMarketRepository>()));
|
||||
}
|
||||
/// <summary>
|
||||
/// Setting dependency injection
|
||||
@ -33,6 +33,7 @@ namespace RepositoryPattern
|
||||
var builder = new ContainerBuilder();
|
||||
builder.RegisterType<ProductRepository>().As<IProductRepository>();
|
||||
builder.RegisterType<StockMemberRepository>().As<IStockMemberRepository>();
|
||||
builder.RegisterType<StockMarketRepository>().As<IStockMarketRepository>();
|
||||
builder.RegisterType<frmInitial>();
|
||||
return builder.Build();
|
||||
}
|
||||
|
||||
@ -9,6 +9,8 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Autofac" Version="6.1.0" />
|
||||
<PackageReference Include="Dapper" Version="2.0.78" />
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.29" />
|
||||
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="87.0.4280.8800" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
53
RepositoryPattern/frmInitial.Designer.cs
generated
53
RepositoryPattern/frmInitial.Designer.cs
generated
@ -35,6 +35,10 @@ namespace RepositoryPattern
|
||||
this.btnReload = new System.Windows.Forms.Button();
|
||||
this.rdbStock = new System.Windows.Forms.RadioButton();
|
||||
this.rdbNorth = new System.Windows.Forms.RadioButton();
|
||||
this.btnTestScrapFunction = new System.Windows.Forms.Button();
|
||||
this.lblStockRows = new System.Windows.Forms.Label();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.chbShowBrowser = new System.Windows.Forms.CheckBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||
this.gB1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
@ -102,11 +106,55 @@ namespace RepositoryPattern
|
||||
this.rdbNorth.Text = "NorthWind";
|
||||
this.rdbNorth.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnTestScrapFunction
|
||||
//
|
||||
this.btnTestScrapFunction.Location = new System.Drawing.Point(12, 452);
|
||||
this.btnTestScrapFunction.Name = "btnTestScrapFunction";
|
||||
this.btnTestScrapFunction.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnTestScrapFunction.TabIndex = 4;
|
||||
this.btnTestScrapFunction.Text = "LoadScrap";
|
||||
this.btnTestScrapFunction.UseVisualStyleBackColor = true;
|
||||
this.btnTestScrapFunction.Click += new System.EventHandler(this.btnTestScrapFunction_Click);
|
||||
//
|
||||
// lblStockRows
|
||||
//
|
||||
this.lblStockRows.AutoSize = true;
|
||||
this.lblStockRows.Location = new System.Drawing.Point(93, 456);
|
||||
this.lblStockRows.Name = "lblStockRows";
|
||||
this.lblStockRows.Size = new System.Drawing.Size(14, 15);
|
||||
this.lblStockRows.TabIndex = 5;
|
||||
this.lblStockRows.Text = "#";
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(157, 452);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(75, 23);
|
||||
this.button1.TabIndex = 6;
|
||||
this.button1.Text = "ReLoad";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// chbShowBrowser
|
||||
//
|
||||
this.chbShowBrowser.AutoSize = true;
|
||||
this.chbShowBrowser.Location = new System.Drawing.Point(12, 478);
|
||||
this.chbShowBrowser.Name = "chbShowBrowser";
|
||||
this.chbShowBrowser.Size = new System.Drawing.Size(100, 22);
|
||||
this.chbShowBrowser.TabIndex = 7;
|
||||
this.chbShowBrowser.Text = "Show Browser";
|
||||
this.chbShowBrowser.UseCompatibleTextRendering = true;
|
||||
this.chbShowBrowser.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// frmInitial
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 509);
|
||||
this.Controls.Add(this.chbShowBrowser);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.lblStockRows);
|
||||
this.Controls.Add(this.btnTestScrapFunction);
|
||||
this.Controls.Add(this.gB1);
|
||||
this.Controls.Add(this.lblTotalRecords);
|
||||
this.Controls.Add(this.dataGridView);
|
||||
@ -114,6 +162,7 @@ namespace RepositoryPattern
|
||||
this.Name = "frmInitial";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Repository Pattern";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmInitial_FormClosing);
|
||||
this.Load += new System.EventHandler(this.Form1_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||
this.gB1.ResumeLayout(false);
|
||||
@ -131,6 +180,10 @@ namespace RepositoryPattern
|
||||
private System.Windows.Forms.RadioButton rdbStock;
|
||||
private System.Windows.Forms.RadioButton rdbNorth;
|
||||
private System.Windows.Forms.Button btnReload;
|
||||
private System.Windows.Forms.Button btnTestScrapFunction;
|
||||
private System.Windows.Forms.Label lblStockRows;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.CheckBox chbShowBrowser;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -15,12 +15,14 @@ namespace RepositoryPattern
|
||||
{
|
||||
IProductRepository _productRepository;
|
||||
private readonly IStockMemberRepository _stockMemberRepository;
|
||||
private readonly IStockMarketRepository _stockMarketRepository;
|
||||
|
||||
public frmInitial(IProductRepository productRepository,IStockMemberRepository stockMemberRepository)
|
||||
public frmInitial(IProductRepository productRepository,IStockMemberRepository stockMemberRepository,IStockMarketRepository stockMarketRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_productRepository = productRepository;
|
||||
_stockMemberRepository = stockMemberRepository;
|
||||
_stockMarketRepository = stockMarketRepository;
|
||||
}
|
||||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
@ -44,5 +46,31 @@ namespace RepositoryPattern
|
||||
{
|
||||
ReloadData();
|
||||
}
|
||||
|
||||
private void btnTestScrapFunction_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (rdbStock.Checked)
|
||||
{
|
||||
_stockMarketRepository.LoadStockMarketList(chbShowBrowser.Checked);
|
||||
var stocklist = _stockMarketRepository.StockMarketList;
|
||||
lblStockRows.Text = stocklist.Count().ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private void frmInitial_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
_stockMarketRepository.Clean();
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (rdbStock.Checked)
|
||||
{
|
||||
lblStockRows.Text = "";
|
||||
_stockMarketRepository.RefreshMarketList();
|
||||
var stocklist = _stockMarketRepository.StockMarketList;
|
||||
lblStockRows.Text = stocklist.Count().ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user