it's not perfect but it'll do
This commit is contained in:
parent
bc6d5b4fbb
commit
a84e585d21
1 changed files with 10 additions and 24 deletions
|
@ -23,6 +23,7 @@ using System.Text.RegularExpressions;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Net;
|
||||||
using Gtk;
|
using Gtk;
|
||||||
|
|
||||||
namespace Buypeeb {
|
namespace Buypeeb {
|
||||||
|
@ -86,35 +87,20 @@ namespace Buypeeb {
|
||||||
this.RenderList();
|
this.RenderList();
|
||||||
|
|
||||||
this.itemTreeView.Model = this.items;
|
this.itemTreeView.Model = this.items;
|
||||||
|
TreeCellDataFunc[] funcs = {
|
||||||
|
new TreeCellDataFunc(this.RenderColumnName),
|
||||||
|
new TreeCellDataFunc(this.RenderColumnPriceYen),
|
||||||
|
new TreeCellDataFunc(this.RenderColumnPriceAUD),
|
||||||
|
new TreeCellDataFunc(this.RenderColumnEnding)
|
||||||
|
};
|
||||||
|
|
||||||
for (int i = 0; i < this.itemTreeView.Columns.Length; i++) {
|
for (int i = 0; i < this.itemTreeView.Columns.Length; i++) {
|
||||||
var c = this.itemTreeView.Columns[i];
|
var c = this.itemTreeView.Columns[i];
|
||||||
TreeCellDataFunc func;
|
|
||||||
|
|
||||||
//TODO: get rid of this awful if statement
|
c.SetCellDataFunc(c.Cells[0], funcs[i]);
|
||||||
|
|
||||||
if (i == ItemColumns.Name) {
|
|
||||||
func = new TreeCellDataFunc(this.RenderColumnName);
|
|
||||||
}
|
|
||||||
else if (i == ItemColumns.PriceYen) {
|
|
||||||
func = new TreeCellDataFunc(this.RenderColumnPriceYen);
|
|
||||||
}
|
|
||||||
else if (i == ItemColumns.PriceAUD) {
|
|
||||||
func = new TreeCellDataFunc(this.RenderColumnPriceAUD);
|
|
||||||
}
|
|
||||||
else if (i == ItemColumns.Ending) {
|
|
||||||
func = new TreeCellDataFunc(this.RenderColumnEnding);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Console.WriteLine($"unexpected value {i}!");
|
|
||||||
throw new IndexOutOfRangeException();
|
|
||||||
}
|
|
||||||
|
|
||||||
c.SetCellDataFunc(c.Cells[0], func);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (object[] row in this.items) {
|
this.UpdateItems();
|
||||||
Console.WriteLine(row[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
DeleteEvent += Window_Shutdown;
|
DeleteEvent += Window_Shutdown;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue