Sample 03: list of all terminal descriptions
The HardwareDescriptionProvider class makes all terminal descriptions available via the read-only collection TerminalDescriptions. The desired terminal description can be read out using the static method GetTerminalDecription.
Sample C#
public partial class MainWindow : Window
{
BAProjectBuilder projectBuilder = null;
public MainWindow(AddInEntryPoint addInEntryPoint)
{
InitializeComponent();
// Code here
this.projectBuilder = new BAProjectBuilder();
}
private void buttonGetDescriptions_Click(object sender, RoutedEventArgs e)
{
List<string> items = new List<string>();
foreach (TerminalDescription td in this.projectBuilder.HardwareDescriptionProvider.TerminalDescriptions)
{
items.Add(td.Abbreviation);
}
listBoxDescriptions.ItemsSource = items;
}
private void listBoxDescriptions_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
TerminalDescription td = this.projectBuilder.HardwareDescriptionProvider.GetTerminalDescription((string)listBoxDescriptions.SelectedItem);
List<string> items = new List<string>();
items.Add("Name:\t" + td.Name);
items.Add("Summary:\t" + td.Summary);
items.Add("Type:\t\t" + td.Type);
listBoxInfo.ItemsSource = items;
}
}