diff --git a/BookAStar/BookAStar/ViewModels/EstimateViewModel.cs b/BookAStar/BookAStar/ViewModels/EstimateViewModel.cs index 51e42836..1ad3dffb 100644 --- a/BookAStar/BookAStar/ViewModels/EstimateViewModel.cs +++ b/BookAStar/BookAStar/ViewModels/EstimateViewModel.cs @@ -3,6 +3,7 @@ using XLabs.Forms.Mvvm; using BookAStar.Model.Workflow; using System.Collections.ObjectModel; using BookAStar.Model; +using Xamarin.Forms; namespace BookAStar.ViewModels { @@ -10,21 +11,17 @@ namespace BookAStar.ViewModels { public EstimateViewModel(Estimate data) { - estimate = data; - + Data = data; if (data.AttachedFiles == null) data.AttachedFiles = new List(); if (data.AttachedGraphicList == null) data.AttachedGraphicList = new List(); if (data.Bill == null) data.Bill = new List(); AttachedFiles = new ObservableCollection(data.AttachedFiles); AttachedGraphicList = new ObservableCollection(data.AttachedGraphicList); Bill = new ObservableCollection(data.Bill); - description = data.Description; - title = data.Title; - status = data.Status; } - Estimate estimate; - + public Estimate Data { get; protected set; } + public ObservableCollection AttachedFiles { get; protected set; @@ -41,17 +38,18 @@ namespace BookAStar.ViewModels } - private string description; + string newDesc; public string Description { get { - return description; + return Data.Description; } set { - SetProperty(ref description, value, "Description"); + SetProperty(ref newDesc, value, "Description"); + Data.Description = newDesc; } } @@ -60,12 +58,13 @@ namespace BookAStar.ViewModels { get { - return status; + return Data.Status; } set { SetProperty(ref status, value, "Status"); + Data.Status = status; } } private string title; @@ -73,18 +72,40 @@ namespace BookAStar.ViewModels { get { - return title; + return Data.Title; } set { SetProperty(ref title, value, "Title"); + Data.Title = title; } } - public ClientProviderInfo Client { get { return estimate.Client; } } + public ClientProviderInfo Client { get { return Data.Client; } } + + public BookQueryData Query { get { return Data.Query; } } + + public FormattedString FormattedTotal + { + get + { + OnPlatform lfs = (OnPlatform)App.Current.Resources["LargeFontSize"]; + OnPlatform etc = (OnPlatform)App.Current.Resources["EmphasisTextColor"]; - public BookQueryData Query { get { return estimate.Query; } } + return new FormattedString + { + Spans = { + new Span { Text = "Total TTC: " }, + new Span { Text = Data.Total.ToString(), + ForegroundColor = etc.Android , + FontSize = (double) lfs.Android.FontSize }, + new Span { Text = "€", FontSize = (double) lfs.Android.FontSize } + } + }; + } + set { } + } } }