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 {
internal class AddItemDialogue : Dialog {
private readonly Entry entryURL;
private readonly Entry entryName;
public Entry entryURL { get; }
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) {
Title = "Add item";
@ -19,13 +18,5 @@ namespace Buypeeb {
private static void Window_Shutdown(object sender, DeleteEventArgs args) {
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");
var aid = new AddItemDialogue {Title = "Buypeeb"};
aid.Run();
var url = aid.GetURL();
var name = aid.GetName();
var url = aid.entryURL.Text;
var name = aid.entryName.Text;
aid.Dispose();
// vry simpl url validation for simpol creachers

View File

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

View File

@ -5,6 +5,7 @@ using System.Text.Json;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using CsvHelper.Configuration.Attributes;
// ReSharper disable MemberCanBePrivate.Global
namespace Buypeeb {
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
// anything with the attribute [Ignore] won't be put in the CSV, and things with [JsonIgnore] won't be put in
// 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!
// you also don't want to private any of the setters, which will have a similar effect.
[Ignore] public string id { get; set; }
public string name { get; set; }
public int Price;

View File

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