diff --git a/BookAStar/BookAStar/App.xaml b/BookAStar/BookAStar/App.xaml index 92a8dfbe..a3f0bde3 100644 --- a/BookAStar/BookAStar/App.xaml +++ b/BookAStar/BookAStar/App.xaml @@ -4,36 +4,63 @@ x:Class="BookAStar.App" > - - - - - - #30FAFAFA - #207AFAFA - #FF103010 - #FF303010 - - + + - - - + + + + - \ No newline at end of file diff --git a/BookAStar/BookAStar/App.xaml.cs b/BookAStar/BookAStar/App.xaml.cs index 4d0b8edd..fa13a098 100644 --- a/BookAStar/BookAStar/App.xaml.cs +++ b/BookAStar/BookAStar/App.xaml.cs @@ -18,46 +18,56 @@ namespace BookAStar { public partial class App : Application // superclass new in 1.3 { - ContentPage deviceInfoPage; SearchPage searchPage = new SearchPage { Title = "Trouvez votre artiste", Icon = "glyphish_07_map_marker.png" }; NavigationPage mp; + SettingsPage settingsPage = new SettingsPage { Title = "Paramètres", Icon = "ic_corp_icon.png" }; + PinPage pinPage = new PinPage { Title = "Carte", 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 string AppName { get; set; } public static App CurrentApp { get { return Current as App; } } 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) { - deviceInfoPage = new DeviceInfoPage(instance.GetDeviceInfo()); + InitializeComponent(); + 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 stid = this.StyleId; // null var appsstyle = settingsPage.Style; @@ -80,7 +90,12 @@ namespace BookAStar 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); ToolbarItem tiMap = new ToolbarItem @@ -93,17 +108,9 @@ namespace BookAStar { ShowPage(pinPage); }; - - bookQueriesPage.BindingContext = DataManager.BookQueries; - } - public void ShowDeviceInfo() - { - ShowPage(deviceInfoPage); - } - public void PostDeviceInfo() { var res = PlatformSpecificInstance.InvokeApi( @@ -113,25 +120,33 @@ namespace BookAStar public void ShowBookQuery(BookQueryData data) { + BookQueryPage bookQueryPage = new BookQueryPage + { + Title = "Demande de devis" + }; bookQueryPage.BindingContext = data; ShowPage(bookQueryPage); } public void EditEstimate(Estimate data) { + EditEstimatePage editEstimate = new EditEstimatePage + { + Title = "Création d'un devis" + }; editEstimate.Estimate = data; ShowPage(editEstimate); } - private void ShowPage(Page p) + // TODO système de persistance de l'état de l'appli + private void ShowPage(Page p) { - if (p.Parent == null) - mp.Navigation.PushAsync(p); - else p.Focus(); - } - public void CloseWindow() - { - mp.Navigation.PopAsync(); + if (p.Parent!=null) + { + mp.Navigation.RemovePage(p); + p.Parent = null; + } + mp.Navigation.PushAsync(p); } } } diff --git a/BookAStar/BookAStar/BookAStar.csproj b/BookAStar/BookAStar/BookAStar.csproj index 95e58428..e7744bb4 100644 --- a/BookAStar/BookAStar/BookAStar.csproj +++ b/BookAStar/BookAStar/BookAStar.csproj @@ -25,6 +25,7 @@ DEBUG;TRACE prompt 4 + pdbonly @@ -33,6 +34,7 @@ TRACE prompt 4 + @@ -51,16 +53,15 @@ BookQueryPage.xaml - + + CommandLineEditorPage.xaml + EventDetail.xaml - - MainPage.xaml - @@ -103,10 +104,10 @@ EditEstimatePage.xaml - - MarkdownEditorPage.xaml - + + CommandLineEditor.xaml + @@ -118,10 +119,6 @@ - - Designer - MSBuild:UpdateDesignTimeXaml - Designer MSBuild:UpdateDesignTimeXaml @@ -199,12 +196,6 @@ Yavsc.Client - - - MSBuild:UpdateDesignTimeXaml - Designer - - MSBuild:UpdateDesignTimeXaml @@ -220,6 +211,18 @@ + + + Designer + MSBuild:UpdateDesignTimeXaml + + + + + MSBuild:UpdateDesignTimeXaml + Designer + + diff --git a/BookAStar/BookAStar/Model/Workflow/CommandLine.cs b/BookAStar/BookAStar/Model/Workflow/CommandLine.cs index 89f72c57..65ef4cdd 100644 --- a/BookAStar/BookAStar/Model/Workflow/CommandLine.cs +++ b/BookAStar/BookAStar/Model/Workflow/CommandLine.cs @@ -1,12 +1,12 @@  +using System; + namespace BookAStar.Model.Workflow { - public class CommandLine { - public long Id { get; set; } - public string Comment { get; set; } - public BaseProduct Article { get; set; } + public string Description { get; set; } + public TimeSpan Duration { get; set; } public int Count { get; set; } public decimal UnitaryCost { get; set; } } diff --git a/BookAStar/BookAStar/Model/Workflow/Estimate.cs b/BookAStar/BookAStar/Model/Workflow/Estimate.cs index 02d03b97..7e06a982 100644 --- a/BookAStar/BookAStar/Model/Workflow/Estimate.cs +++ b/BookAStar/BookAStar/Model/Workflow/Estimate.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Xamarin.Forms; namespace BookAStar.Model.Workflow { @@ -67,5 +68,32 @@ namespace BookAStar.Model.Workflow return DataManager.Current.Contacts.LocalGet(ClientId); } } + + public FormattedString FormattedTotal + { + get + { + OnPlatform lfs = (OnPlatform < Font >) App.Current.Resources["LargeFontSize"]; + OnPlatform etc = (OnPlatform)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; + } + } } } diff --git a/BookAStar/BookAStar/Pages/BookQueryPage.xaml b/BookAStar/BookAStar/Pages/BookQueryPage.xaml index 0925bce4..e9fc0ed2 100644 --- a/BookAStar/BookAStar/Pages/BookQueryPage.xaml +++ b/BookAStar/BookAStar/Pages/BookQueryPage.xaml @@ -9,27 +9,21 @@ > - - + - - + \ No newline at end of file diff --git a/BookAStar/BookAStar/Pages/MarkdownEditorPage.xaml.cs b/BookAStar/BookAStar/Pages/CommandLineEditorPage.xaml.cs similarity index 62% rename from BookAStar/BookAStar/Pages/MarkdownEditorPage.xaml.cs rename to BookAStar/BookAStar/Pages/CommandLineEditorPage.xaml.cs index 082c66ad..53ce3842 100644 --- a/BookAStar/BookAStar/Pages/MarkdownEditorPage.xaml.cs +++ b/BookAStar/BookAStar/Pages/CommandLineEditorPage.xaml.cs @@ -8,16 +8,12 @@ using Xamarin.Forms; namespace BookAStar.Pages { - public partial class MarkdownEditorPage : ContentPage + public partial class CommandLineEditorPage : ContentPage { - public MarkdownEditorPage() + public CommandLineEditorPage() { InitializeComponent(); - } - - public void GetText() - { - + } } } diff --git a/BookAStar/BookAStar/Pages/EditEstimatePage.xaml b/BookAStar/BookAStar/Pages/EditEstimatePage.xaml index 7b489cd4..1dedba98 100644 --- a/BookAStar/BookAStar/Pages/EditEstimatePage.xaml +++ b/BookAStar/BookAStar/Pages/EditEstimatePage.xaml @@ -2,41 +2,32 @@ - - + xmlns:views="clr-namespace:BookAStar.Views;assembly=BookAStar" + xmlns:local="clr-namespace:BookAStar;assembly=BookAStar"> + - - - + + + - - - - - - + + + \ No newline at end of file diff --git a/BookAStar/BookAStar/Pages/EditEstimatePage.xaml.cs b/BookAStar/BookAStar/Pages/EditEstimatePage.xaml.cs index 5d4ecb15..b48bd88c 100644 --- a/BookAStar/BookAStar/Pages/EditEstimatePage.xaml.cs +++ b/BookAStar/BookAStar/Pages/EditEstimatePage.xaml.cs @@ -16,7 +16,10 @@ namespace BookAStar.Pages public Estimate Estimate { get { return BindingContext as Estimate; } set { 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), null, BindingMode.TwoWay); public static readonly BindableProperty ClientProperty = @@ -26,19 +29,31 @@ namespace BookAStar.Pages BindableProperty.Create("Query", typeof(BookQueryData), typeof(Estimate), null, BindingMode.OneWay); + + public EditEstimatePage() { InitializeComponent(); } + protected override void 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) { + // FIXME Why the Binding don't work? Estimate.Description = mdview.Markdown; } + protected void OnNewCommanLine(object sender, EventArgs e) + { + var com = new CommandLine(); + App.CurrentApp.EditCommandLine(com); + } + } } diff --git a/BookAStar/BookAStar/Views/CommandLineEditor.xaml b/BookAStar/BookAStar/Views/CommandLineEditor.xaml new file mode 100644 index 00000000..17a79010 --- /dev/null +++ b/BookAStar/BookAStar/Views/CommandLineEditor.xaml @@ -0,0 +1,25 @@ + + + + + + + + + + Heures + Jours + Minutes + + + + + + + + \ No newline at end of file diff --git a/BookAStar/BookAStar/Pages/MainPage.xaml.cs b/BookAStar/BookAStar/Views/CommandLineEditor.xaml.cs similarity index 63% rename from BookAStar/BookAStar/Pages/MainPage.xaml.cs rename to BookAStar/BookAStar/Views/CommandLineEditor.xaml.cs index 318924ab..08443e3a 100644 --- a/BookAStar/BookAStar/Pages/MainPage.xaml.cs +++ b/BookAStar/BookAStar/Views/CommandLineEditor.xaml.cs @@ -5,13 +5,14 @@ using System.Text; using System.Threading.Tasks; using Xamarin.Forms; -namespace App2 +namespace BookAStar.Views { - public partial class MainPage : ContentPage + public partial class CommandLineEditor : ContentView { - public MainPage() + public CommandLineEditor() { InitializeComponent(); + } } }