Binding
Nicolas MAYE 2 years ago
commit 717ab23930

@ -7,9 +7,13 @@
<Grid BackgroundColor="{StaticResource Tertiary}">
<Grid.RowDefinitions>
<RowDefinition Height="0.25*"/>
<RowDefinition Height="0.25*"/>
<RowDefinition Height="0.1*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="0.1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
@ -28,10 +32,28 @@
Style="{StaticResource TitreWindows}"
/>
<ContentView Grid.Row="2" Grid.Column="0" Grid.RowSpan="2" Grid.ColumnSpan="2" >
<CollectionView Grid.Row="2" Grid.Column="0" Grid.RowSpan="2" Grid.ColumnSpan="2" ItemsSource="{Binding AllBanque}" >
<HorizontalStackLayout Grid.Row="1" Grid.ColumnSpan="2" HorizontalOptions="Center" >
<Picker Title="Choisir une Banque"
TitleColor="Black"
TextColor="Black"
ItemsSource="{Binding ListeDesBanques}"
ItemDisplayBinding="{Binding Name}"
SelectedItem="{Binding SelectedBanque}"
Margin="0,0,30,0"/>
<Picker Title="Choisir un Compte"
ItemsSource="{Binding ListeDesComptes}"
ItemDisplayBinding="{Binding Nom}"
SelectedItem="{Binding SelectedCompte}"
Margin="30,0,0,0"/>
</HorizontalStackLayout>
<Label Grid.Row="2" Grid.Column="0" Grid.RowSpan="2" Grid.ColumnSpan="2"
HorizontalOptions="Center"
Text="Réactualiser mes banques :"
FontSize="20"
TextColor="Black"/>
<ContentView Grid.Row="3" Grid.Column="0" Grid.RowSpan="2" Grid.ColumnSpan="2" >
<CollectionView Grid.Row="2" Grid.Column="0" Grid.RowSpan="2" Grid.ColumnSpan="2" ItemsSource="{Binding ListeDesBanques}" >
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid>
@ -43,10 +65,11 @@
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Text="{Binding Nom}"
<Label Grid.Column="0" Text="{Binding Name}"
FontAttributes="Bold" FontSize="Body"
HorizontalOptions="Center"
VerticalOptions="Center"/>
VerticalOptions="Center"
TextColor="Black"/>
<ImageButton Grid.Column="2" Source="reload_banks.png"
Padding="10" Margin="5"
@ -62,6 +85,69 @@
</CollectionView>
</ContentView>
<Label Grid.Row="4" Grid.Column="0" Grid.RowSpan="2" Grid.ColumnSpan="2"
HorizontalOptions="Center"
Text="Ajouter une banque :"
FontSize="20"
TextColor="Black"/>
<ScrollView Grid.Row="5" Grid.Column="0" Grid.RowSpan="2" Grid.ColumnSpan="2" Scale="0.8">
<VerticalStackLayout>
<Border Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3"
BackgroundColor="{StaticResource Tertiary}"
StrokeShape="RoundRectangle 20" Margin="10">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.75*"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Text="Importer depuis un fichier" TextColor="Black"
FontAttributes="Bold" FontSize="Body"
HorizontalOptions="Center"
VerticalOptions="Center"/>
<ImageButton Grid.Column="2" Source="import_from_file.png"
Padding="10" Margin="5"
CornerRadius="10" HeightRequest="65"
BackgroundColor="{StaticResource Primary}"
Clicked="ImportOFX_Clicked"/>
</Grid>
</Border>
<CollectionView ItemsSource="{Binding BanquesDisponibleInApp}">
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.75*"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Text="{Binding Nom}"
FontAttributes="Bold" FontSize="Body"
HorizontalOptions="Center"
VerticalOptions="Center"
TextColor="Black"/>
<ImageButton Grid.Column="2" Source="add_new_banks.png"
Padding="10" Margin="5"
CornerRadius="10" HeightRequest="65"
BackgroundColor="{StaticResource Primary}"
Clicked="AddBanque_Clicked"/>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
</ScrollView>
</Grid>
</Border>
</ContentView>

@ -11,10 +11,20 @@ public partial class CV_HomePage : ContentView
Mgr.LoadBanque();
Mgr.LoadCompte();
Mgr.LoadBanqueDispo();
BindingContext = Mgr;
}
private void ImportOFX_Clicked(object sender, EventArgs e)
{
}
private void AddBanque_Clicked(object sender, EventArgs e)
{
}
}

@ -27,6 +27,7 @@ public partial class MainPage : ContentPage
Mgr.createUser(EntryMail.Text);
await Navigation.PushAsync(new Dashboard());
//Mgr.LoadAll();
}
else
{

@ -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,22 @@
Clicked="Banques_Clicked"/>
<HorizontalStackLayout Grid.Row="1" Grid.ColumnSpan="2" HorizontalOptions="Center" >
<Picker Title="Choisir une Banque"
ItemsSource="{Binding ListeDesBanques}"
ItemDisplayBinding="{Binding Name}"
SelectedItem="{Binding SelectedBanque}"
Margin="0,0,30,0"/>
<Picker Title="Choisir un Compte"
ItemsSource="{Binding ListeDesComptes}"
ItemDisplayBinding="{Binding Nom}"
SelectedItem="{Binding SelectedCompte}"
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 +73,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 +98,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 +110,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,12 @@ 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();
BindingContext = Mgr;
if (Mgr.User == null)
@ -21,20 +21,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,8 @@ namespace IHM.Mobile
Mgr.createUser(EntryMail.Text);
await Navigation.PopModalAsync();
//Mgr.LoadBanques();
Mgr.LoadAll();
}
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)

@ -26,7 +26,8 @@ namespace Model
{
user = value;
OnPropertyChanged(nameof(User));
LoadBanque();
//LoadBanque();
LoadAll();
}
}
}
@ -41,6 +42,7 @@ namespace Model
{
selectedBanque = value;
OnPropertyChanged(nameof(SelectedBanque));
//LoadCompte();
}
}
}
@ -76,19 +78,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 +139,7 @@ namespace Model
public async void LoadCompte()
{
listeDesComptes.Clear();
ListeDesComptes.Clear();
if(SelectedBanque == null)
{
@ -109,8 +149,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 +159,9 @@ namespace Model
}
if (listeDesComptes.Count > 0)
{
selectedCompte = listeDesComptes.First();
}
SelectedCompte = listeDesComptes.FirstOrDefault();
SelectedCompte = ListeDesComptes.FirstOrDefault();
}
catch(Exception exception)
{
@ -137,8 +174,8 @@ namespace Model
{
try
{
listeDesBanques = await Pers.RecupererBanques(User);
SelectedBanque = listeDesBanques.FirstOrDefault();
ListeDesBanques = await Pers.RecupererBanques(User);
SelectedBanque = ListeDesBanques.FirstOrDefault();
}
catch (Exception exception)
@ -148,6 +185,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

Loading…
Cancel
Save