1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- using System.Diagnostics;
- using System.Text;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- using wpf_template.models;
- namespace wpf_template
- {
- public partial class MainWindow : Window
- {
- public IEnumerable<people> peopleList { get; set; }
- public MainWindow()
- {
- InitializeComponent();
- DataContext = this;
- Globals.dataProvider = new LocalDataProvider();
- peopleList = Globals.dataProvider.getpeople();
- }
- private void ExitButton_Click(object sender, RoutedEventArgs e)
- {
- Application.Current.Shutdown();
- }
- }
- interface IDataProvider
- {
- IEnumerable<people> getpeople();
- }
- public class LocalDataProvider : IDataProvider
- {
- public IEnumerable<people> getpeople()
- {
- return new people[]{
- new people
- {
- price=500,
- name="Марина",
- age=19
- },
- new people
- {
- price=9600,
- name="Вика",
- age=21
- },
- new people
- {
- price=50,
- name="Кристина",
- age=17
- },
- };
- }
- }
- }
- /* public class LocalDataProvider : IDataProvider
- {
- public IEnumerable<places> getplaces()
- {
- return new places[]
- {
- new places
- {
- place = "Йолка",
- price = 500,
- },
- new places
- {
- place = "КБ",
- price = 600,
- },
- new places
- {
- place = "Шарага",
- price = 505
- }
- };
- }
- }
- }
- */
|