From eeb10e8926506159031810843f0d183ff0689926 Mon Sep 17 00:00:00 2001 From: hulivet1 Date: Thu, 19 Jan 2023 21:16:41 +0100 Subject: [PATCH] Bind Mobile --- Sources/IHM/Mobile/Dashboard.xaml | 2 ++ Sources/IHM/Mobile/Dashboard.xaml.cs | 5 +---- Sources/IHM/Mobile/MainPage.xaml.cs | 3 ++- Sources/Modele/Manager.cs | 25 ++++++++++++++++++++++++- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/Sources/IHM/Mobile/Dashboard.xaml b/Sources/IHM/Mobile/Dashboard.xaml index 1bc9b00..326ec1c 100644 --- a/Sources/IHM/Mobile/Dashboard.xaml +++ b/Sources/IHM/Mobile/Dashboard.xaml @@ -43,10 +43,12 @@ diff --git a/Sources/IHM/Mobile/Dashboard.xaml.cs b/Sources/IHM/Mobile/Dashboard.xaml.cs index c80dd01..4517864 100644 --- a/Sources/IHM/Mobile/Dashboard.xaml.cs +++ b/Sources/IHM/Mobile/Dashboard.xaml.cs @@ -12,10 +12,7 @@ public partial class DashBoard : ContentPage { InitializeComponent(); Mgr.LoadBanque(); - if (Mgr.SelectedBanque != null) - { - Mgr.LoadCompte(); - } + BindingContext = Mgr; if (Mgr.User == null) diff --git a/Sources/IHM/Mobile/MainPage.xaml.cs b/Sources/IHM/Mobile/MainPage.xaml.cs index 2781390..5718aab 100644 --- a/Sources/IHM/Mobile/MainPage.xaml.cs +++ b/Sources/IHM/Mobile/MainPage.xaml.cs @@ -28,7 +28,8 @@ namespace IHM.Mobile Mgr.createUser(EntryMail.Text); await Navigation.PopModalAsync(); - Mgr.LoadBanque(); + Mgr.LoadAll(); + } else { diff --git a/Sources/Modele/Manager.cs b/Sources/Modele/Manager.cs index 3f7a6da..b5a8648 100644 --- a/Sources/Modele/Manager.cs +++ b/Sources/Modele/Manager.cs @@ -26,7 +26,7 @@ namespace Model { user = value; OnPropertyChanged(nameof(User)); - LoadBanque(); + //LoadBanque(); } } } @@ -184,6 +184,29 @@ namespace Model } + public async void LoadAll() + { + try + { + ListeDesBanques = await Pers.RecupererBanques(User); + ListeDesComptes.AddRange(await Pers.RecupererCompte(ListeDesBanques.FirstOrDefault())); + foreach (Compte compte in ListeDesComptes) + { + + compte.LesPla = await Pers.RecupererPlanification(compte); + compte.LesOpe = await Pers.RecupererOperation(compte); + compte.LesEch = await Pers.RecupererEcheance(compte); + + } + SelectedBanque = ListeDesBanques.FirstOrDefault(); + SelectedCompte = ListeDesComptes.FirstOrDefault(); + } + catch (Exception exception) + { + Debug.WriteLine(exception.Message); + } + } + public async void LoadBanqueDispo() { try