Binding Mobile

pull/143/head
Hugo LIVET 2 years ago
parent c031ce2137
commit 12f7ebad49

@ -11,7 +11,7 @@ public partial class AjoutBanques : ContentPage
{
InitializeComponent();
BindingContext = Mgr;
//Mgr.LoadBanques();
Mgr.LoadBanqueDispo();
if (OperatingSystem.IsIOS())
{
boutonRetour.IsVisible = true;

@ -7,7 +7,8 @@
<Grid.RowDefinitions>
<RowDefinition Height="0.25*"/>
<RowDefinition Height="0.15*"/>
<RowDefinition Height="1.40*"/>
<RowDefinition Height="0.15*"/>
<RowDefinition Height="1.30*"/>
<RowDefinition Height="0.15*"/>
<RowDefinition/>
</Grid.RowDefinitions>
@ -38,16 +39,20 @@
Clicked="Banques_Clicked"/>
<HorizontalStackLayout Grid.Row="1" Grid.ColumnSpan="2" HorizontalOptions="Center" >
<Picker Title="Choisir une Banque"
ItemsSource="{Binding ListeDesBanques}"
ItemDisplayBinding="{Binding Name}"
Margin="0,0,30,0"/>
<Picker Title="Choisir un Compte"
ItemsSource="{Binding ListeDesComptes}"
ItemDisplayBinding="{Binding Nom}"
Margin="30,0,0,0"/>
</HorizontalStackLayout>
<Label Grid.Row="2" Grid.ColumnSpan="2" Text="Liste des Dernières Opérations : " FontAttributes="Bold" FontSize="Body" Padding="20,5,0,0"/>
<Label Grid.Row="1" Grid.ColumnSpan="2" Text="Liste des Dernières Opérations : " FontAttributes="Bold" FontSize="Body" Padding="20,5,0,0"/>
<CollectionView x:Name="DerniereOpe" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2">
<!--User.LesBanques[0].ListeDesComptes[0].LesOpe}-->
<CollectionView ItemsSource="{Binding SelectedCompte.LesOpe}" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2">
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid Margin="0,7,0,7" >
@ -66,12 +71,13 @@
Source="{Binding ImageSrc}"
CornerRadius="10"/>-->
<Label Grid.Row="0" Grid.Column="0"
Text="{Binding IntituleOperation}"
Text="{Binding Nom}"
FontAttributes="Bold"
FontSize="Body"
Margin="50,0,0,0"/>
<Label Grid.Row="1" Grid.Column="0"
Text="{Binding DetailTypeOpe}"
Text="{Binding Tag}"
Margin="50,0,0,0"
FontAttributes="Italic"/>
<Label Grid.Row="0" Grid.Column="2"
Text="{Binding DateOperation}"/>
@ -90,10 +96,10 @@
<Label Grid.Row="3" Grid.ColumnSpan="2" Text="Liste des Comptes favoris :" FontAttributes="Bold" FontSize="Body" Padding="20,0,0,0"/>
<Label Grid.Row="4" Grid.ColumnSpan="2" Text="Liste des Banques favoris :" FontAttributes="Bold" FontSize="Body" Padding="20,0,0,0"/>
<CollectionView Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" ItemsSource="{Binding User.LesBanques}">
<CollectionView Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" ItemsSource="{Binding ListeDesBanques}">
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid>
@ -102,7 +108,7 @@
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Text="{Binding Nom}"
<Label Grid.Column="0" Text="{Binding Name}"
FontAttributes="Bold" FontSize="Body"
HorizontalOptions="Center"
VerticalOptions="Center"/>

@ -7,12 +7,15 @@ public partial class DashBoard : ContentPage
{
public Manager Mgr => (App.Current as App).Manager;
List<Operation> operations;
public DashBoard()
{
InitializeComponent();
//Routing.RegisterRoute(nameof(DashBoard), typeof(DashBoard));
//
Mgr.LoadBanque();
if (Mgr.SelectedBanque != null)
{
Mgr.LoadCompte();
}
BindingContext = Mgr;
if (Mgr.User == null)
@ -21,20 +24,14 @@ public partial class DashBoard : ContentPage
}
operations = new List<Operation>();
operations.Add(new("Internet", 33.44, DateTime.Now, MethodePayement.CB, TagOperation.Divers, false));
operations.Add(new("Course", 45.20, DateTime.Now, MethodePayement.CB, TagOperation.Divers, true));
operations.Add(new("Orange", 50, DateTime.Now, MethodePayement.CB, TagOperation.Divers, true));
operations.Add(new("EDF", 55.80, DateTime.Now, MethodePayement.Virement, TagOperation.Energie, true));
operations.Add(new("Spotify", 33.44, DateTime.Now, MethodePayement.CB, TagOperation.Divers, false));
operations.Add(new("Garage", 45.20, DateTime.Now, MethodePayement.CB, TagOperation.Divers, true));
/*if (!Mgr.Pers.TestConnexion())
{
loadPage(new ErrorPage());
Debug.WriteLine("cc");
}*/
DerniereOpe.ItemsSource = operations;
}

@ -32,8 +32,7 @@
<Label Grid.Row="1" Grid.ColumnSpan="3" Text="Liste de vos banques : " FontAttributes="Bold" FontSize="Body" Padding="20,10,0,0"/>
<ScrollView>
<CollectionView Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" ItemsSource="{Binding User.LesBanques}">
<CollectionView Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" ItemsSource="{Binding ListeDesBanques}">
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid>
@ -42,7 +41,7 @@
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Text="{Binding Nom}"
<Label Grid.Column="0" Text="{Binding Name}"
FontAttributes="Bold" FontSize="Body"
HorizontalOptions="Center"
VerticalOptions="Center"/>
@ -58,7 +57,6 @@
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</ScrollView>
</Grid>

@ -11,7 +11,7 @@ public partial class GestionBanques : ContentPage
{
InitializeComponent();
BindingContext= Mgr;
//Mgr.LoadBanques();
Mgr.LoadBanque();
if (OperatingSystem.IsIOS())
{
boutonRetour.IsVisible = true;

@ -28,7 +28,7 @@ namespace IHM.Mobile
Mgr.createUser(EntryMail.Text);
await Navigation.PopModalAsync();
//Mgr.LoadBanques();
Mgr.LoadBanque();
}
else
{

@ -5,7 +5,7 @@
<ScrollView>
<VerticalStackLayout>
<Label Text="Mes Opérations :" FontAttributes="Bold" Margin="10,10,0,20" FontSize="20"/>
<CollectionView Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" ItemsSource="{Binding }">
<CollectionView Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" ItemsSource="{Binding SelectedCompte.LesOpe}">
<!--User.LesBanques[0].ListeDesComptes[0].LesOpe}-->
<CollectionView.ItemTemplate>
<DataTemplate>
@ -25,13 +25,14 @@
Source="{Binding ImageSrc}"
CornerRadius="10"/>-->
<Label Grid.Row="0" Grid.Column="0"
Text="{Binding IntituleOperation}"
Text="{Binding Nom}"
FontAttributes="Bold"
FontSize="Body"
Margin="50,0,0,0"/>
<Label Grid.Row="1" Grid.Column="0"
Text="{Binding DetailTypeOpe}"
FontAttributes="Italic"/>
Text="{Binding Tag}"
FontAttributes="Italic"
Margin="50,0,0,0"/>
<Label Grid.Row="0" Grid.Column="2"
Text="{Binding DateOperation}"/>
<Label Grid.Row="1" Grid.Column="2"

@ -7,36 +7,11 @@ public partial class Operations : ContentPage
{
public Manager Mgr => (App.Current as App).Manager;
List<Operation> operations;
public Operations()
{
InitializeComponent();
//BindingContext = Mgr;
BindingContext = Mgr;
Mgr.LoadCompte();
operations = new List<Operation>();
operations.Add(new("op", 33.44, DateTime.Now, MethodePayement.CB, TagOperation.Divers, false));
operations.Add(new("course", 45.20, DateTime.Now, MethodePayement.CB, TagOperation.Divers, true));
operations.Add(new("Orange", 50, DateTime.Now, MethodePayement.CB, TagOperation.Divers, true));
operations.Add(new("EDF", 55.80, DateTime.Now, MethodePayement.Virement, TagOperation.Energie, true));
operations.Add(new("op", 33.44, DateTime.Now, MethodePayement.CB, TagOperation.Divers, false));
operations.Add(new("course", 45.20, DateTime.Now, MethodePayement.CB, TagOperation.Divers, true));
operations.Add(new("Orange", 50, DateTime.Now, MethodePayement.CB, TagOperation.Divers, true));
operations.Add(new("EDF", 55.80, DateTime.Now, MethodePayement.Virement, TagOperation.Energie, true));
operations.Add(new("op", 33.44, DateTime.Now, MethodePayement.CB, TagOperation.Divers, false));
operations.Add(new("course", 45.20, DateTime.Now, MethodePayement.CB, TagOperation.Divers, true));
operations.Add(new("Orange", 50, DateTime.Now, MethodePayement.CB, TagOperation.Divers, true));
operations.Add(new("EDF", 55.80, DateTime.Now, MethodePayement.Virement, TagOperation.Energie, true));
operations.Add(new("op", 33.44, DateTime.Now, MethodePayement.CB, TagOperation.Divers, false));
operations.Add(new("course", 45.20, DateTime.Now, MethodePayement.CB, TagOperation.Divers, true));
operations.Add(new("Orange", 50, DateTime.Now, MethodePayement.CB, TagOperation.Divers, true));
operations.Add(new("EDF", 55.80, DateTime.Now, MethodePayement.Virement, TagOperation.Energie, true));
operations.Add(new("op", 33.44, DateTime.Now, MethodePayement.CB, TagOperation.Divers, false));
operations.Add(new("course", 45.20, DateTime.Now, MethodePayement.CB, TagOperation.Divers, true));
operations.Add(new("Orange", 50, DateTime.Now, MethodePayement.CB, TagOperation.Divers, true));
operations.Add(new("EDF", 55.80, DateTime.Now, MethodePayement.Virement, TagOperation.Energie, true));
BindingContext = operations;
}
}

@ -6,7 +6,7 @@
<ScrollView>
<VerticalStackLayout>
<Label Text="Mes Echeances du mois :" FontAttributes="Bold" Margin="10,10,0,20" FontSize="20"/>
<CollectionView x:Name="Ech">
<CollectionView ItemsSource="{Binding SelectedCompte.LesEch}">
<!--User.LesBanques[0].ListeDesComptes[0].LesOpe}-->
<CollectionView.ItemTemplate>
<DataTemplate>
@ -26,13 +26,14 @@
Source="{Binding ImageSrc}"
CornerRadius="10"/>-->
<Label Grid.Row="0" Grid.Column="0"
Text="{Binding IntituleOperation}"
Text="{Binding Nom}"
FontAttributes="Bold"
FontSize="Body"
Margin="50,0,0,0"/>
<Label Grid.Row="1" Grid.Column="0"
Text="{Binding DetailTypeOpe}"
FontAttributes="Italic"/>
Text="{Binding Tag}"
FontAttributes="Italic"
Margin="50,0,0,0"/>
<Label Grid.Row="0" Grid.Column="2"
Text="{Binding DateOperation}"/>
<Label Grid.Row="1" Grid.Column="2"

@ -5,23 +5,11 @@ namespace IHM.Mobile;
public partial class Planification : ContentPage
{
public Manager Mgr => (App.Current as App).Manager;
List<Operation> operations;
public Planification()
{
InitializeComponent();
//BindingContext = Mgr;
//Routing.RegisterRoute(nameof(DashBoard), typeof(DashBoard));
operations = new List<Operation>();
operations.Add(new("Vulcan Mag", 3.44, DateTime.Now, MethodePayement.CB, TagOperation.Divers, false));
operations.Add(new("Apple Music", 45.20, DateTime.Now, MethodePayement.CB, TagOperation.Divers, true));
operations.Add(new("Orange", 50, DateTime.Now, MethodePayement.CB, TagOperation.Divers, true));
operations.Add(new("EDF", 55.80, DateTime.Now, MethodePayement.Virement, TagOperation.Energie, true));
Ech.ItemsSource = operations;
BindingContext = Mgr;
Mgr.LoadCompte();
}

@ -1,27 +1,32 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public class BanqueInscrit
public class BanqueInscrit : INotifyPropertyChanged
{
public int Id { get; private set; }
public string Name { get; private set; }
public event PropertyChangedEventHandler PropertyChanged;
public string Name { get; set; }
public int Id { get; set; }
[JsonConstructor]
public BanqueInscrit(int id, string name)
public BanqueInscrit(int id, string nomBanque)
{
Id = id;
Name = name;
Name = nomBanque;
}
void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
public override string ToString()
{
return Id + " " + Name;
return Name + " " + Id;
}
}
}

@ -24,7 +24,21 @@ namespace Model
}
private IList<Operation> lesOpe = new List<Operation>();
public IList<Planification> LesPla { get; set; } = new List<Planification>();
public IList<Echeance> LesEch { get; set; } = new List<Echeance>();
public IList<Echeance> LesEch
{
get => lesEch;
set
{
if (lesEch != value)
{
lesEch = value;
OnPropertyChanged(nameof(LesEch));
}
}
}
private IList<Echeance> lesEch = new List<Echeance>();
//public IList<Echeance> LesEch { get; set; } = new List<Echeance>();
[JsonConstructor]
public Compte(string id, string nom)

@ -41,6 +41,7 @@ namespace Model
{
selectedBanque = value;
OnPropertyChanged(nameof(SelectedBanque));
LoadCompte();
}
}
}
@ -76,19 +77,57 @@ namespace Model
private Compte selectedCompte;
public IList<BanqueInscrit> ListeDesBanques
{
get => listeDesBanques;
set
{
if (listeDesBanques != value)
{
listeDesBanques = value;
OnPropertyChanged(nameof(ListeDesBanques));
}
}
}
private IList<BanqueInscrit> listeDesBanques = new List<BanqueInscrit>();
public ReadOnlyCollection<BanqueInscrit> AllBanque { get; private set; }
//private IList<BanqueInscrit> listeDesBanques = new List<BanqueInscrit>();
/*public ReadOnlyCollection<BanqueInscrit> AllBanque
{
get => allBanque;
set
{
if (allBanque != value)
{
allBanque = value;
OnPropertyChanged(nameof(AllBanque));
}
}
}
private ReadOnlyCollection<BanqueInscrit> allBanque;*/
public List<Compte> ListeDesComptes
{
get => listeDesComptes;
set
{
if (listeDesComptes != value)
{
listeDesComptes = value;
OnPropertyChanged(nameof(ListeDesComptes));
}
}
}
private List<Compte> listeDesComptes = new List<Compte>();
public ReadOnlyCollection<Compte> AllCompte { get; private set; }
//public ReadOnlyCollection<Compte> AllCompte { get; private set; }
public Manager(IPersistanceManager persistance)
{
AllBanque = new ReadOnlyCollection<BanqueInscrit>(listeDesBanques);
AllCompte = new ReadOnlyCollection<Compte>(listeDesComptes);
//AllBanque = new ReadOnlyCollection<BanqueInscrit>(listeDesBanques);
//AllCompte = new ReadOnlyCollection<Compte>(listeDesComptes);
Pers = persistance;
}
@ -99,7 +138,7 @@ namespace Model
public async void LoadCompte()
{
listeDesComptes.Clear();
ListeDesComptes.Clear();
if(SelectedBanque == null)
{
@ -109,8 +148,8 @@ namespace Model
try
{
IList<Compte> comptes = await Pers.RecupererCompte(SelectedBanque);
listeDesComptes.AddRange(comptes);
foreach (Compte compte in listeDesComptes)
ListeDesComptes.AddRange(comptes);
foreach (Compte compte in ListeDesComptes)
{
compte.LesPla = await Pers.RecupererPlanification(compte);
@ -119,12 +158,9 @@ namespace Model
}
if (listeDesComptes.Count > 0)
{
selectedCompte = listeDesComptes.First();
}
SelectedCompte = listeDesComptes.FirstOrDefault();
SelectedCompte = ListeDesComptes.FirstOrDefault();
}
catch(Exception exception)
{
@ -137,8 +173,8 @@ namespace Model
{
try
{
listeDesBanques = await Pers.RecupererBanques(User);
SelectedBanque = listeDesBanques.FirstOrDefault();
ListeDesBanques = await Pers.RecupererBanques(User);
SelectedBanque = ListeDesBanques.FirstOrDefault();
}
catch (Exception exception)

Loading…
Cancel
Save