Merge pull request 'xaml-C#/data-binding' (#52) from xaml-C#/data-binding into master
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
Reviewed-on: #52pull/54/head
commit
b0de911d77
@ -0,0 +1,59 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
x:Class="Banquale.Views.Balance.BalanceView">
|
||||||
|
<VerticalStackLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<ListView ItemsSource="{Binding TransactionsList}"
|
||||||
|
SelectionMode="None">
|
||||||
|
|
||||||
|
<ListView.ItemTemplate>
|
||||||
|
|
||||||
|
<DataTemplate>
|
||||||
|
|
||||||
|
<ViewCell>
|
||||||
|
|
||||||
|
<Grid
|
||||||
|
ColumnDefinitions="40, 3*, *"
|
||||||
|
Margin="20, 5, 20, 5"
|
||||||
|
HorizontalOptions="Fill">
|
||||||
|
|
||||||
|
<Grid.GestureRecognizers>
|
||||||
|
<TapGestureRecognizer
|
||||||
|
Tapped="Transaction_Clicked"
|
||||||
|
NumberOfTapsRequired="1" />
|
||||||
|
|
||||||
|
</Grid.GestureRecognizers>
|
||||||
|
|
||||||
|
<Label
|
||||||
|
Text="{Binding Id}"
|
||||||
|
Grid.Column="0"
|
||||||
|
x:Name="transactionId"/>
|
||||||
|
|
||||||
|
<Label
|
||||||
|
Text="{Binding Date, StringFormat='{0:ddd dd MMM yyyy}'}"
|
||||||
|
Grid.Column="1"
|
||||||
|
VerticalOptions="Center"
|
||||||
|
Margin="10, 0, 0, 0"/>
|
||||||
|
|
||||||
|
<Label
|
||||||
|
Text="{Binding Sum, StringFormat='{0} €'}"
|
||||||
|
Grid.Column="2"
|
||||||
|
VerticalOptions="Center"
|
||||||
|
HorizontalOptions="End"
|
||||||
|
Margin="0, 0, 20, 0"/>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
</ViewCell>
|
||||||
|
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
</ListView.ItemTemplate>
|
||||||
|
|
||||||
|
</ListView>
|
||||||
|
|
||||||
|
</VerticalStackLayout>
|
||||||
|
</ContentView>
|
||||||
|
|
@ -1,9 +1,25 @@
|
|||||||
|
using Model;
|
||||||
|
|
||||||
namespace Banquale.Views.Category;
|
namespace Banquale.Views.Category;
|
||||||
|
|
||||||
public partial class CategoryView : ContentView
|
public partial class CategoryView : ContentView
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public Manager Mgr => (App.Current as App).MyManager;
|
||||||
public CategoryView()
|
public CategoryView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
BindingContext = Mgr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void Category_Clicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var selectedItem = (sender as Grid)?.BindingContext as string;
|
||||||
|
if (selectedItem != null)
|
||||||
|
{
|
||||||
|
Mgr.SelectedTransaction.ChangeCategory(selectedItem);
|
||||||
|
await Shell.Current.Navigation.PopAsync();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,24 +1,60 @@
|
|||||||
|
using System.Diagnostics;
|
||||||
using Banquale.Views;
|
using Banquale.Views;
|
||||||
|
using Model;
|
||||||
|
|
||||||
namespace Banquale.Views;
|
namespace Banquale.Views;
|
||||||
|
|
||||||
public partial class ConsultantIdPage : ContentPage
|
public partial class ConsultantIdPage : ContentPage
|
||||||
{
|
{
|
||||||
|
public Manager Mgr => (App.Current as App).MyManager;
|
||||||
|
|
||||||
public ConsultantIdPage()
|
public ConsultantIdPage()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//public async void Connection_Clicked(Object sender, EventArgs e)
|
||||||
|
//{
|
||||||
|
// string id = ident.Text;
|
||||||
|
|
||||||
|
// if (string.IsNullOrWhiteSpace(id))
|
||||||
|
// {
|
||||||
|
// await DisplayAlert("Erreur", "l'id ne doit pas être nulle", "OK");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// await Navigation.PushModalAsync(new Balance.BalancePage());
|
||||||
|
//}
|
||||||
|
|
||||||
public async void Connection_Clicked(Object sender, EventArgs e)
|
public async void Connection_Clicked(Object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
string id = ident.Text;
|
uint currentId = Convert.ToUInt32(ident.Text);
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(ident.Text))
|
||||||
|
{
|
||||||
|
await DisplayAlert("Erreur", "Il faut rentrer un ID", "OK");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentId == 0)
|
||||||
|
{
|
||||||
|
await DisplayAlert("Erreur", "Ce compte est innaccessible", "OK");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(id))
|
Customer customer = Mgr.CustomersList.FirstOrDefault(u => u.Id == currentId);
|
||||||
|
if (customer == null)
|
||||||
{
|
{
|
||||||
await DisplayAlert("Erreur", "l'id ne doit pas être nulle", "OK");
|
await DisplayAlert("Erreur", "L'id entré est incorrect ou n'existe pas.", "OK");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await Navigation.PushModalAsync(new BalancePage());
|
Mgr.SelectedCustomer = customer;
|
||||||
|
|
||||||
|
Debug.WriteLine(Mgr.IsConsultant);
|
||||||
|
|
||||||
|
|
||||||
|
await Navigation.PushModalAsync(new SwitchAccountPage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in new issue