using HelloXaml.Models;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace HelloXaml;

public sealed partial class MainWindow : Window
{

    public Person newPerson { get; set; }

    public ObservableCollection<Person> people { get; set; } = new ObservableCollection<Person>
    {
        new Person { Name = "Ferenc", Age = 30 },
        new Person { Name = "Ubul", Age = 25 },
    };
    public MainWindow()
    {
        InitializeComponent();

        //Button b = new Button();
        //b.Content = "Record";
        //rootGrid.Children.Add(b);

        newPerson = new Person { Name = "Hugh E. Rection", Age = 42 };

    }

    /*private void Button_Click(object sender, RoutedEventArgs e)
    {
        //MessageBox.Show("Hello World!");
        //var person = new Models.Person { Name = "Alice", Age = 30 };
        //person.Name = "Bob";
        recordTextBlock.Text = "Recording";
    }*/

    private void Decrease_Button(object sender, RoutedEventArgs e)
    {
        newPerson.Age--;
        tbAge.Text = newPerson.Age.ToString();
    }

    private void Increase_Button(object sender, RoutedEventArgs e)
    {
        newPerson.Age++;
        tbAge.Text = newPerson.Age.ToString();
    }

    private void AddButtonClick(object sender, RoutedEventArgs e)
    {
        people.Add(new Person { Name = newPerson.Name, Age = newPerson.Age });
        newPerson.Name = string.Empty;
        newPerson.Age = 0;


    }

}
