Made dictionary inline, changed text on ended auctions to say ended, some silliness.

This commit is contained in:
= 2020-09-04 23:27:56 +10:00
parent 83bdd72bfe
commit e486bce6de
3 changed files with 33 additions and 24 deletions

1
.gitignore vendored
View file

@ -5,3 +5,4 @@ bin/
obj/
out/
yahoo.html
.vs/

View file

@ -250,18 +250,20 @@ namespace Buypeeb {
this.selectionViewBox.Sensitive = item.ready;
infobox.Visible = true;
var info = new Dictionary<string, string>();
info.Add("Name", item.name);
info.Add("YahooName", item.originalName);
info.Add("Price", item.PriceJPY());
info.Add("PriceAUD", item.PriceAUD());
info.Add("Ending", "...");
info.Add("Bids", $"{item.bids}");
info.Add("BuyItNow", item.winPrice == 0 ? "No" : $"¥{item.PriceJPY(true)} (${item.PriceAUD(true)})");
info.Add("AutoExtension", item.autoExtension ? "Yes" : "No");
info.Add("LastUpdated", "Last updated: heeeenlo");
var info = new Dictionary<string, string>
{
{ "Name", item.name },
{ "YahooName", item.originalName },
{ "Price", item.PriceJPY() },
{ "PriceAUD", item.PriceAUD() },
{ "Ending", "..." },
{ "Bids", $"{item.bids}" },
{ "BuyItNow", item.winPrice == 0 ? "No" : $"¥{item.PriceJPY(true)} (${item.PriceAUD(true)})" },
{ "AutoExtension", item.autoExtension ? "Yes" : "No" },
{ "LastUpdated", "Last updated: heeeenlo" }
};
foreach (var row in info) {
foreach (var row in info) {
var l = (Label)this.builder.GetObject($"LabelSelected{row.Key}");
l.Text = row.Value;
}
@ -487,17 +489,23 @@ namespace Buypeeb {
YahooAuctionsItem item = (YahooAuctionsItem)model.GetValue(iter, 0);
string ending = "";
if (item.ready) {
var now = DateTime.Now;
var end = item.endDate.ToLocalTime();
// TODO: should we show the year if the auction ends next year? 0uo
if (end.DayOfYear != now.DayOfYear) {
// the auction isn't ending today, so we should show the day it's ending on for clarity
ending += end.ToString("MMM d ");
}
ending += end.ToString("HH:mm");
if (this.settings.displaySecondsInList) {
// add the seconds on to the end
ending += end.ToString(":ss");
if (!item.available) {
ending = "Ended";
} else {
var now = DateTime.Now;
var end = item.endDate.ToLocalTime();
// TODO: should we show the year if the auction ends next year? 0uo
if (end.DayOfYear != now.DayOfYear)
{
// the auction isn't ending today, so we should show the day it's ending on for clarity
ending += end.ToString("MMM d ");
}
ending += end.ToString("HH:mm");
if (this.settings.displaySecondsInList)
{
// add the seconds on to the end
ending += end.ToString(":ss");
}
}
}
(cell as Gtk.CellRendererText).Text = item.ready ? ending : "...";

View file

@ -355,7 +355,7 @@
<object class="GtkLabel" id="LabelSelectedName">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">precious peebus polytonal player</property>
<property name="label" translatable="yes">precious peebus polytonal player (paca edition)</property>
<property name="justify">center</property>
<property name="wrap">True</property>
<property name="ellipsize">end</property>