12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- using System.Windows;
- using WpfApp2.model;
- namespace WpfApp2
- {
- /// <summary>
- /// Interaction logic for MainWindow.xaml
- /// </summary>
- public partial class MainWindow : Window
- {
- public IEnumerable<Hero> HeroList { get; set; }
- public MainWindow()
- {
- InitializeComponent();
- DataContext = this;
- Globals.dataProvider = new LocalDataProvider();
- HeroList = Globals.dataProvider.getPerson();
- }
- private void ExitButton_Click(object sender, RoutedEventArgs e)
- {
- Application.Current.Shutdown();
- }
- }
- interface IDataProvider
- {
- IEnumerable<Hero> getPerson();
- }
- public class LocalDataProvider : IDataProvider
- {
- public IEnumerable<Hero> getPerson()
- {
- return new Hero[]{
- new Hero{
- race="Человек",
- name="Invoker"},
- new Hero{
- race="Огр",
- name="Orge Magi"},
- new Hero{
- race="Дракон",
- name="Viper"},
- };
- }
- }
- }
|