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.
70 lines
2.3 KiB
70 lines
2.3 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;
|
|
|
|
namespace Views
|
|
{
|
|
public partial class App : Application
|
|
{
|
|
//Point d'entrée de l'application
|
|
public MasterManager MasterMgr { get; private set; } = new MasterManager(new Stubs());
|
|
//L'utilisateur courant de l'application
|
|
public User CurrentUser { get; set; }
|
|
private Recipe currentRecipe { get; set; }
|
|
public Recipe CurrentRecipe
|
|
{
|
|
get => currentRecipe;
|
|
set
|
|
{
|
|
currentRecipe = value;
|
|
OnPropertyChanged(nameof(CurrentRecipe));
|
|
}
|
|
}
|
|
|
|
//collection de recette de l'application
|
|
public RecipeCollection AllRecipes { get; set; }
|
|
|
|
//const int WindowWidth = 1200;
|
|
//const int WindowHeight = 800;
|
|
|
|
public App()
|
|
{
|
|
CurrentUser = MasterMgr.DataMgr.GetUsers().Last();
|
|
AllRecipes = MasterMgr.DataMgr.GetRecipes("All recipes");
|
|
CurrentRecipe = MasterMgr.DataMgr.GetRecipes().First();
|
|
InitializeComponent();
|
|
|
|
// Microsoft.Maui.Handlers.WindowHandler.Mapper.AppendToMapping(nameof(IWindow), (handler, view) =>
|
|
// {
|
|
//#if WINDOWS
|
|
// var mauiWindow = handler.VirtualView;
|
|
// var nativeWindow = handler.PlatformView;
|
|
// nativeWindow.Activate();
|
|
// IntPtr windowHandle = WinRT.Interop.WindowNative.GetWindowHandle(nativeWindow);
|
|
// WindowId windowId = Microsoft.UI.Win32Interop.GetWindowIdFromWindow(windowHandle);
|
|
// AppWindow appWindow = Microsoft.UI.Windowing.AppWindow.GetFromWindowId(windowId);
|
|
// appWindow.Resize(new SizeInt32(WindowWidth, WindowHeight));
|
|
//#endif
|
|
// });
|
|
|
|
|
|
/* - Comment(ctrl-k + ctrl-c)/Uncomment(ctrl-k + ctrl-u) to change page - */
|
|
UserAppTheme = AppTheme.Light;
|
|
MainPage = new Home();
|
|
//MainPage = new MyPosts();
|
|
}
|
|
|
|
}
|
|
}
|