Fusion Modification

Binding
thomas muzard 2 years ago
commit 136e994e30

@ -0,0 +1,49 @@
using ParionsCuite.Modeles;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace ParionsCuite.DataContractPersistance
{
public class DataContractPersistance : IPersistanceManager
{
public string FilePath2 { get; set; } = Path.Combine(Directory.GetCurrentDirectory(), );
public string FilePath { get; set; } = "C:\\User" ;
public string FileName { get; set; }
public List<Evenement> chargeDonnees()
{
var serializer = new DataContractSerializer(typeof(List<Evenement>));
List<Evenement> evenements;
using (Stream s = File.OpenRead(Path.Combine(FilePath, FileName)))
{
evenements = serializer.ReadObject(s) as List<Evenement>;
}
return evenements;
}
public void sauvegardeDonnees(List<Evenement> evenements)
{
var serialiser = new DataContractSerializer (typeof(List<Evenement>));
if (!Directory.Exists(FilePath))
{
Debug.WriteLine("Directory créé à l'instant");
Debug.WriteLine(Directory.GetDirectoryRoot(FilePath));
Debug.WriteLine(FilePath + "\n");
Directory.CreateDirectory(FilePath);
}
using (Stream s = File.Create(Path.Combine(FilePath, FileName)))
{
}
}
}
}

@ -11,7 +11,7 @@
xmlns:boisson="clr-namespace:ParionsCuite.Views.Participations.Boisson"
xmlns:nourriture="clr-namespace:ParionsCuite.Views.Participations"
xmlns:autre="clr-namespace:ParionsCuite.Views.Participations.Autre"
Title="ParionsCuite">
>
<VerticalStackLayout>
@ -53,17 +53,13 @@
<Button Text="Invité" Margin="0,0,20,0"/>
<Button Text="Participant" Grid.Column="1" Margin="0,0,20,0"/>
<Button Text="Pari" Grid.Column="2" BackgroundColor="Grey" Margin="0,0,20,0"/>
<Button Text="Information" Grid.Column="3" Margin="0,0,20,0"/>
<Button Text="Information" Grid.Column="3" Margin="0,0,20,0" Clicked="VueInfo"/>
</HorizontalStackLayout>
</Grid>
<!-- 2e ligne -->
<Grid Grid.Row="1">
<ContentView>
<boisson:Boissons/>
</ContentView>
</Grid>
</Grid>

@ -1,4 +1,6 @@
using Microsoft.VisualBasic;
using System;
using Microsoft.Maui.Controls;
using Microsoft.VisualBasic;
using ParionsCuite.Modeles;
using ParionsCuite.Views.Information;
using ParionsCuite.Views.Participations.Autre;
@ -7,11 +9,16 @@ namespace ParionsCuite;
public partial class MainPage : ContentPage
{
int count = 0;
public MainPage()
{
InitializeComponent();
}
public void VueInfo(object sender, EventArgs e)
{
//changervue
}
}

@ -23,6 +23,11 @@ namespace ParionsCuite.Modeles
{
return $"nom : {Nom} \n";
}
public override int GetHashCode()
{
return HashCode.Combine(Nom);
}
}
}

@ -25,6 +25,10 @@ namespace ParionsCuite.Modeles
return $"nom : {Nom} \n";
}
public override int GetHashCode()
{
return HashCode.Combine(Nom);
}
}
}

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace ParionsCuite.Modeles
{
public interface IPersistanceManager
{
public List<Evenement> chargeDonnees();
public void sauvegardeDonnees(List<Evenement> evenements);
}
}

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
@ -10,6 +11,12 @@ namespace ParionsCuite.Modeles
public class Manageur
{
public List<Evenement> Evenement { get; private set; }
public ReadOnlyCollection<Evenement> Event { get; set; }
public IPersistanceManager Persistance { get; set; }
public Manageur(IPersistanceManager Pers) {
Evenement = new ReadOnlyCollection;
}
public Manageur()
{
@ -54,11 +61,5 @@ namespace ParionsCuite.Modeles
}
public void f(int entier)
{
int n = 0;
entier = entier + n;
}
}
}

@ -22,6 +22,11 @@ namespace ParionsCuite.Modeles
{
return $"nom : {Nom} \n";
}
public override int GetHashCode()
{
return HashCode.Combine(Nom);
}
}
}

@ -1,10 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks>net7.0-maccatalyst</TargetFrameworks>
<!-- <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks> -->
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> -->
<RuntimeIdentifiers>maccatalyst-arm64</RuntimeIdentifiers>
<OutputType>Exe</OutputType>
<RootNamespace>ParionsCuite</RootNamespace>
<UseMaui>true</UseMaui>
@ -83,6 +84,8 @@
<None Remove="Views\Participations\Autre\" />
<None Remove="Views\Participations\Boisson\" />
<None Remove="Modeles\" />
<None Remove="Stub\" />
<None Remove="Test\" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\Images\fleches.png" />
@ -96,5 +99,7 @@
<Folder Include="Views\Participations\Autre\" />
<Folder Include="Views\Participations\Boisson\" />
<Folder Include="Modeles\" />
<Folder Include="Stub\" />
<Folder Include="Test\" />
</ItemGroup>
</Project>

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 25.0.1706.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ParionsCuite", "ParionsCuite.csproj", "{3C605C4F-A3EE-4E08-B43D-692792A3DFCD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3C605C4F-A3EE-4E08-B43D-692792A3DFCD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3C605C4F-A3EE-4E08-B43D-692792A3DFCD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3C605C4F-A3EE-4E08-B43D-692792A3DFCD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3C605C4F-A3EE-4E08-B43D-692792A3DFCD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6A064B44-E657-47A6-9D3E-2585AD56A945}
EndGlobalSection
EndGlobal

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using ParionsCuite.Modeles;
namespace ParionsCuite.Stub;
public class Stub : IPersistanceManager
{
public Stub()
{
}
public List<Evenement> chargeDonnees()
{
List<Evenement> lisEvent = new List<Evenement>();
Boisson b = new("lzn");
var boissons = new Dictionary<Boisson, int>();
boissons[b] = 3;
Nourriture n = new("slkdbv");
var nourriture = new Dictionary<Nourriture, int>();
nourriture[n] = 3;
Autre a = new("skjdbv");
var autre = new Dictionary<Autre, int>();
autre[a] = 3;
DateTime dt = new(2018, 7, 24);
Participation p = new(boissons, nourriture, autre);
Evenement e = new ("nom", dt, "lieu", 12, 23, p);
lisEvent.Add(e);
return lisEvent;
}
public void sauvegardeDonnees(List<Evenement> evenements)
{
throw new NotImplementedException();
}
}
Loading…
Cancel
Save