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.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net;
|
||||
using Gtk;
|
||||
|
||||
namespace Buypeeb {
|
||||
|
@ -86,35 +87,20 @@ namespace Buypeeb {
|
|||
this.RenderList();
|
||||
|
||||
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++) {
|
||||
var c = this.itemTreeView.Columns[i];
|
||||
TreeCellDataFunc func;
|
||||
|
||||
//TODO: get rid of this awful if statement
|
||||
|
||||
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);
|
||||
c.SetCellDataFunc(c.Cells[0], funcs[i]);
|
||||
}
|
||||
|
||||
foreach (object[] row in this.items) {
|
||||
Console.WriteLine(row[0]);
|
||||
}
|
||||
this.UpdateItems();
|
||||
|
||||
DeleteEvent += Window_Shutdown;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue