Skip to content

Commit

Permalink
Default domain is now remembered
Browse files Browse the repository at this point in the history
  • Loading branch information
maforget committed Dec 16, 2024
1 parent ead7c1a commit 1a7e80c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
27 changes: 16 additions & 11 deletions AmazonScrapper/Dialog/frmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -271,6 +275,7 @@ private void SetConfigItems()
return;

chkGroupBySerie.Checked = user.GroupBySerie;
cbDomains.SelectedIndex = (int)user.TLD;
}

private void SetTitleBar()
Expand Down
8 changes: 6 additions & 2 deletions AmazonScrapper/Settings/OtherConfig.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using BetterINI;
using AmazonScrapper.Web;
using BetterINI;
using System;
using System.Collections.Generic;
using System.Linq;
Expand All @@ -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;
}
}

0 comments on commit 1a7e80c

Please sign in to comment.