diff --git a/BookAStar/BookAStar/Pages/EditBillingLinePage.xaml.cs b/BookAStar/BookAStar/Pages/EditBillingLinePage.xaml.cs index 5c9e8915..b5cb5d2d 100644 --- a/BookAStar/BookAStar/Pages/EditBillingLinePage.xaml.cs +++ b/BookAStar/BookAStar/Pages/EditBillingLinePage.xaml.cs @@ -1,4 +1,5 @@ -using System; +using BookAStar.ViewModels; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -10,9 +11,10 @@ namespace BookAStar.Pages { public partial class EditBillingLinePage : ContentPage { - public EditBillingLinePage() + public EditBillingLinePage(BillingLineViewModel model) { InitializeComponent(); + BindingContext = model; } } } diff --git a/BookAStar/BookAStar/Pages/EditEstimatePage.xaml.cs b/BookAStar/BookAStar/Pages/EditEstimatePage.xaml.cs index 00ea16bc..aa4f3238 100644 --- a/BookAStar/BookAStar/Pages/EditEstimatePage.xaml.cs +++ b/BookAStar/BookAStar/Pages/EditEstimatePage.xaml.cs @@ -1,5 +1,6 @@ using BookAStar.Model; using BookAStar.Model.Workflow; +using BookAStar.ViewModels; using BookAStar.Views; using System; using System.Collections.Generic; @@ -8,6 +9,9 @@ using System.Text; using System.Threading.Tasks; using Xamarin.Forms; +using XLabs.Forms.Services; +using XLabs.Ioc; +using XLabs.Platform.Services; namespace BookAStar.Pages { @@ -16,43 +20,33 @@ namespace BookAStar.Pages public Estimate Estimate { get { return BindingContext as Estimate; } set { BindingContext = value; } } - 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 = - BindableProperty.Create("Client", typeof(ClientProviderInfo), typeof(Estimate), - null, BindingMode.OneWay); - public static readonly BindableProperty QueryProperty = - BindableProperty.Create("Query", typeof(BookQueryData), typeof(Estimate), - null, BindingMode.OneWay); - - - public EditEstimatePage() + public EditEstimatePage(EstimateViewModel model) { InitializeComponent(); + BindingContext = model; } protected override void OnBindingContextChanged() { base.OnBindingContextChanged(); - // FIXME Why the Binding don't work? - mdview.Markdown = Estimate.Description; - + // FIXME WAZA + if (BindingContext != null) + mdview.Markdown = ((EstimateViewModel)BindingContext).Description; } protected void OnDescriptionChanged (object sender, EventArgs e) { // FIXME Why the Binding don't work? - Estimate.Description = mdview.Markdown; + ((EstimateViewModel)BindingContext).Description = mdview.Markdown; } + protected void OnNewCommanLine(object sender, EventArgs e) { var com = new BillingLine(); - App.CurrentApp.EditCommandLine(this,com); + Resolver.Resolve().NavigateTo( + true, + new object[] { new BillingLineViewModel(com) } ); } }