wip billing

vnext
Paul Schneider 8 years ago
parent 640dd33b25
commit 4f948c5df7
4 changed files with 27 additions and 25 deletions

@ -63,12 +63,12 @@
<Entry.Behaviors> <Entry.Behaviors>
<behaviors:DecimalValidatorBehavior x:Name="unitCostValidator" /> <behaviors:DecimalValidatorBehavior x:Name="unitCostValidator" />
</Entry.Behaviors> </Entry.Behaviors>
<Image x:Name="unitaryCostSuccessErrorImage" </Entry>
Style="{Binding Source={x:Reference unitCostValidator}, <Label Text="€" Style="{StaticResource BigLabel}" />
<Image x:Name="unitaryCostSuccessErrorImage"
Style="{Binding Source={x:Reference unitCostValidator},
Path=IsValid, Path=IsValid,
Converter={StaticResource boolToStyleImage}}" /> Converter={StaticResource boolToStyleImage}}" />
</Entry>
<Label Text="€" Style="{StaticResource BigLabel}" HorizontalTextAlignment="Start"/>
</StackLayout> </StackLayout>
<Button Text="Valider cette ligne de facture" Command="{Binding ValidateCommand}" <Button Text="Valider cette ligne de facture" Command="{Binding ValidateCommand}"
Clicked="OnValidateClicked"></Button> Clicked="OnValidateClicked"></Button>

@ -1,10 +1,5 @@
using BookAStar.ViewModels; using BookAStar.ViewModels;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using Xamarin.Forms; using Xamarin.Forms;
namespace BookAStar.Pages namespace BookAStar.Pages
@ -15,10 +10,11 @@ namespace BookAStar.Pages
{ {
BindingContext = model; BindingContext = model;
InitializeComponent(); InitializeComponent();
} }
public void OnValidateClicked (object sender, EventArgs e) public void OnValidateClicked (object sender, EventArgs e)
{ {
OnBackButtonPressed(); this.Navigation.PopAsync();
} }
} }
} }

@ -58,7 +58,6 @@ namespace BookAStar.ViewModels
{ {
SetProperty<decimal>(ref unitaryCost, value, "UnitaryCost"); SetProperty<decimal>(ref unitaryCost, value, "UnitaryCost");
data.UnitaryCost = value; data.UnitaryCost = value;
UnitaryCostText = value.ToString(unitCostFormat, CultureInfo.InvariantCulture);
} }
} }
protected int durationValue; protected int durationValue;
@ -107,20 +106,9 @@ namespace BookAStar.ViewModels
set set
{ {
if (unitaryCostText != value)
{
try
{
data.UnitaryCost = decimal.Parse(value, CultureInfo.InvariantCulture);
}
catch (Exception)
{
// TODO Error model
// UI should shoud entry as wearing a wrong value
// thanks to its `Behaviors`
}
}
SetProperty<string>(ref unitaryCostText, value, "UnitaryCostText"); SetProperty<string>(ref unitaryCostText, value, "UnitaryCostText");
// TODO update behavior
} }
} }
bool invalidCost; bool invalidCost;

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace BookAStar.Views
{
public partial class CommandLineEditor : ContentView
{
public CommandLineEditor()
{
InitializeComponent();
}
}
}
Loading…