Wip theme+estimate

vnext
Paul Schneider 8 years ago
parent db675279bb
commit 87c4a7f282
12 changed files with 253 additions and 125 deletions

@ -4,36 +4,63 @@
x:Class="BookAStar.App" > x:Class="BookAStar.App" >
<Application.Resources> <Application.Resources>
<ResourceDictionary> <ResourceDictionary>
<Color x:Key="PageBackgroundColor">#f0f0ff</Color>
<Color x:Key="HeadingTextColor">Black</Color>
<Color x:Key="NormalTextColor">Blue</Color>
<Color x:Key="GroupingTextColor">#5050ff</Color>
<OnPlatform x:TypeArguments="Font" Android="Large" iOS="Large" WinPhone="Large" x:Key="HeaderFont" /> <OnPlatform x:TypeArguments="Font" Android="Large" iOS="Large" WinPhone="Large" x:Key="HeaderFont" />
<OnPlatform x:TypeArguments="Color" Android="Black" iOS="Black" WinPhone="Black" x:Key="PrimaryTextColor" />
<OnPlatform x:TypeArguments="Color" Android="Red" iOS="Red" WinPhone="Red" x:Key="EmphasisTextColor" /> <OnPlatform x:TypeArguments="Color" Android="Red" iOS="Red" WinPhone="Red" x:Key="EmphasisTextColor" />
<OnPlatform x:TypeArguments="Font" Android="40" iOS="60" WinPhone="60" x:Key="LargeFontSize" /> <OnPlatform x:TypeArguments="Font" Android="60" iOS="60" WinPhone="60" x:Key="LargeFontSize" />
<OnPlatform x:TypeArguments="Font" Android="30" iOS="60" WinPhone="60" x:Key="MediumFontSize" /> <OnPlatform x:TypeArguments="Font" Android="50" iOS="50" WinPhone="50" x:Key="MediumFontSize" />
<OnPlatform x:TypeArguments="Font" Android="40" iOS="40" WinPhone="40" x:Key="SmallFontSize" />
<Color x:key="backgroundColor">#30FAFAFA</Color>
<Color x:key="oddColor">#207AFAFA</Color>
<Color x:key="textColor">#FF103010</Color> <Color x:Key="BackgroundColor">#30FAFAFA</Color>
<Color x:key="labelColor">#FF303010</Color> <Color x:Key="OddColor">#207AFAFA</Color>
<Style x:Key="BigEntry" TargetType="Entry"> <Color x:Key="TextColor">#FF103010</Color>
<Setter Property="FontSize" Value="{DynamicResource LargeFontSize}" /> <Color x:Key="LabelColor">#FF303010</Color>
<Style x:Key="LabelPageHeadingStyle" TargetType="Label">
<Setter Property="FontAttributes" Value="Bold" /> <Setter Property="FontAttributes" Value="Bold" />
<Setter Property="HorizontalOptions" Value="Center" />
<Setter Property="TextColor" Value="{StaticResource HeadingTextColor}" />
<Setter Property="FontSize" Value="{StaticResource LargeFontSize}" />
</Style>
<Style x:Key="InputLabelStyle" TargetType="Label">
<Setter Property="FontSize" Value="{StaticResource SmallFontSize}" />
<Setter Property="FontAttributes" Value="Italic" />
<Setter Property="HorizontalOptions" Value="Center" />
<Setter Property="TextColor" Value="{StaticResource GroupingTextColor}" />
</Style> </Style>
<Style x:Key="labelStyle" TargetType="Label">
<Setter Property="TextColor" Value="{DynamicResource EmphasisTextColor}" /> <Style x:Key="LabelStyle" TargetType="Label">
<Setter Property="TextColor" Value="{StaticResource TextColor}" />
<Setter Property="FontAttributes" Value="Bold" /> <Setter Property="FontAttributes" Value="Bold" />
<Setter Property="FontSize" Value="{DynamicResource LargeFontSize}" /> <Setter Property="FontSize" Value="{StaticResource MediumFontSize}" />
<Setter Property="VerticalOptions" Value="Start" /> <Setter Property="VerticalOptions" Value="Start" />
<Setter Property="HorizontalOptions" Value="Start" />
<Setter Property="LineBreakMode" Value="WordWrap" /> <Setter Property="LineBreakMode" Value="WordWrap" />
</Style>
<Style x:Key="BigLabel" BasedOn="{StaticResource LabelStyle}" TargetType="Label">
<Setter Property="FontSize" Value="Large" />
</Style>
<Style x:Key="EntryStyle" TargetType="Entry">
<Setter Property="HorizontalOptions" Value="CenterAndExpand"/>
</Style> </Style>
<Style x:Key="entryStyle" TargetType="Entry"> <Style x:Key="PickerStyle" TargetType="Picker">
<Setter Property="HorizontalOptions" Value="FillAndExpand"/> <Setter Property="HorizontalOptions" Value="CenterAndExpand"/>
</Style> </Style>
<Style x:key="backbroundStyle" TargetType="VisualElement"> <Style x:Key="BigEntry" TargetType="Entry" BasedOn="{StaticResource EntryStyle}">
<Setter Property="BackgoundColor" Value="{StaticResource backgroundColor}" /> <Setter Property="FontSize" Value="{StaticResource LargeFontSize}" />
<Setter Property="TextColor" Value="{StaticResource textColor}" /> <Setter Property="FontAttributes" Value="Bold" />
</Style> </Style>
<Style x:Key="buttonStyle" TargetType="Button">
<Style x:Key="ButtonStyle" TargetType="Button">
<Setter Property="HorizontalOptions" Value="Center" /> <Setter Property="HorizontalOptions" Value="Center" />
<Setter Property="VerticalOptions" Value="CenterAndExpand" /> <Setter Property="VerticalOptions" Value="CenterAndExpand" />
<Setter Property="BorderColor" Value="Lime" /> <Setter Property="BorderColor" Value="Lime" />
@ -42,7 +69,8 @@
<Setter Property="WidthRequest" Value="200" /> <Setter Property="WidthRequest" Value="200" />
<Setter Property="TextColor" Value="Teal" /> <Setter Property="TextColor" Value="Teal" />
</Style> </Style>
<Style x:Key="PageStyle" TargetType="Page">
</Style>
</ResourceDictionary> </ResourceDictionary>
</Application.Resources> </Application.Resources>
</Application> </Application>

@ -18,46 +18,56 @@ namespace BookAStar
{ {
public partial class App : Application // superclass new in 1.3 public partial class App : Application // superclass new in 1.3
{ {
ContentPage deviceInfoPage;
SearchPage searchPage = new SearchPage SearchPage searchPage = new SearchPage
{ {
Title = "Trouvez votre artiste", Title = "Trouvez votre artiste",
Icon = "glyphish_07_map_marker.png" Icon = "glyphish_07_map_marker.png"
}; };
NavigationPage mp; NavigationPage mp;
SettingsPage settingsPage = new SettingsPage SettingsPage settingsPage = new SettingsPage
{ {
Title = "Paramètres", Title = "Paramètres",
Icon = "ic_corp_icon.png" Icon = "ic_corp_icon.png"
}; };
PinPage pinPage = new PinPage PinPage pinPage = new PinPage
{ {
Title = "Carte", Title = "Carte",
Icon = "glyphish_07_map_marker.png" Icon = "glyphish_07_map_marker.png"
}; };
BookQueryPage bookQueryPage = new BookQueryPage {
Title = "Demande de devis"
};
BookQueriesPage bookQueriesPage = new BookQueriesPage
{
Title = "Demandes de devis"
};
EditEstimatePage editEstimate = new EditEstimatePage
{
Title = "Création d'un devis"
};
public static IPlatform PlatformSpecificInstance { get; set; } public static IPlatform PlatformSpecificInstance { get; set; }
public static string AppName { get; set; } public static string AppName { get; set; }
public static App CurrentApp { get { return Current as App; } } public static App CurrentApp { get { return Current as App; } }
public DataManager DataManager { get; set; } = new DataManager(); public DataManager DataManager { get; set; } = new DataManager();
internal void EditCommandLine(CommandLine com)
{
CommandLineEditorPage editCommandLine = new CommandLineEditorPage
{
Title = "Edition d'une ligne de facture",
BindingContext = com
};
mp.Navigation.PushAsync(editCommandLine);
}
public App(IPlatform instance) public App(IPlatform instance)
{ {
deviceInfoPage = new DeviceInfoPage(instance.GetDeviceInfo()); InitializeComponent();
PlatformSpecificInstance = instance; PlatformSpecificInstance = instance;
mp = new NavigationPage(searchPage); mp = new NavigationPage(searchPage)
{
BackgroundColor = (Color)Application.Current.Resources["PageBackgroundColor"]
};
var color = Application.Current.Resources["PageBackgroundColor"];
//var hasLabelStyle = r.ContainsKey("labelStyle"); //var hasLabelStyle = r.ContainsKey("labelStyle");
// var stid = this.StyleId; // var stid = this.StyleId;
// null var appsstyle = settingsPage.Style; // null var appsstyle = settingsPage.Style;
@ -80,7 +90,12 @@ namespace BookAStar
tiQueries.Clicked += (object sender, EventArgs e) => tiQueries.Clicked += (object sender, EventArgs e) =>
{ {
ShowPage (bookQueriesPage); BookQueriesPage bookQueriesPage = new BookQueriesPage
{
Title = "Demandes de devis"
};
bookQueriesPage.BindingContext = DataManager.BookQueries;
ShowPage(bookQueriesPage);
}; };
mp.ToolbarItems.Add(tiQueries); mp.ToolbarItems.Add(tiQueries);
ToolbarItem tiMap = new ToolbarItem ToolbarItem tiMap = new ToolbarItem
@ -94,14 +109,6 @@ namespace BookAStar
ShowPage(pinPage); ShowPage(pinPage);
}; };
bookQueriesPage.BindingContext = DataManager.BookQueries;
}
public void ShowDeviceInfo()
{
ShowPage(deviceInfoPage);
} }
public void PostDeviceInfo() public void PostDeviceInfo()
@ -113,25 +120,33 @@ namespace BookAStar
public void ShowBookQuery(BookQueryData data) public void ShowBookQuery(BookQueryData data)
{ {
BookQueryPage bookQueryPage = new BookQueryPage
{
Title = "Demande de devis"
};
bookQueryPage.BindingContext = data; bookQueryPage.BindingContext = data;
ShowPage(bookQueryPage); ShowPage(bookQueryPage);
} }
public void EditEstimate(Estimate data) public void EditEstimate(Estimate data)
{ {
EditEstimatePage editEstimate = new EditEstimatePage
{
Title = "Création d'un devis"
};
editEstimate.Estimate = data; editEstimate.Estimate = data;
ShowPage(editEstimate); ShowPage(editEstimate);
} }
// TODO système de persistance de l'état de l'appli
private void ShowPage(Page p) private void ShowPage(Page p)
{ {
if (p.Parent == null) if (p.Parent!=null)
mp.Navigation.PushAsync(p);
else p.Focus();
}
public void CloseWindow()
{ {
mp.Navigation.PopAsync(); mp.Navigation.RemovePage(p);
p.Parent = null;
}
mp.Navigation.PushAsync(p);
} }
} }
} }

@ -25,6 +25,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
@ -33,6 +34,7 @@
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="App.xaml.cs"> <Compile Include="App.xaml.cs">
@ -51,16 +53,15 @@
<Compile Include="Pages\BookQueryPage.xaml.cs"> <Compile Include="Pages\BookQueryPage.xaml.cs">
<DependentUpon>BookQueryPage.xaml</DependentUpon> <DependentUpon>BookQueryPage.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Pages\DeviceInfoPage.cs" /> <Compile Include="Pages\CommandLineEditorPage.xaml.cs">
<DependentUpon>CommandLineEditorPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\EventDetail.xaml.cs"> <Compile Include="Pages\EventDetail.xaml.cs">
<DependentUpon>EventDetail.xaml</DependentUpon> <DependentUpon>EventDetail.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Helpers\MainSettings.cs" /> <Compile Include="Helpers\MainSettings.cs" />
<Compile Include="Helpers\RemoteEntity.cs" /> <Compile Include="Helpers\RemoteEntity.cs" />
<Compile Include="Interfaces\IPlatform.cs" /> <Compile Include="Interfaces\IPlatform.cs" />
<Compile Include="Pages\MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Model\Blog\Blog.cs" /> <Compile Include="Model\Blog\Blog.cs" />
<Compile Include="Model\Blog\BlogTag.cs" /> <Compile Include="Model\Blog\BlogTag.cs" />
<Compile Include="Model\BookQueryData.cs" /> <Compile Include="Model\BookQueryData.cs" />
@ -103,10 +104,10 @@
<Compile Include="Pages\EditEstimatePage.xaml.cs"> <Compile Include="Pages\EditEstimatePage.xaml.cs">
<DependentUpon>EditEstimatePage.xaml</DependentUpon> <DependentUpon>EditEstimatePage.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Pages\MarkdownEditorPage.xaml.cs">
<DependentUpon>MarkdownEditorPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\PinPage.cs" /> <Compile Include="Pages\PinPage.cs" />
<Compile Include="Views\CommandLineEditor.xaml.cs">
<DependentUpon>CommandLineEditor.xaml</DependentUpon>
</Compile>
<Compile Include="Views\MarkdownView.cs" /> <Compile Include="Views\MarkdownView.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Pages\SearchPage.xaml.cs"> <Compile Include="Pages\SearchPage.xaml.cs">
@ -118,10 +119,6 @@
<Compile Include="Model\Tag.cs" /> <Compile Include="Model\Tag.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Pages\MainPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Include="App.xaml"> <EmbeddedResource Include="App.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator> <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
@ -200,25 +197,31 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Pages\MarkdownEditorPage.xaml"> <EmbeddedResource Include="Pages\EditEstimatePage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator> <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Pages\EditEstimatePage.xaml"> <EmbeddedResource Include="Pages\BookQueriesPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator> <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Pages\BookQueriesPage.xaml"> <EmbeddedResource Include="icon-anon.png" />
<Generator>MSBuild:UpdateDesignTimeXaml</Generator> </ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Views\CommandLineEditor.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="icon-anon.png" /> <EmbeddedResource Include="Pages\CommandLineEditorPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="..\..\packages\Xamarin.Forms.2.3.0.107\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.2.3.0.107\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" /> <Import Project="..\..\packages\Xamarin.Forms.2.3.0.107\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.2.3.0.107\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />

@ -1,12 +1,12 @@
 
using System;
namespace BookAStar.Model.Workflow namespace BookAStar.Model.Workflow
{ {
public class CommandLine public class CommandLine
{ {
public long Id { get; set; } public string Description { get; set; }
public string Comment { get; set; } public TimeSpan Duration { get; set; }
public BaseProduct Article { get; set; }
public int Count { get; set; } public int Count { get; set; }
public decimal UnitaryCost { get; set; } public decimal UnitaryCost { get; set; }
} }

@ -3,6 +3,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xamarin.Forms;
namespace BookAStar.Model.Workflow namespace BookAStar.Model.Workflow
{ {
@ -67,5 +68,32 @@ namespace BookAStar.Model.Workflow
return DataManager.Current.Contacts.LocalGet(ClientId); return DataManager.Current.Contacts.LocalGet(ClientId);
} }
} }
public FormattedString FormattedTotal
{
get
{
OnPlatform<Font> lfs = (OnPlatform < Font >) App.Current.Resources["LargeFontSize"];
OnPlatform<Color> etc = (OnPlatform<Color>)App.Current.Resources["EmphasisTextColor"];
return new FormattedString
{
Spans = {
new Span { Text = "Total TTC: " },
new Span { Text = Total.ToString(),
ForegroundColor = etc.Android ,
FontSize = (double) lfs.Android.FontSize },
new Span { Text = "€", FontSize = (double) lfs.Android.FontSize }
}
};
}
set { }
}
public decimal Total { get
{
return Bill?.Aggregate((decimal)0, (t, l) => t + l.Count * l.UnitaryCost) ?? (decimal)0;
}
}
} }
} }

@ -9,27 +9,21 @@
> >
<ContentPage.Resources> <ContentPage.Resources>
<ResourceDictionary> <ResourceDictionary>
<Style TargetType="Label">
<Style x:Key="labelStyle" TargetType="Label"> <Setter Property="Style" Value="{StaticResource LabelStyle}" />
<Setter Property="TextColor" Value="{DynamicResource EmphasisTextColor}" /> </Style>
<Setter Property="FontAttributes" Value="Bold" /> <Style TargetType="Button">
<Setter Property="FontSize" Value="{DynamicResource LargeFontSize}" /> <Setter Property="Style" Value="{StaticResource ButtonStyle}" />
<Setter Property="VerticalOptions" Value="Start" />
<Setter Property="LineBreakMode" Value="WordWrap" />
</Style> </Style>
</ResourceDictionary> </ResourceDictionary>
</ContentPage.Resources> </ContentPage.Resources>
<StackLayout x:Name="bookQueryLayout"> <StackLayout x:Name="bookQueryLayout">
<Label Text="{Binding Client.UserName}" Style="{StaticResource labelStyle}" <Label Text="{Binding Client.UserName}"/>
VerticalOptions="Start" HorizontalOptions="Center" /> <Label Text="{Binding EventDate}" />
<Label Text="{Binding Location.Address}" VerticalOptions="FillAndExpand" HorizontalOptions="Center" /> <Label Text="{Binding Location.Address}" />
<Label Text="{Binding Previsional}" VerticalOptions="Center" HorizontalOptions="Center" /> <Label Text="{Binding Previsional}" />
<Label Text="{Binding EventDate}" VerticalOptions="Center" HorizontalOptions="Center" />
<Label Text="{Binding Location.Address}" VerticalOptions="Center" HorizontalOptions="Center" />
<maps:Map x:Name="map"></maps:Map> <maps:Map x:Name="map"></maps:Map>
<Button Text="Faire un devis" Clicked="MakeAnEstimate" VerticalOptions="Center" HorizontalOptions="End"/> <Button Text="Faire un devis" Clicked="MakeAnEstimate" />
</StackLayout> </StackLayout>
</ContentPage> </ContentPage>

@ -0,0 +1,32 @@
<?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:local="clr-namespace:BookAStar;assembly=BookAStar"
xmlns:views="clr-namespace:BookAStar.Views;assembly=BookAStar"
x:Class="BookAStar.Pages.CommandLineEditorPage"
Style="{StaticResource PageStyle}">
<StackLayout>
<Label Text="Description de la ligne de facture" Style="{StaticResource InputLabelStyle}"></Label>
<Editor VerticalOptions="FillAndExpand"></Editor>
<Label Text="Durée de la prestation"
Style="{StaticResource InputLabelStyle}"></Label>
<StackLayout Orientation="Horizontal">
<Entry Placeholder="Durée" Keyboard="Numeric" Style="{StaticResource BigEntry}"/>
<Picker SelectedIndex="1" Style="{StaticResource PickerStyle}">
<Picker.Items>
<x:String>Heures</x:String>
<x:String>Jours</x:String>
<x:String>Minutes</x:String>
</Picker.Items>
</Picker>
</StackLayout>
<Label Text="Quantité facturée" Style="{StaticResource InputLabelStyle}"></Label>
<Entry Placeholder="Quantité" Text="1" Keyboard="Numeric" Style="{StaticResource BigEntry}"/>
<Label Text="Prix unitaire" Style="{StaticResource InputLabelStyle}"></Label>
<StackLayout Orientation="Horizontal">
<Entry Placeholder="Prix" Keyboard="Numeric" Style="{StaticResource BigEntry}"></Entry>
<Label Text="€" Style="{StaticResource BigLabel}" HorizontalTextAlignment="Start"/>
</StackLayout>
<Button Text="Valider cette ligne de facture"></Button>
</StackLayout>
</ContentPage>

@ -8,15 +8,11 @@ using Xamarin.Forms;
namespace BookAStar.Pages namespace BookAStar.Pages
{ {
public partial class MarkdownEditorPage : ContentPage public partial class CommandLineEditorPage : ContentPage
{ {
public MarkdownEditorPage() public CommandLineEditorPage()
{ {
InitializeComponent(); InitializeComponent();
}
public void GetText()
{
} }
} }

@ -2,41 +2,32 @@
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="BookAStar.Pages.EditEstimatePage" x:Class="BookAStar.Pages.EditEstimatePage"
xmlns:local="clr-namespace:BookAStar.Views;assembly=BookAStar" xmlns:views="clr-namespace:BookAStar.Views;assembly=BookAStar"
> xmlns:local="clr-namespace:BookAStar;assembly=BookAStar">
<StackLayout Padding="10,10,10,10"> <StackLayout Padding="10,10,10,10" BindingContext="{Binding .}">
<StackLayout Orientation="Horizontal" Padding="10,10,10,10"> <StackLayout Orientation="Horizontal" Padding="10,10,10,10">
<Label Text="{Binding Client.UserName}" <Label Text="{Binding Client.UserName}" LineBreakMode="WordWrap"></Label>
LineBreakMode="WordWrap"></Label> <Label Text="{Binding Query.Location.Address}" LineBreakMode="WordWrap"></Label>
<Label Text="{Binding Query.Location.Address}" <Label Text="{Binding Query.EventDate, StringFormat='{0:dddd d MMMM yyyy à hh:mm}'}" LineBreakMode="WordWrap"></Label>
LineBreakMode="WordWrap" ></Label>
<Label Text="{Binding Query.EventDate, StringFormat='{0:dddd d MMMM yyyy à hh:mm}'}"
LineBreakMode="WordWrap" ></Label>
</StackLayout> </StackLayout>
<local:MarkdownView x:Name="mdview" Markdown="{Binding Description}" <views:MarkdownView x:Name="mdview"
Edited="OnDescriptionChanged" HorizontalOptions="FillAndExpand" Edited="OnDescriptionChanged" HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"> HeightRequest="120" VerticalOptions="FillAndExpand"
Markdown="{Binding Description}"></views:MarkdownView>
</local:MarkdownView>
<!-- <ListView > <ListView HeightRequest="160">
<ListView.ItemTemplate> <ListView.ItemTemplate>
<DataTemplate> <DataTemplate>
<ViewCell> <ViewCell>
<ViewCell.View> <ViewCell.View HeightRequest="80">
<StackLayout Orientation="Horizontal">
<Entry Placeholder="Ligne de facture"></Entry>
<Entry Placeholder="Compte"></Entry>
<Entry Placeholder="Prix unitaire" ></Entry>
</StackLayout>
</ViewCell.View> </ViewCell.View>
</ViewCell> </ViewCell>
</DataTemplate> </DataTemplate>
</ListView.ItemTemplate> </ListView.ItemTemplate>
</ListView> --> </ListView>
<Label Text="Total TTC:"></Label> <Button Text="Ajouter une ligne de facture" Clicked="OnNewCommanLine"></Button>
<Label FormattedText="{Binding FormattedTotal}"/>
<Button Text="Valider ce devis"></Button> <Button Text="Valider ce devis"></Button>
</StackLayout> </StackLayout>
</ContentPage> </ContentPage>

@ -16,7 +16,10 @@ namespace BookAStar.Pages
public Estimate Estimate { get { return BindingContext as Estimate; } set { public Estimate Estimate { get { return BindingContext as Estimate; } set {
BindingContext = value; BindingContext = value;
} } } }
public static readonly BindableProperty MarkdownProperty = public static readonly BindableProperty TotalProperty =
BindableProperty.Create("Total", typeof(decimal), typeof(EditEstimatePage),
(decimal) 0, BindingMode.OneWay);
public static readonly BindableProperty DescriptionProperty =
BindableProperty.Create("Description", typeof(string), typeof(Estimate), BindableProperty.Create("Description", typeof(string), typeof(Estimate),
null, BindingMode.TwoWay); null, BindingMode.TwoWay);
public static readonly BindableProperty ClientProperty = public static readonly BindableProperty ClientProperty =
@ -26,19 +29,31 @@ namespace BookAStar.Pages
BindableProperty.Create("Query", typeof(BookQueryData), typeof(Estimate), BindableProperty.Create("Query", typeof(BookQueryData), typeof(Estimate),
null, BindingMode.OneWay); null, BindingMode.OneWay);
public EditEstimatePage() public EditEstimatePage()
{ {
InitializeComponent(); InitializeComponent();
} }
protected override void OnBindingContextChanged() protected override void OnBindingContextChanged()
{ {
base.OnBindingContextChanged(); base.OnBindingContextChanged();
mdview.Markdown = Estimate?.Description; // FIXME Why the Binding don't work?
mdview.Markdown = Estimate.Description;
} }
protected void OnDescriptionChanged (object sender, EventArgs e) protected void OnDescriptionChanged (object sender, EventArgs e)
{ {
// FIXME Why the Binding don't work?
Estimate.Description = mdview.Markdown; Estimate.Description = mdview.Markdown;
} }
protected void OnNewCommanLine(object sender, EventArgs e)
{
var com = new CommandLine();
App.CurrentApp.EditCommandLine(com);
}
} }
} }

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:BookAStar;assembly=BookAStar"
x:Class="BookAStar.Views.CommandLineEditor"
BackgroundColor="{x:Static local:Constants.BackgroundColor}"
>
<StackLayout>
<Label Text="Description de la ligne de facture"></Label>
<Editor ></Editor>
<StackLayout Orientation="Horizontal">
<Entry Placeholder="Durée de la prestation" Keyboard="Numeric"></Entry>
<Picker>
<Picker.Items>
<x:String>Heures</x:String>
<x:String>Jours</x:String>
<x:String>Minutes</x:String>
</Picker.Items>
</Picker>
</StackLayout>
<Entry Placeholder="Quantité" Text="1"/>
<Entry Placeholder="Prix unitaire" ></Entry>
<Button Text="Valider cette ligne de facture"></Button>
</StackLayout>
</ContentView>

@ -5,13 +5,14 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
namespace App2 namespace BookAStar.Views
{ {
public partial class MainPage : ContentPage public partial class CommandLineEditor : ContentView
{ {
public MainPage() public CommandLineEditor()
{ {
InitializeComponent(); InitializeComponent();
} }
} }
} }
Loading…