fixed formatting

This commit is contained in:
Lynne Megido 2020-09-05 12:45:23 +10:00
parent 04f8e4dbdb
commit 9c335a73d0
Signed by: lynnesbian
GPG key ID: F0A184B5213D9F90

View file

@ -26,7 +26,6 @@ using System.Threading.Tasks;
using System.Net; using System.Net;
using System.Diagnostics; using System.Diagnostics;
using Gtk; using Gtk;
using System.Linq;
namespace Buypeeb { namespace Buypeeb {
public struct ItemColumns { public struct ItemColumns {
@ -251,20 +250,19 @@ namespace Buypeeb {
this.selectionViewBox.Sensitive = item.ready; this.selectionViewBox.Sensitive = item.ready;
infobox.Visible = true; infobox.Visible = true;
var info = new Dictionary<string, string> var info = new Dictionary<string, string> {
{ { "Name", item.name },
{ "Name", item.name }, { "YahooName", item.originalName },
{ "YahooName", item.originalName }, { "Price", item.PriceJPY() },
{ "Price", item.PriceJPY() }, { "PriceAUD", item.PriceAUD() },
{ "PriceAUD", item.PriceAUD() }, { "Ending", "..." },
{ "Ending", "..." }, { "Bids", $"{item.bids}" },
{ "Bids", $"{item.bids}" }, { "BuyItNow", item.winPrice == 0 ? "No" : $"¥{item.PriceJPY(true)} (${item.PriceAUD(true)})" },
{ "BuyItNow", item.winPrice == 0 ? "No" : $"¥{item.PriceJPY(true)} (${item.PriceAUD(true)})" }, { "AutoExtension", item.autoExtension ? "Yes" : "No" },
{ "AutoExtension", item.autoExtension ? "Yes" : "No" }, { "LastUpdated", "Last updated: heeeenlo" }
{ "LastUpdated", "Last updated: heeeenlo" } };
};
foreach (var row in info) { foreach (var row in info) {
var l = (Label)this.builder.GetObject($"LabelSelected{row.Key}"); var l = (Label)this.builder.GetObject($"LabelSelected{row.Key}");
l.Text = row.Value; l.Text = row.Value;
} }
@ -375,18 +373,18 @@ namespace Buypeeb {
md.Dispose(); md.Dispose();
if (r != ResponseType.Ok) { if (r != ResponseType.Ok) {
return; return;
} }
var removeMe = new List<string>(); var removeMe = new List<string>();
foreach(var item in this.settings.watchlist) { foreach (var item in this.settings.watchlist) {
if (!item.Value.available) { if (!item.Value.available) {
removeMe.Add(item.Key); removeMe.Add(item.Key);
} }
} }
foreach(var id in removeMe) { foreach (var id in removeMe) {
this.settings.watchlist.Remove(id); this.settings.watchlist.Remove(id);
} }
this.RenderList(); this.RenderList();
} }
@ -477,7 +475,7 @@ namespace Buypeeb {
} }
// timespan objects don't contain definitions for the time or date separators, so the colons need to be escaped // timespan objects don't contain definitions for the time or date separators, so the colons need to be escaped
// `HH` doesn't exist, but `hh` behaves identically // `HH` doesn't exist, but `hh` behaves identically
// see https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-timespan-format-strings // see https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-timespan-format-strings
ending += span.ToString(@"hh\:mm\:ss"); ending += span.ToString(@"hh\:mm\:ss");
} }
else { else {
@ -511,18 +509,17 @@ namespace Buypeeb {
if (item.ready) { if (item.ready) {
if (!item.available) { if (!item.available) {
ending = "Ended"; ending = "Ended";
} else { }
else {
var now = DateTime.Now; var now = DateTime.Now;
var end = item.endDate.ToLocalTime(); var end = item.endDate.ToLocalTime();
// TODO: should we show the year if the auction ends next year? 0uo // TODO: should we show the year if the auction ends next year? 0uo
if (end.DayOfYear != now.DayOfYear) if (end.DayOfYear != now.DayOfYear) {
{
// the auction isn't ending today, so we should show the day it's ending on for clarity // 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("MMM d ");
} }
ending += end.ToString("HH:mm"); ending += end.ToString("HH:mm");
if (this.settings.displaySecondsInList) if (this.settings.displaySecondsInList) {
{
// add the seconds on to the end // add the seconds on to the end
ending += end.ToString(":ss"); ending += end.ToString(":ss");
} }