diff --git a/BookAStar/BookAStar/BookAStar.csproj b/BookAStar/BookAStar/BookAStar.csproj
index 908d00f0..fe37a575 100644
--- a/BookAStar/BookAStar/BookAStar.csproj
+++ b/BookAStar/BookAStar/BookAStar.csproj
@@ -40,7 +40,16 @@
App.xaml
+
+
+
+
+
+
+
+
+
@@ -50,7 +59,7 @@
-
+
@@ -133,9 +142,6 @@
-
- CommandLineEditor.xaml
-
@@ -145,6 +151,9 @@
AccountChooserPage.xaml
+
+ RatingView.xaml
+
@@ -279,33 +288,39 @@
-
- Designer
+
MSBuild:UpdateDesignTimeXaml
+ Designer
-
+
MSBuild:UpdateDesignTimeXaml
Designer
-
+
+
+
+
+
+
+
+
+
MSBuild:UpdateDesignTimeXaml
Designer
-
-
-
-
-
-
+
+
+
+
-
+
MSBuild:UpdateDesignTimeXaml
Designer
diff --git a/BookAStar/BookAStar/Helpers/ServiceNotAvailable1.cs b/BookAStar/BookAStar/Helpers/ServiceNotAvailable.cs
similarity index 100%
rename from BookAStar/BookAStar/Helpers/ServiceNotAvailable1.cs
rename to BookAStar/BookAStar/Helpers/ServiceNotAvailable.cs
diff --git a/BookAStar/BookAStar/Pages/BookQueriesPage.xaml.cs b/BookAStar/BookAStar/Pages/BookQueriesPage.xaml.cs
index 439438c7..9228dcb6 100644
--- a/BookAStar/BookAStar/Pages/BookQueriesPage.xaml.cs
+++ b/BookAStar/BookAStar/Pages/BookQueriesPage.xaml.cs
@@ -18,7 +18,7 @@ namespace BookAStar.Pages
private void OnViewDetail(object sender, ItemTappedEventArgs e)
{
BookQueryData data = e.Item as BookQueryData;
- App.CurrentApp.NavigationService.NavigateTo(true,data);
+ App.NavigationService.NavigateTo(true,data);
}
}
}
diff --git a/BookAStar/BookAStar/Pages/BookQueryPage.xaml.cs b/BookAStar/BookAStar/Pages/BookQueryPage.xaml.cs
index 8acfe73e..ae272ec1 100644
--- a/BookAStar/BookAStar/Pages/BookQueryPage.xaml.cs
+++ b/BookAStar/BookAStar/Pages/BookQueryPage.xaml.cs
@@ -77,7 +77,7 @@ namespace BookAStar.Pages
Id = 0,
Description = "# **Hello Estimate!**"
};
- App.CurrentApp.NavigationService.NavigateTo(true,
+ App.NavigationService.NavigateTo(true,
new EstimateViewModel(e));
}
diff --git a/BookAStar/BookAStar/Pages/DashboardPage.xaml b/BookAStar/BookAStar/Pages/DashboardPage.xaml
index 7baa4393..b744b970 100644
--- a/BookAStar/BookAStar/Pages/DashboardPage.xaml
+++ b/BookAStar/BookAStar/Pages/DashboardPage.xaml
@@ -1,6 +1,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/BookAStar/BookAStar/Pages/DashboardPage.xaml.cs b/BookAStar/BookAStar/Pages/DashboardPage.xaml.cs
index 86cd2ca4..8196986a 100644
--- a/BookAStar/BookAStar/Pages/DashboardPage.xaml.cs
+++ b/BookAStar/BookAStar/Pages/DashboardPage.xaml.cs
@@ -35,7 +35,7 @@ namespace BookAStar.Pages
private void ShowPage(object [] args, bool animate=false) where T:Page
{
- App.CurrentApp.NavigationService.NavigateTo(animate, args);
+ App.NavigationService.NavigateTo(animate, args);
App.MasterPresented = false;
}
diff --git a/BookAStar/BookAStar/Pages/EditBillingLinePage.xaml b/BookAStar/BookAStar/Pages/EditBillingLinePage.xaml
index 0fcd3597..84937a09 100644
--- a/BookAStar/BookAStar/Pages/EditBillingLinePage.xaml
+++ b/BookAStar/BookAStar/Pages/EditBillingLinePage.xaml
@@ -22,21 +22,21 @@
Style="{StaticResource InputLabelStyle}">
-
+
- Heures
Jours
+ Heures
Minutes
-
+
-
+
-
+
\ No newline at end of file
diff --git a/BookAStar/BookAStar/Pages/EditBillingLinePage.xaml.cs b/BookAStar/BookAStar/Pages/EditBillingLinePage.xaml.cs
index 47d11877..2a1d9f3d 100644
--- a/BookAStar/BookAStar/Pages/EditBillingLinePage.xaml.cs
+++ b/BookAStar/BookAStar/Pages/EditBillingLinePage.xaml.cs
@@ -13,9 +13,12 @@ namespace BookAStar.Pages
{
public EditBillingLinePage(BillingLineViewModel model)
{
- InitializeComponent();
BindingContext = model;
- InvalidateMeasure();
+ InitializeComponent();
+ }
+ public void OnValidateClicked (object sender, EventArgs e)
+ {
+ OnBackButtonPressed();
}
}
}
diff --git a/BookAStar/BookAStar/Pages/EditEstimatePage.xaml.cs b/BookAStar/BookAStar/Pages/EditEstimatePage.xaml.cs
index 63ffd087..02b0b996 100644
--- a/BookAStar/BookAStar/Pages/EditEstimatePage.xaml.cs
+++ b/BookAStar/BookAStar/Pages/EditEstimatePage.xaml.cs
@@ -43,11 +43,19 @@ namespace BookAStar.Pages
protected void OnNewCommanLine(object sender, EventArgs e)
{
- var com = new BillingLine();
- App.CurrentApp.NavigationService.NavigateTo(
+ var com = new BillingLine() { Count = 1, UnitaryCost = 0.01m };
+ var lineView = new BillingLineViewModel(com)
+ {
+ ValidateCommand = new Command(() => {
+ ((EstimateViewModel)BindingContext).Bill.
+ Add(com);
+ })
+ };
+
+ App.NavigationService.NavigateTo(
true,
- new object[] { new BillingLineViewModel(((EstimateViewModel)this.BindingContext).Data,com) } );
+ new object[] { lineView } );
}
-
+
}
}
diff --git a/BookAStar/BookAStar/ViewModels/BillingLineViewModel.cs b/BookAStar/BookAStar/ViewModels/BillingLineViewModel.cs
index fb2feb5c..77f816b4 100644
--- a/BookAStar/BookAStar/ViewModels/BillingLineViewModel.cs
+++ b/BookAStar/BookAStar/ViewModels/BillingLineViewModel.cs
@@ -1,6 +1,7 @@
using BookAStar.Interfaces;
using BookAStar.Model.Workflow;
using System;
+using System.Globalization;
using System.Windows.Input;
using Xamarin.Forms;
using XLabs.Forms.Mvvm;
@@ -10,18 +11,12 @@ namespace BookAStar.ViewModels
public class BillingLineViewModel : ViewModel, IBillingLine
{
BillingLine data;
- public Estimate Billing { protected set; get; }
- public BillingLineViewModel(Estimate billing, BillingLine data)
+ public BillingLineViewModel( BillingLine data)
{
this.data = (data == null) ? new BillingLine() : data;
- Billing = billing;
- ValidateCommand =
- new Command(
- () => {
- Billing.Bill.Add(data);
- Validated.Invoke(this, new EventArgs());
- });
+ // sets durationValue & unit
+ Duration = data.Duration;
}
protected int count;
@@ -29,12 +24,13 @@ namespace BookAStar.ViewModels
{
get
{
- return count;
+ return data.Count;
}
set
{
SetProperty(ref count, value, "Count");
+ data.Count = count;
}
}
protected string description;
@@ -42,45 +38,129 @@ namespace BookAStar.ViewModels
{
get
{
- return description;
+ return data.Description;
}
set
{
SetProperty(ref description, value, "Description");
+ data.Description = value;
}
}
- protected TimeSpan duration;
- public TimeSpan Duration
+ protected int durationValue;
+ public int DurationValue
{
get
{
- return duration;
+ return durationValue;
+ }
+
+ set
+ {
+ SetProperty(ref durationValue, value, "DurationValue");
+ data.Duration = this.Duration;
}
+ }
+ public enum DurationUnits:int
+ {
+ Jours=0,
+ Heures=1,
+ Minutes=2
+ }
+ private DurationUnits durationUnit;
+ public DurationUnits DurationUnit
+ {
+ get {
+ return durationUnit;
+ }
set
{
- SetProperty(ref duration, value, "Duration");
+ SetProperty(ref durationUnit, value, "DurationUnit");
+ data.Duration = this.Duration;
}
}
protected decimal unitaryCost;
- public decimal UnitaryCost
+ public static readonly string unitCostFormat = "0,.00";
+ public string UnitaryCostText
{
get
{
- return unitaryCost;
+ return unitaryCost.ToString(unitCostFormat, CultureInfo.InvariantCulture);
}
set
{
- SetProperty(ref unitaryCost, value, "UnitaryCost");
+ decimal newValue;
+ if (decimal.TryParse(value, NumberStyles.Currency,
+ CultureInfo.InvariantCulture,
+ out newValue))
+ {
+ SetProperty(ref unitaryCost, newValue, "UnitaryCostText");
+ SetProperty(ref invalidCost, false, "InvalidCost");
+ }
+ else
+ SetProperty(ref invalidCost, true, "InvalidCost");
}
}
+ bool invalidCost;
+ public bool InvalidCost
+ {
+ get { return invalidCost; }
+ }
+ public ICommand ValidateCommand { set; get; }
+
+ public TimeSpan Duration
+ {
+ get
+ {
+ switch (DurationUnit)
+ {
+ case DurationUnits.Heures:
+ return new TimeSpan(DurationValue, 0, 0);
+ case DurationUnits.Jours:
+ return new TimeSpan(DurationValue*24, 0, 0);
+ case DurationUnits.Minutes:
+ return new TimeSpan(0, DurationValue, 0);
+ // Assert(false); since all units are treated bellow
+ default:
+ return new TimeSpan(0, 0, DurationValue);
+ }
+ }
- public ICommand ValidateCommand { protected set; get; }
+ set
+ {
+ double days = value.TotalDays;
+ if (days >= 1.0)
+ {
+ DurationValue = (int) days;
+ DurationUnit = DurationUnits.Jours;
+ return;
+ }
+ double hours = value.TotalHours;
+ if (hours >= 1.0)
+ {
+ DurationValue = (int) hours;
+ DurationUnit = DurationUnits.Jours;
+ return;
+ }
+ DurationValue = (int) value.TotalMinutes;
+ DurationUnit = DurationUnits.Minutes;
+ }
+ }
- public event EventHandler Validated;
+ public decimal UnitaryCost
+ {
+ get
+ {
+ return decimal.Parse(this.UnitaryCostText,CultureInfo.InvariantCulture);
+ }
+ set
+ {
+ UnitaryCostText = value.ToString(unitCostFormat, CultureInfo.InvariantCulture);
+ }
+ }
}
}
diff --git a/BookAStar/BookAStar/ViewModels/DashboardViewModel.cs b/BookAStar/BookAStar/ViewModels/DashboardViewModel.cs
index 88e181e6..515d6e3a 100644
--- a/BookAStar/BookAStar/ViewModels/DashboardViewModel.cs
+++ b/BookAStar/BookAStar/ViewModels/DashboardViewModel.cs
@@ -12,6 +12,7 @@ using XLabs.Platform.Services;
namespace BookAStar.ViewModels
{
+
internal class DashboardViewModel : ViewModel
{
public string UserId
diff --git a/BookAStar/BookAStar/Views/CommandLineEditor.xaml b/BookAStar/BookAStar/Views/CommandLineEditor.xaml
deleted file mode 100644
index 17a79010..00000000
--- a/BookAStar/BookAStar/Views/CommandLineEditor.xaml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
- Heures
- Jours
- Minutes
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/BookAStar/BookAStar/Views/CommandLineEditor.xaml.cs b/BookAStar/BookAStar/Views/CommandLineEditor.xaml.cs
deleted file mode 100644
index 08443e3a..00000000
--- a/BookAStar/BookAStar/Views/CommandLineEditor.xaml.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Xamarin.Forms;
-
-namespace BookAStar.Views
-{
- public partial class CommandLineEditor : ContentView
- {
- public CommandLineEditor()
- {
- InitializeComponent();
-
- }
- }
-}
diff --git a/BookAStar/BookAStar/Views/MarkdownView.cs b/BookAStar/BookAStar/Views/MarkdownView.cs
index 50417671..f75c37db 100644
--- a/BookAStar/BookAStar/Views/MarkdownView.cs
+++ b/BookAStar/BookAStar/Views/MarkdownView.cs
@@ -1,6 +1,7 @@
using BookAStar.Interfaces;
using System;
using System.Collections.Generic;
+using System.ComponentModel;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
@@ -15,19 +16,18 @@ namespace BookAStar.Views
"Markdown", typeof(string), typeof(MarkdownView), null, BindingMode.TwoWay
);
- private string markdown;
-
public string Markdown
{
get
{
- return markdown;
+ return GetValue(MarkdownProperty) as string;
}
set
{
- if (markdown != value)
+ if (Markdown != value)
{
- markdown = value;
+ SetValue(MarkdownProperty, value);
+
if (Modified != null)
{
Modified.Invoke(this, new EventArgs());
@@ -45,10 +45,10 @@ namespace BookAStar.Views
double height = heightConstraint;
if (MinimumWidthRequest>0)
- width = widthConstraint > 80 ? widthConstraint < double.MaxValue ? widthConstraint : MinimumWidthRequest : MinimumWidthRequest;
+ width = widthConstraint > MinimumWidthRequest ? widthConstraint < double.MaxValue ? widthConstraint : MinimumWidthRequest : MinimumWidthRequest;
if (MinimumHeightRequest > 0)
- height = heightConstraint > 160 ? heightConstraint < double.MaxValue ? heightConstraint : MinimumHeightRequest : MinimumHeightRequest;
+ height = heightConstraint > MinimumHeightRequest ? heightConstraint < double.MaxValue ? heightConstraint : MinimumHeightRequest : MinimumHeightRequest;
return base.OnMeasure(width, height);
}