/// <summary> /// Adds the pertinent rows to the list view /// </summary> public override void RenderItems() { ItemListView.BeginUpdate(); ItemListView.Columns.Clear(); ItemListView.Columns.AddRange(new[] { new ColumnHeader { Text = "Train" }, new ColumnHeader { Text = "Date" }, new ColumnHeader { Text = "Product" }, new ColumnHeader { Text = "Weight" } }); ItemListView.Items.Clear(); foreach (var trip in this.dao.ReadAll()) { var item = new ListViewItem(new[] { trip.Train.ToString(), trip.Date.ToSQLiteDateFormat(), trip.Product.ToString(), trip.TonsTransported.ToString("N") + " t", }) { Tag = trip }; ItemListView.Items.Add(item); } ItemListView.EndUpdate(); foreach (ColumnHeader header in ItemListView.Columns) { // HACK: ensure the text fits the column width header.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); header.Width += 8; } OnItemListViewSelectionChanged(this, new EventArgs()); }
/// <summary> /// Adds the pertinent rows to the list view /// </summary> public override void RenderItems() { ItemListView.BeginUpdate(); ItemListView.Columns.Clear(); ItemListView.Columns.AddRange(new[] { new ColumnHeader { Text = "Product" }, new ColumnHeader { Text = "Date" }, new ColumnHeader { Text = "Value" } }); ItemListView.Items.Clear(); foreach (var price in this.dao.ReadAll()) { var item = new ListViewItem(new[] { price.Product.ToString(), price.Date.ToString("d"), price.EurosPerTon.ToString("N") + " €/t" }) { Tag = price }; ItemListView.Items.Add(item); } ItemListView.EndUpdate(); foreach (ColumnHeader header in ItemListView.Columns) { // HACK: ensure the text fits the column width header.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); header.Width += 8; } OnItemListViewSelectionChanged(this, new EventArgs()); }
/// <summary> /// Adds the pertinent rows to the list view /// </summary> public override void RenderItems() { ItemListView.BeginUpdate(); ItemListView.Columns.Clear(); ItemListView.Columns.AddRange(new[] { new ColumnHeader { Text = "ID" }, new ColumnHeader { Text = "Description" }, new ColumnHeader { Text = "Max. Capacity" } }); ItemListView.Items.Clear(); foreach (var trainType in this.dao.ReadAll()) { ItemListView.Items.Add(new ListViewItem(new[] { '#' + trainType.ID.ToString(), trainType.Description, trainType.MaximumCapacity.ToString("N") + " t" }) { Tag = trainType }); } ItemListView.EndUpdate(); foreach (ColumnHeader header in ItemListView.Columns) { // HACK: ensure the text fits the column width header.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); header.Width += 8; } OnItemListViewSelectionChanged(this, new EventArgs()); }
/// <summary> /// Adds the pertinent rows to the list view /// </summary> public override void RenderItems() { ItemListView.BeginUpdate(); ItemListView.Columns.Clear(); ItemListView.Columns.AddRange(new[] { new ColumnHeader { Text = "ID" }, new ColumnHeader { Text = "Type" }, }); ItemListView.Items.Clear(); foreach (var train in this.dao.ReadAll()) { ItemListView.Items.Add(new ListViewItem(new[] { train.ID, train.Type.ToString() }) { Tag = train }); } ItemListView.EndUpdate(); foreach (ColumnHeader header in ItemListView.Columns) { // HACK: ensure the text fits the column width header.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); header.Width += 8; } OnItemListViewSelectionChanged(this, new EventArgs()); }