une signature coté serveur
parent
7917f9db81
commit
5e180158d3
@ -0,0 +1,39 @@
|
||||
using BookAStar.Views;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace BookAStar.Behaviors
|
||||
{
|
||||
public class MarkdownViewLengthValidator : Behavior<MarkdownView>
|
||||
{
|
||||
public static readonly BindableProperty MaxLengthProperty = BindableProperty.Create("MaxLength", typeof(int), typeof(MarkdownViewLengthValidator), 0);
|
||||
public static readonly BindableProperty MinLengthProperty = BindableProperty.Create("MinLength", typeof(int), typeof(MarkdownViewLengthValidator), 0);
|
||||
public int MaxLength
|
||||
{
|
||||
get { return (int)GetValue(MaxLengthProperty); }
|
||||
set { SetValue(MaxLengthProperty, value); }
|
||||
}
|
||||
public int MinLength
|
||||
{
|
||||
get { return (int)GetValue(MinLengthProperty); }
|
||||
set { SetValue(MinLengthProperty, value); }
|
||||
}
|
||||
protected override void OnAttachedTo(MarkdownView bindable)
|
||||
{
|
||||
bindable.Modified += bindable_TextChanged;
|
||||
}
|
||||
|
||||
public bool IsValid { get; set; }
|
||||
|
||||
private void bindable_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
IsValid = e.NewTextValue == null ? false : (e.NewTextValue.Length >= MinLength && e.NewTextValue.Length <= MaxLength);
|
||||
if (!IsValid) if (e.NewTextValue != null) if (e.NewTextValue.Length > MaxLength)
|
||||
((Editor)sender).Text = e.NewTextValue.Substring(0, MaxLength);
|
||||
}
|
||||
|
||||
protected override void OnDetachingFrom(MarkdownView bindable)
|
||||
{
|
||||
bindable.Modified -= bindable_TextChanged;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:signature="clr-namespace:SignaturePad.Forms;assembly=SignaturePad.Forms"
|
||||
xmlns:views="clr-namespace:BookAStar.Views;assembly=BookAStar"
|
||||
x:Class="BookAStar.Pages.EstimatePages.EstimateSigningPage">
|
||||
|
||||
|
||||
<ContentPage.Content>
|
||||
<StackLayout Padding="10,10,10,10" x:Name="mainLayout">
|
||||
<ScrollView>
|
||||
<StackLayout>
|
||||
<Grid MinimumHeightRequest="12">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Grid.Row="0" Grid.Column="0" Text="{Binding Client.UserName}" ></Label>
|
||||
<Label Grid.Row="0" Grid.Column="1" Text="{Binding Query.Location.Address}" ></Label>
|
||||
<Label Grid.Row="0" Grid.Column="2" Text="{Binding Query.EventDate, StringFormat='{0:dddd d MMMM yyyy à hh:mm}'}" ></Label>
|
||||
</Grid>
|
||||
|
||||
<Label Text="{Binding Title}" />
|
||||
|
||||
<views:MarkdownView x:Name="mdview"
|
||||
HorizontalOptions="FillAndExpand"
|
||||
Markdown="{Binding Description}"
|
||||
/>
|
||||
<ListView x:Name="billListView" ItemsSource="{Binding Bill}"
|
||||
MinimumHeightRequest="40" HasUnevenRows="true" VerticalOptions="FillAndExpand"
|
||||
HeightRequest="40" >
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate >
|
||||
<ViewCell>
|
||||
<ViewCell.View>
|
||||
<Grid MinimumHeightRequest="12">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="30" />
|
||||
<ColumnDefinition Width="90" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Text="{Binding Description}"
|
||||
Grid.Row="0" Grid.Column="0" ></Label>
|
||||
<Label Text="{Binding Duration, StringFormat=\{0\}}"
|
||||
Grid.Row="0" Grid.Column="1" ></Label>
|
||||
<Label Text="{Binding Count}"
|
||||
Grid.Row="0" Grid.Column="2" ></Label>
|
||||
<Label Text="{Binding UnitaryCost}"
|
||||
Grid.Row="0" Grid.Column="3"
|
||||
FontFamily="Monospace"></Label>
|
||||
</Grid>
|
||||
</ViewCell.View>
|
||||
</ViewCell>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
<Label FormattedText="{Binding FormattedTotal}"/>
|
||||
</StackLayout>
|
||||
</ScrollView>
|
||||
<signature:SignaturePadView x:Name="padView"
|
||||
VerticalOptions="FillAndExpand"
|
||||
HorizontalOptions="FillAndExpand"
|
||||
BackgroundColor="White"
|
||||
CaptionText="Caption This" CaptionTextColor="Black"
|
||||
ClearText="Clear Me!" ClearTextColor="Red"
|
||||
PromptText="Prompt Here" PromptTextColor="Red"
|
||||
SignatureLineColor="Aqua" StrokeColor="Black" StrokeWidth="2" />
|
||||
<Button Clicked="OnValidate" Text="Valider cette signature" x:Name="btnValidate" />
|
||||
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
Loading…
Reference in New Issue