From 1a7e80c23d3fdcc820ff0846c70e024aadbfe851 Mon Sep 17 00:00:00 2001 From: maforget <11904426+maforget@users.noreply.github.com> Date: Sun, 15 Dec 2024 19:06:29 -0500 Subject: [PATCH] Default domain is now remembered --- AmazonScrapper/Dialog/frmMain.cs | 27 +++++++++++++++----------- AmazonScrapper/Settings/OtherConfig.cs | 8 ++++++-- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/AmazonScrapper/Dialog/frmMain.cs b/AmazonScrapper/Dialog/frmMain.cs index 64ae02c..bf4ef1e 100644 --- a/AmazonScrapper/Dialog/frmMain.cs +++ b/AmazonScrapper/Dialog/frmMain.cs @@ -39,9 +39,9 @@ public partial class frmMain : Form public frmMain() { InitializeComponent(); - SetConfigItems(); SetTitleBar(); CreateDomainList(); + SetConfigItems(); } public frmMain(string searchText, string searchNumber, CancellationToken token = default) @@ -131,9 +131,10 @@ private void btnCancel_Click(object sender, EventArgs e) private void frmMain_FormClosed(object sender, FormClosedEventArgs e) { OnBookSkipped(EventArgs.Empty); - } + SaveSetting(); + } - private void btnIssues_Click(object sender, EventArgs e) + private void btnIssues_Click(object sender, EventArgs e) { AmazonLinkSerie link = GetCurrentRow() as AmazonLinkSerie; if (link != null) @@ -170,15 +171,18 @@ private void dgvResults_CellDoubleClick(object sender, DataGridViewCellEventArgs } private void chkGroupBySerie_CheckedChanged(object sender, EventArgs e) - { - GroupBySerie = chkGroupBySerie.Checked; - - var user = new OtherConfig(); - user.GroupBySerie = chkGroupBySerie.Checked; - user.WriteOtherConfigToFile(); + { + GroupBySerie = chkGroupBySerie.Checked; + ChangeGrouping(); + } - ChangeGrouping(); - } + private void SaveSetting() + { + var user = new OtherConfig(); + user.GroupBySerie = chkGroupBySerie.Checked; + user.TLD = Domain; + user.WriteOtherConfigToFile(); + } private void cbDomains_SelectedIndexChanged(object sender, EventArgs e) { @@ -271,6 +275,7 @@ private void SetConfigItems() return; chkGroupBySerie.Checked = user.GroupBySerie; + cbDomains.SelectedIndex = (int)user.TLD; } private void SetTitleBar() diff --git a/AmazonScrapper/Settings/OtherConfig.cs b/AmazonScrapper/Settings/OtherConfig.cs index b9fcf95..8190004 100644 --- a/AmazonScrapper/Settings/OtherConfig.cs +++ b/AmazonScrapper/Settings/OtherConfig.cs @@ -1,4 +1,5 @@ -using BetterINI; +using AmazonScrapper.Web; +using BetterINI; using System; using System.Collections.Generic; using System.Linq; @@ -12,5 +13,8 @@ public class OtherConfig { [IniParam(Default = false)] public bool GroupBySerie { get; set; } = false; - } + + [IniParam(Default = TLDs.com)] + public TLDs TLD { get; set; } = TLDs.com; + } }