I created a WinForms app and added a ListView control to
Form1, setting the properties to detailed view and adding two columns. I then
added a handler for the Load method of the form as shown below and added the
code to read the assets from the database and display them on the “grid”.
using System.Collections.Generic;using System.Windows.Forms;
using BL;
namespace UIAssetTestHarness
{public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void
Form1_Load(object sender, System.EventArgs e)
{// Load the grid with the asset data
BLAssets assets = new BLAssets();
List<UIAsset> assetsList = assets.GetAssets();
foreach (UIAsset asset in assetsList)
{
ListViewItem item = new ListViewItem(asset.AssetTag);
item.SubItems.Add(asset.Description);
lstAssets.Items.Add(item);
}
}
}
}
And that’s it. If I were to pursue this p.o.c any further
it would be to code the BL layer as web services and have the UI consume those.
I’ll be doing that later on.
No comments:
Post a Comment