put the timers above the column renderers
This commit is contained in:
parent
d3daf1f6eb
commit
1020745e82
1 changed files with 34 additions and 34 deletions
|
@ -423,6 +423,40 @@ namespace Buypeeb {
|
|||
this.UpdateItem(this.selectedItem.id);
|
||||
}
|
||||
|
||||
// timers
|
||||
|
||||
private bool UpdateSelectionEndTime() {
|
||||
if (!this.selectionViewBox.IsSensitive) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var item = this.selectedItem;
|
||||
if (!item.ready) {
|
||||
return true;
|
||||
}
|
||||
|
||||
string ending = "";
|
||||
if (item.available) {
|
||||
var now = DateTime.Now;
|
||||
var end = item.endDate.ToLocalTime();
|
||||
var span = end.Subtract(now);
|
||||
|
||||
if (span.Days > 0) {
|
||||
ending += span.ToString("dd' days, '"); // will format twelve days as "12 days, "
|
||||
}
|
||||
// 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
|
||||
// see https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-timespan-format-strings
|
||||
ending += span.ToString(@"hh\:mm\:ss");
|
||||
}
|
||||
else {
|
||||
ending = "Auction has ended";
|
||||
}
|
||||
|
||||
this.endingLabel.Text = ending;
|
||||
return true;
|
||||
}
|
||||
|
||||
// column renderers
|
||||
|
||||
private void RenderColumnName(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.ITreeModel model, Gtk.TreeIter iter) {
|
||||
|
@ -459,39 +493,5 @@ namespace Buypeeb {
|
|||
}
|
||||
(cell as Gtk.CellRendererText).Text = item.ready ? ending : "...";
|
||||
}
|
||||
|
||||
// timers
|
||||
|
||||
private bool UpdateSelectionEndTime() {
|
||||
if (!this.selectionViewBox.IsSensitive) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var item = this.selectedItem;
|
||||
if (!item.ready) {
|
||||
return true;
|
||||
}
|
||||
|
||||
string ending = "";
|
||||
if (item.available) {
|
||||
var now = DateTime.Now;
|
||||
var end = item.endDate.ToLocalTime();
|
||||
var span = end.Subtract(now);
|
||||
|
||||
if (span.Days > 0) {
|
||||
ending += span.ToString("dd' days, '"); // will format twelve days as "12 days, "
|
||||
}
|
||||
// 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
|
||||
// see https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-timespan-format-strings
|
||||
ending += span.ToString(@"hh\:mm\:ss");
|
||||
}
|
||||
else {
|
||||
ending = "Auction has ended";
|
||||
}
|
||||
|
||||
this.endingLabel.Text = ending;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue