You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SAE-2.01/MCTG/Views/App.xaml.cs

60 lines
1.8 KiB

using Model;
using FakePersistance;
using DataPersistence;
using Managers;
namespace Views
{
public partial class App : Application
{
private Recipe currentRecipe { get; set; }
private static IDataManager _dataManager = new DataDefaultManager(new Stubs());
private static IRecipeManager _recipeManager = new RecipeDefaultManager(_dataManager);
private static IPasswordManager _passwordManager = new PasswordSHA256Manager();
private static IUserManager _userManager = new UserDefaultManager(_dataManager, _passwordManager);
/// <summary>
/// Master manager - access to the Model.
/// </summary>
public static MasterManager Master { get; private set; }
= new MasterManager(_dataManager, _recipeManager, _userManager);
/// <summary>
/// Current selected recipe.
/// </summary>
public Recipe CurrentRecipe
{
get => currentRecipe;
set
{
currentRecipe = value;
OnPropertyChanged(nameof(CurrentRecipe));
}
}
/// <summary>
/// Get the current connected user.
/// </summary>
public User? CurrentUser { get; private set; }
/// <summary>
/// Get all the recipes loaded.
/// </summary>
public RecipeCollection AllRecipes { get; set; }
public App()
{
CurrentUser = Master.User.CurrentConnected;
AllRecipes = Master.Recipe.GetAllRecipes();
CurrentRecipe = AllRecipes.First();
InitializeComponent();
UserAppTheme = AppTheme.Light;
MainPage = new Home();
}
}
}