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.
94 lines
2.2 KiB
94 lines
2.2 KiB
using CanYouBuildIt.Model;
|
|
using Microsoft.Maui.Controls;
|
|
using System.Diagnostics;
|
|
using System.Reflection;
|
|
|
|
namespace CanYouBuildIt.Views;
|
|
|
|
public partial class Acceuil : ContentPage
|
|
{
|
|
public Manager manager => (App.Current as App).manager;
|
|
bool connecte = false;
|
|
int user;
|
|
|
|
public Acceuil()
|
|
{
|
|
InitializeComponent();
|
|
BindingContext = manager;
|
|
showGrid();
|
|
}
|
|
|
|
public Acceuil(int iduser)
|
|
{
|
|
InitializeComponent();
|
|
BindingContext = manager;
|
|
connecte = true;
|
|
user = iduser;
|
|
string userN = manager.listUtil[user].username;
|
|
Log.Text = userN;
|
|
showGrid();
|
|
|
|
}
|
|
|
|
//Ancien test
|
|
/*public void AddUtilisater(object sender, EventArgs e)
|
|
{
|
|
Utilisateur utilisateur = new Utilisateur("Util1","pdm1");
|
|
Debug.WriteLine("Utilisateur créé");
|
|
}*/
|
|
|
|
public async void NavFav(object sender, EventArgs e)
|
|
{
|
|
if (connecte)
|
|
await Navigation.PushAsync(new Favoris(user));
|
|
else
|
|
{
|
|
aConnecter.IsVisible = true;
|
|
await Task.Delay(3000);
|
|
aConnecter.IsVisible = false;
|
|
}
|
|
}
|
|
|
|
public async void NavCreds(object sender, EventArgs e)
|
|
{
|
|
await Navigation.PushAsync(new Credits());
|
|
}
|
|
|
|
public async void NavLogin(object sender, EventArgs e)
|
|
{
|
|
await Navigation.PushAsync(new Login());
|
|
}
|
|
|
|
public void ToQuit(object sender, EventArgs e)
|
|
{
|
|
App.Current.Quit();
|
|
}
|
|
|
|
public void showGrid()
|
|
{
|
|
int row = 0;
|
|
for (int i = 0; i < 7 && i < manager.listBuild.Count(); ++i)
|
|
{
|
|
if (i % 2 == 0)
|
|
row = 0;
|
|
else
|
|
row = 1;
|
|
|
|
ImageButton imagebtn = new ImageButton()
|
|
{
|
|
Source = manager.listBuild[i].image,
|
|
HeightRequest = 200
|
|
};
|
|
|
|
Debug.WriteLine("position :");
|
|
Debug.WriteLine(i);
|
|
Debug.WriteLine(row);
|
|
|
|
Grid.SetRow(imagebtn, row);
|
|
Grid.SetColumn(imagebtn, i);
|
|
gridacc.Children.Add(imagebtn);
|
|
|
|
}
|
|
}
|
|
|
|
} |