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

65 lines
1.6 KiB

#if WINDOWS
using Microsoft.UI;
using Microsoft.UI.Windowing;
using Windows.Graphics;
#endif
using DataPersistence;
using Model;
using System.Collections.ObjectModel;
using Model.Managers;
using Microsoft.Maui.Controls;
using System.Linq;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using FakePersistance;
namespace Views
{
public partial class App : Application
{
private Recipe currentRecipe { get; set; }
/// <summary>
/// Master manager - access to the Model.
/// </summary>
public MasterManager MasterMgr { get; private set; } = new MasterManager(new Stubs());
/// <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 = MasterMgr.CurrentConnectedUser;
AllRecipes = MasterMgr.DataMgr.GetRecipes("All recipes");
CurrentRecipe = MasterMgr.DataMgr.GetRecipes().First();
InitializeComponent();
UserAppTheme = AppTheme.Light;
MainPage = new Home();
}
}
}