Modified DataContract
continuous-integration/drone/push Build is failing Details

pull/26/head
Matheo HERSAN 2 years ago
parent f6d7345ea4
commit 5ea4e1ab41

@ -6,8 +6,8 @@ namespace MangaMap;
public partial class App : Application
{
//public Manager MyManager { get; private set; } = new Manager(new Stub.Stub()); //pour utiliser le stub comme moyen de persistance.
public Manager MyManager { get; private set; } = new Manager(new Stub.DataContract());
public Manager MyManager { get; private set; } = new Manager(new Stub.Stub()); //pour utiliser le stub comme moyen de persistance.
//public Manager MyManager { get; private set; } = new Manager(new Stub.DataContract());
public Admin MyAdmin { get; private set; } = new Admin("test", "test@test.ts", "Pseudo_test");
@ -18,7 +18,7 @@ public partial class App : Application
MyManager.Admins.Add(MyAdmin);
MainPage = new AppShell();
//MyManager.Persistance = new DataContract();
MyManager.Persistance = new DataContract();
MyManager.sauvegarder();
}

@ -7,9 +7,15 @@
xmlns:Views="clr-namespace:MangaMap.Views"
Shell.FlyoutBehavior="Disabled"
Shell.NavBarIsVisible="False"
Shell.TabBarIsVisible="False">
Shell.TabBarIsVisible="True">
<TabBar Route="page">
<ShellContent
Title="HomeDisconnect"
ContentTemplate="{DataTemplate Views:homePageDisconnect}"
Route="homePageDisconnect" />
<ShellContent
Title="Home"
ContentTemplate="{DataTemplate Views:homePage}"

@ -89,6 +89,9 @@
<MauiXaml Update="Views\homePage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\homePageDisconnect.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\listPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>

@ -22,10 +22,19 @@ namespace MangaMap.Stub
var serializer = new DataContractSerializer(typeof(DataToPersist));
DataToPersist data;
using (Stream s = File.OpenRead(Path.Combine(FilePath, FileName)))
{
data = serializer.ReadObject(s) as DataToPersist;
}
if (File.Exists(Path.Combine(FilePath, FileName))) // Vérifiez si le fichier existe
{
using (Stream s = File.OpenRead(Path.Combine(FilePath, FileName)))
{
data = serializer.ReadObject(s) as DataToPersist;
}
}
else
{
data = new DataToPersist(); // Si le fichier n'existe pas, créez une nouvelle liste
}
return (data.Oeuvres, data.Utilisateurs);
}

@ -12,4 +12,5 @@ public partial class homePage : ContentPage
a1.BindingContext = my_manager;
a2.BindingContext = my_manager;
}
}
}

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MangaMap"
x:Class="MangaMap.Views.homePageDisconnect"
xmlns:modeles="clr-namespace:MangaMap.Model"
xmlns:views="clr-namespace:MangaMap.Views.Composants">
<ContentPage.BindingContext>
<modeles:Manager/>
</ContentPage.BindingContext>
<Grid RowDefinitions="40, *">
<local:NewContent1 HeightRequest="40" VerticalOptions="Start" Padding="10, 0"/>
<ScrollView
BackgroundColor="#1E1E1E"
Grid.Row="1">
<VerticalStackLayout
Spacing="70"
VerticalOptions="Center">
<SearchBar Placeholder="Recherche"
CancelButtonColor="Orange"
TextColor="Black"
BackgroundColor="White"
HorizontalTextAlignment="Center"
Margin="30"
/>
<ListView x:Name="a2" ItemsSource="{Binding Oeuvres}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ImageButton
Style="{StaticResource ImageAnime}"
BackgroundColor="Red"
Source="{Binding Affiche}"
/>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<HorizontalStackLayout
Spacing="100"
HorizontalOptions="Center">
<views:StyleBouton/>
<ImageButton
Style="{StaticResource ImageAnime}"
BackgroundColor="Orange"
Source="test.jpg"
/>
<views:StyleBouton/>
<views:StyleBouton/>
</HorizontalStackLayout>
<HorizontalStackLayout
Spacing="100"
HorizontalOptions="Center">
<views:StyleBouton/>
<views:StyleBouton/>
<views:StyleBouton/>
<views:StyleBouton/>
</HorizontalStackLayout>
<HorizontalStackLayout
Spacing="100"
HorizontalOptions="Center">
<views:StyleBouton/>
<views:StyleBouton/>
<views:StyleBouton/>
<views:StyleBouton/>
</HorizontalStackLayout>
<HorizontalStackLayout
Spacing="100"
HorizontalOptions="Center">
<views:StyleBouton/>
<views:StyleBouton/>
<views:StyleBouton/>
<views:StyleBouton/>
</HorizontalStackLayout>
<ListView x:Name="a1" ItemsSource="{Binding Utilisateurs}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Label Text="{Binding Pseudo}" TextColor="White" FontSize="Header"/>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</VerticalStackLayout>
</ScrollView>
</Grid>
</ContentPage>

@ -0,0 +1,9 @@
namespace MangaMap.Views;
public partial class homePageDisconnect : ContentPage
{
public homePageDisconnect()
{
InitializeComponent();
}
}

@ -10,7 +10,7 @@
<StackLayout VerticalOptions="Center" HorizontalOptions="Center" Grid.Row="1">
<Button Text="Deconnexion" Clicked="OnLoginClicked" Margin="0,0,0,30" Style="{StaticResource Bouton}"/>
<Button Text="Deconnexion" Clicked="OnDisconnectClicked" Margin="0,0,0,30" Style="{StaticResource Bouton}"/>
<Button Text="Connexion/Inscription" Clicked="OnLoginClicked" Style="{StaticResource Bouton}"/>

@ -7,6 +7,11 @@ public partial class settingsPage : ContentPage
InitializeComponent();
}
private async void OnDisconnectClicked(object sender, EventArgs e)
{
await Shell.Current.Navigation.PushAsync(new loginPage());
}
private void OnLoginClicked(object sender, EventArgs e)
{
//

Loading…
Cancel
Save