final batch of cleanups

This commit is contained in:
Lynne Megido 2021-06-15 12:19:12 +10:00
parent 1af03bf2be
commit c77c2b34f3
Signed by: lynnesbian
GPG key ID: F0A184B5213D9F90
5 changed files with 10 additions and 16 deletions

View file

@ -2,11 +2,10 @@ using Gtk;
namespace Buypeeb { namespace Buypeeb {
internal class AddItemDialogue : Dialog { internal class AddItemDialogue : Dialog {
private readonly Entry entryURL; public Entry entryURL { get; }
private readonly Entry entryName; public Entry entryName { get; }
public AddItemDialogue() : this(new Builder("add.glade")) { public AddItemDialogue() : this(new Builder("add.glade")) { }
}
private AddItemDialogue(Builder builder) : base(builder.GetObject("DialogueAdd").Handle) { private AddItemDialogue(Builder builder) : base(builder.GetObject("DialogueAdd").Handle) {
Title = "Add item"; Title = "Add item";
@ -19,13 +18,5 @@ namespace Buypeeb {
private static void Window_Shutdown(object sender, DeleteEventArgs args) { private static void Window_Shutdown(object sender, DeleteEventArgs args) {
Application.Quit(); Application.Quit();
} }
public string GetURL() {
return entryURL.Text;
}
public string GetName() {
return entryName.Text;
}
} }
} }

View file

@ -548,8 +548,8 @@ namespace Buypeeb {
// Console.WriteLine("ButtonAddClicked"); // Console.WriteLine("ButtonAddClicked");
var aid = new AddItemDialogue {Title = "Buypeeb"}; var aid = new AddItemDialogue {Title = "Buypeeb"};
aid.Run(); aid.Run();
var url = aid.GetURL(); var url = aid.entryURL.Text;
var name = aid.GetName(); var name = aid.entryName.Text;
aid.Dispose(); aid.Dispose();
// vry simpl url validation for simpol creachers // vry simpl url validation for simpol creachers

View file

@ -61,7 +61,7 @@ namespace Buypeeb {
if (!int.TryParse(e.Text, out var result)) { if (!int.TryParse(e.Text, out var result)) {
failed = true; failed = true;
} else { } else {
if (result < 30 || result > 6000) { if (result is < 30 or > 6000) {
failed = true; failed = true;
} }
} }

View file

@ -5,6 +5,7 @@ using System.Text.Json;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using CsvHelper.Configuration.Attributes; using CsvHelper.Configuration.Attributes;
// ReSharper disable MemberCanBePrivate.Global
namespace Buypeeb { namespace Buypeeb {
internal class YahooAuctionsItem { internal class YahooAuctionsItem {
@ -19,8 +20,9 @@ namespace Buypeeb {
// there's not really a need for it i guess but it's my program and i can do what i want // there's not really a need for it i guess but it's my program and i can do what i want
// anything with the attribute [Ignore] won't be put in the CSV, and things with [JsonIgnore] won't be put in // anything with the attribute [Ignore] won't be put in the CSV, and things with [JsonIgnore] won't be put in
// userdata.json // userdata.json
// ReSharper disable once MemberCanBePrivate.Global
// don't remove ID's set attribute - JSON deserialisation will silently fail to assign IDs to the auction items! // don't remove ID's set attribute - JSON deserialisation will silently fail to assign IDs to the auction items!
// you also don't want to private any of the setters, which will have a similar effect.
[Ignore] public string id { get; set; } [Ignore] public string id { get; set; }
public string name { get; set; } public string name { get; set; }
public int Price; public int Price;

View file

@ -11,6 +11,7 @@
<EmbeddedResource Include="**\*.glade"> <EmbeddedResource Include="**\*.glade">
<LogicalName>%(Filename)%(Extension)</LogicalName> <LogicalName>%(Filename)%(Extension)</LogicalName>
</EmbeddedResource> </EmbeddedResource>
<None Remove="yahoo.html" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>