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.
sae201_qwirkle/Qwirkle/QwirkleViews/App.xaml.cs

48 lines
1.5 KiB

using Qwirkle.Views;
using Microsoft.Maui.Controls;
using Qwirkle.Pages;
using QwirkleClassLibrary.Games;
using QwirkleClassLibrary.Persistences;
using QwirkleClassLibrary.Players;
using Leaderboard = QwirkleClassLibrary.Players.Leaderboard;
namespace Qwirkle
{
public partial class App
{
public App()
{
string appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
string targetPath = Path.Combine(appDataPath, "Programs", "Files");
Directory.CreateDirectory(targetPath);
Directory.SetCurrentDirectory(targetPath);
InitializeComponent();
//MainPage = new NavigationPage(new MainPage());
MainPage = new AppShell();
Routing.RegisterRoute(nameof(SetPlayers), typeof(SetPlayers));
Routing.RegisterRoute(nameof(Gameboard), typeof(Gameboard));
Routing.RegisterRoute(nameof(Rules), typeof(Rules));
Routing.RegisterRoute(nameof(MainPage), typeof(MainPage));
Routing.RegisterRoute(nameof(Qwirkle.Pages.Leaderboard), typeof(Qwirkle.Pages.Leaderboard));
ILeaderboardPersistence leaderboardLoad = new LeaderboardPersistenceJson();
try
{
Ld = leaderboardLoad.LoadLeaderboard();
}
catch
{
Ld = new Leaderboard();
}
}
public Game Game { get; set; } = new();
public Leaderboard Ld { get; set; }
}
}