using GameAtlas.Models;
using GameAtlas.Views;
using GameAtlas.Stub;

namespace GameAtlas;

public partial class App : Application
{

    public string FileName { get; set; } = "data.xml";

    public string FilePath { get; set; } = Path.Combine(AppDomain.CurrentDomain.BaseDirectory);

    public Manager MyManager { get; private set; } = new Manager(new Stub.Stub());//new Manager(new DataContractPersistance.DataContractPers());
    public App()
	{
        InitializeComponent();

        if (File.Exists(Path.Combine(FilePath, FileName)))
		{
			MyManager = new Manager(new DataContractPersistance.DataContractPers());
		}


        MyManager.ChargerDonnees();

        MainPage = new AppShell();


        if (!File.Exists(Path.Combine(FilePath, FileName)))
        {
            MyManager.Persistance = new DataContractPersistance.DataContractPers();
        }


		MyManager.SauvegardeDonnees();
	}
}
