12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- using System.Windows;
- using WpfApp2.model;
- namespace WpfApp2
- {
- /// <summary>
- /// Interaction logic for MainWindow.xaml
- /// </summary>
- public partial class MainWindow : Window
- {
- public IEnumerable<Product> ProductList { get; set; }
- public MainWindow()
- {
- InitializeComponent();
- DataContext = this;
- Globals.dataProvider = new LocalDataProvider();
- ProductList = Globals.dataProvider.getPerson();
- }
- private void ExitButton_Click(object sender, RoutedEventArgs e)
- {
- Application.Current.Shutdown();
- }
- }
- interface IDataProvider
- {
- IEnumerable<Product> getPerson();
- }
- public class LocalDataProvider : IDataProvider
- {
- public IEnumerable<Product> getPerson()
- {
- return new Product[]{
- new Product{
- name="Микрофон",
- model="NEUMANN TLM 102"},
- new Product{
- name="Мониторы",
- model="SoundStation A-6"},
- new Product{
- name="Звуковая карта",
- model="Focusrite Solo"},
- };
- }
- }
- }
|