From 37f6961afe8785496eb7244e1b321ee92a260ef5 Mon Sep 17 00:00:00 2001 From: hulivet1 Date: Mon, 17 Oct 2022 09:30:45 +0200 Subject: [PATCH] =?UTF-8?q?D=C3=A9tection=20de=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Code/IHM/App.xaml.cs | 2 ++ .../Converters/Func2WindowPartConverter.cs | 28 +++++++++++++++++++ Code/IHM/MainWindow.xaml.cs | 3 +- Code/LinqToPgSQL/PersLinqToPgSQL.cs | 3 +- Code/Model/Stub.cs | 2 ++ 5 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 Code/IHM/Converters/Func2WindowPartConverter.cs diff --git a/Code/IHM/App.xaml.cs b/Code/IHM/App.xaml.cs index d606932..c799256 100644 --- a/Code/IHM/App.xaml.cs +++ b/Code/IHM/App.xaml.cs @@ -16,5 +16,7 @@ namespace IHM public partial class App : Application { public Manager AllInscrits { get; private set; } = new Manager(new LinqToPgSQL.PersLinqToPgSQL()); + //public Manager AllInscrits { get; private set; } = new Manager(new Stub()); + } } diff --git a/Code/IHM/Converters/Func2WindowPartConverter.cs b/Code/IHM/Converters/Func2WindowPartConverter.cs new file mode 100644 index 0000000..d825da7 --- /dev/null +++ b/Code/IHM/Converters/Func2WindowPartConverter.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Controls; +using System.Windows.Data; + +namespace IHM.Converters +{ + public class Func2WindowPartConverter : IValueConverter + { + public object? Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + Func? windowPartCreator = value as Func; + if (windowPartCreator == null) + { + return null; + } + return windowPartCreator(); + } + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Code/IHM/MainWindow.xaml.cs b/Code/IHM/MainWindow.xaml.cs index 7fb459a..568fc61 100644 --- a/Code/IHM/MainWindow.xaml.cs +++ b/Code/IHM/MainWindow.xaml.cs @@ -61,7 +61,8 @@ namespace IHM private void test_Click(object sender, RoutedEventArgs e) { - testSelect(); + //testSelect(); } + } } diff --git a/Code/LinqToPgSQL/PersLinqToPgSQL.cs b/Code/LinqToPgSQL/PersLinqToPgSQL.cs index a7306e1..53d3ecc 100644 --- a/Code/LinqToPgSQL/PersLinqToPgSQL.cs +++ b/Code/LinqToPgSQL/PersLinqToPgSQL.cs @@ -33,7 +33,8 @@ namespace LinqToPgSQL var conn = new NpgsqlConnection(connString); Console.Out.WriteLine("Ouverture de la connection"); - conn.Open(); + conn.Open();//gérer l'exception ! + //pb de pare-feu a l'iut var AllInscrit = new NpgsqlCommand("SELECT * FROM Inscrit", conn); diff --git a/Code/Model/Stub.cs b/Code/Model/Stub.cs index 1a671fb..42b3df6 100644 --- a/Code/Model/Stub.cs +++ b/Code/Model/Stub.cs @@ -12,6 +12,8 @@ namespace Model public List Inscrits = new(); public List Comptes = new(); + + // ajouter load all pour tout les inscrits public List LoadInscrit()