diff --git a/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj b/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj
index 66be7693..07016d17 100644
--- a/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj
+++ b/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj
@@ -88,7 +88,7 @@
False
..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v7.0\Mono.Android.dll
-
+
False
..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v7.0\Mono.Android.Export.dll
@@ -343,6 +343,7 @@
+
diff --git a/BookAStar/BookAStar.Droid/Helpers/SimpleJsonPostMethod.cs b/BookAStar/BookAStar.Droid/Helpers/SimpleJsonPostMethod.cs
index 11b3ca6c..edf98951 100644
--- a/BookAStar/BookAStar.Droid/Helpers/SimpleJsonPostMethod.cs
+++ b/BookAStar/BookAStar.Droid/Helpers/SimpleJsonPostMethod.cs
@@ -85,6 +85,7 @@ namespace Yavsc.Helpers
public async Task InvokeJson(object query)
{
JsonValue jsonDoc = null;
+
try
{
using (Stream streamQuery = request.GetRequestStream())
@@ -109,7 +110,12 @@ namespace Yavsc.Helpers
// TODO err logging
Debug.Print($"Web request failed: {request.ToString()}\n" + ex.ToString());
}
- return jsonDoc;
+ catch (Exception ex)
+ {
+ Debug.Print($"Web request failed: {request.ToString()}\n" + ex.ToString());
+ }
+
+ return jsonDoc;
}
}
}
diff --git a/BookAStar/BookAStar.Droid/Properties/AndroidManifest.xml b/BookAStar/BookAStar.Droid/Properties/AndroidManifest.xml
index fbc04fe9..5f09cf21 100644
--- a/BookAStar/BookAStar.Droid/Properties/AndroidManifest.xml
+++ b/BookAStar/BookAStar.Droid/Properties/AndroidManifest.xml
@@ -1,7 +1,7 @@
-
+
@@ -11,13 +11,13 @@
-
+
-
+
@@ -63,4 +63,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/BookAStar/BookAStar.Droid/Rendering/ImageButtonRenderer.cs b/BookAStar/BookAStar.Droid/Rendering/ImageButtonRenderer.cs
new file mode 100644
index 00000000..38705672
--- /dev/null
+++ b/BookAStar/BookAStar.Droid/Rendering/ImageButtonRenderer.cs
@@ -0,0 +1,296 @@
+// ***********************************************************************
+// Assembly : XLabs.Forms.Droid
+// Author : XLabs Team
+// Created : 12-27-2015
+//
+// Last Modified By : XLabs Team
+// Last Modified On : 01-04-2016
+// ***********************************************************************
+//
+// Copyright (c) XLabs Team. All rights reserved.
+//
+//
+// This project is licensed under the Apache 2.0 license
+// https://github.com/XLabs/Xamarin-Forms-Labs/blob/master/LICENSE
+//
+// XLabs is a open source project that aims to provide a powerfull and cross
+// platform set of controls tailored to work with Xamarin Forms.
+//
+// ***********************************************************************
+//
+
+using System;
+using System.ComponentModel;
+using System.Threading.Tasks;
+using Android.Graphics;
+using Android.Graphics.Drawables;
+using Android.Views;
+using XLabs.Enums;
+using XLabs.Forms.Extensions;
+using Color = Xamarin.Forms.Color;
+using View = Android.Views.View;
+using BookAStar.Rendering;
+using BookAStar.Views;
+using Xamarin.Forms.Platform.Android.AppCompat;
+using Xamarin.Forms;
+using Xamarin.Forms.Platform.Android;
+using System.IO;
+using BookAStar.Helpers;
+using System.Reflection;
+using System.Threading;
+
+[assembly: ExportRenderer(typeof(ImageButton), typeof(ImageButtonRenderer))]
+namespace BookAStar.Rendering
+{
+ ///
+ /// Draws a button on the Android platform with the image shown in the right
+ /// position with the right size.
+ ///
+ public partial class ImageButtonRenderer : Xamarin.Forms.Platform.Android.AppCompat.ButtonRenderer
+ {
+ private static float _density = float.MinValue;
+
+
+ ///
+ /// Sets up the button including the image.
+ ///
+ /// The event arguments.
+ private ImageButton ImageButton
+ {
+ get { return (ImageButton)Element; }
+ }
+
+ protected override async void OnElementChanged(ElementChangedEventArgs
- ..\..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v6.0\Mono.Android.dll
+ ..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v7.0\Mono.Android.dll
..\..\packages\Newtonsoft.Json.9.0.1\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll
@@ -334,7 +346,7 @@
-
+
MSBuild:UpdateDesignTimeXaml
Designer
@@ -346,19 +358,19 @@
-
+
MSBuild:UpdateDesignTimeXaml
Designer
-
+
MSBuild:UpdateDesignTimeXaml
Designer
-
+
MSBuild:UpdateDesignTimeXaml
Designer
@@ -448,6 +460,24 @@
Designer
+
+
+ MSBuild:UpdateDesignTimeXaml
+ Designer
+
+
+
+
+ MSBuild:UpdateDesignTimeXaml
+ Designer
+
+
+
+
+ MSBuild:UpdateDesignTimeXaml
+ Designer
+
+
diff --git a/BookAStar/BookAStar/Helpers/UserHelpers.cs b/BookAStar/BookAStar/Helpers/UserHelpers.cs
index 5d90042d..dde41d00 100644
--- a/BookAStar/BookAStar/Helpers/UserHelpers.cs
+++ b/BookAStar/BookAStar/Helpers/UserHelpers.cs
@@ -13,7 +13,6 @@ namespace BookAStar.Helpers
public static class UserHelpers
{
-
public static ImageSource Avatar(string avatarPath)
{
var result = avatarPath == null ?
diff --git a/BookAStar/BookAStar/Model/Workflow/Estimate.cs b/BookAStar/BookAStar/Model/Workflow/Estimate.cs
index c0c269a7..586c8185 100644
--- a/BookAStar/BookAStar/Model/Workflow/Estimate.cs
+++ b/BookAStar/BookAStar/Model/Workflow/Estimate.cs
@@ -2,6 +2,7 @@
using BookAStar.Helpers;
using BookAStar.Model.Interfaces;
using Newtonsoft.Json;
+using System;
using System.Collections.Generic;
using System.Linq;
@@ -76,6 +77,9 @@ namespace BookAStar.Model.Workflow
return Bill?.Aggregate((decimal)0, (t, l) => t + l.Count * l.UnitaryCost) ?? (decimal)0;
}
}
-
+
+ public DateTime LatestValidationDate { get; set; }
+
+ public DateTime ClientApprouvalDate { get; set; }
}
}
diff --git a/BookAStar/BookAStar/Pages/DocSigning.xaml b/BookAStar/BookAStar/Pages/DocSigning.xaml
index 3b3290b5..fe1dec3e 100644
--- a/BookAStar/BookAStar/Pages/DocSigning.xaml
+++ b/BookAStar/BookAStar/Pages/DocSigning.xaml
@@ -1,6 +1,22 @@
-
+
+
+
+
+
\ No newline at end of file
diff --git a/BookAStar/BookAStar/Pages/DocSigning.xaml.cs b/BookAStar/BookAStar/Pages/DocSigning.xaml.cs
index b284eee6..a68cf7f9 100644
--- a/BookAStar/BookAStar/Pages/DocSigning.xaml.cs
+++ b/BookAStar/BookAStar/Pages/DocSigning.xaml.cs
@@ -1,4 +1,5 @@
-using System;
+using SignaturePad.Forms;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -14,5 +15,45 @@ namespace BookAStar.ViewModels.Signing
{
InitializeComponent();
}
+ private async void OnGetStats(object sender, EventArgs e)
+ {
+ var points = padView.Points.ToArray();
+ var image = await padView.GetImageStreamAsync(SignatureImageFormat.Png);
+
+ var pointCount = points.Count();
+ var imageSize = image.Length / 1000;
+ var linesCount = points.Count(p => p == Point.Zero) + (points.Length > 0 ? 1 : 0);
+
+ image.Dispose();
+
+ await DisplayAlert("Stats", $"The signature has {linesCount} lines or {pointCount} points, and is {imageSize:#,###.0}KB (in memory) when saved as a PNG.", "Cool");
+ }
+ private async void OnChangeTheme(object sender, EventArgs e)
+ {
+ var action = await DisplayActionSheet("Change Theme", "Cancel", null, "White", "Black", "Aqua");
+ switch (action)
+ {
+ case "White":
+ padView.BackgroundColor = Color.White;
+ padView.StrokeColor = Color.Black;
+ padView.ClearTextColor = Color.Black;
+ padView.ClearText = "Clear Markers";
+ break;
+
+ case "Black":
+ padView.BackgroundColor = Color.Black;
+ padView.StrokeColor = Color.White;
+ padView.ClearTextColor = Color.White;
+ padView.ClearText = "Clear Chalk";
+ break;
+
+ case "Aqua":
+ padView.BackgroundColor = Color.Aqua;
+ padView.StrokeColor = Color.Red;
+ padView.ClearTextColor = Color.Black;
+ padView.ClearText = "Clear The Aqua";
+ break;
+ }
+ }
}
}
diff --git a/BookAStar/BookAStar/Pages/Estimate/BookQueriesPage.xaml b/BookAStar/BookAStar/Pages/EstimatePages/BookQueriesPage.xaml
similarity index 96%
rename from BookAStar/BookAStar/Pages/Estimate/BookQueriesPage.xaml
rename to BookAStar/BookAStar/Pages/EstimatePages/BookQueriesPage.xaml
index 833e747c..f0478691 100644
--- a/BookAStar/BookAStar/Pages/Estimate/BookQueriesPage.xaml
+++ b/BookAStar/BookAStar/Pages/EstimatePages/BookQueriesPage.xaml
@@ -25,7 +25,8 @@
-
+
+
-
+
@@ -59,5 +60,6 @@
-
+
+
\ No newline at end of file
diff --git a/BookAStar/BookAStar/Pages/Estimate/BookQueriesPage.xaml.cs b/BookAStar/BookAStar/Pages/EstimatePages/BookQueriesPage.xaml.cs
similarity index 100%
rename from BookAStar/BookAStar/Pages/Estimate/BookQueriesPage.xaml.cs
rename to BookAStar/BookAStar/Pages/EstimatePages/BookQueriesPage.xaml.cs
diff --git a/BookAStar/BookAStar/Pages/Estimate/BookQueryPage.xaml b/BookAStar/BookAStar/Pages/EstimatePages/BookQueryPage.xaml
similarity index 78%
rename from BookAStar/BookAStar/Pages/Estimate/BookQueryPage.xaml
rename to BookAStar/BookAStar/Pages/EstimatePages/BookQueryPage.xaml
index 11b3d615..819bdb67 100644
--- a/BookAStar/BookAStar/Pages/Estimate/BookQueryPage.xaml
+++ b/BookAStar/BookAStar/Pages/EstimatePages/BookQueryPage.xaml
@@ -27,7 +27,13 @@
-
+
+
+
+
\ No newline at end of file
diff --git a/BookAStar/BookAStar/Pages/Estimate/BookQueryPage.xaml.cs b/BookAStar/BookAStar/Pages/EstimatePages/BookQueryPage.xaml.cs
similarity index 79%
rename from BookAStar/BookAStar/Pages/Estimate/BookQueryPage.xaml.cs
rename to BookAStar/BookAStar/Pages/EstimatePages/BookQueryPage.xaml.cs
index 0f73d1ed..f343abc1 100644
--- a/BookAStar/BookAStar/Pages/Estimate/BookQueryPage.xaml.cs
+++ b/BookAStar/BookAStar/Pages/EstimatePages/BookQueryPage.xaml.cs
@@ -1,13 +1,14 @@
using System;
+using System.Linq;
using Xamarin.Forms;
using Xamarin.Forms.Maps;
namespace BookAStar.Pages
{
using Data;
+ using EstimatePages;
using Model;
using Model.Workflow;
- using System.Linq;
using ViewModels.EstimateAndBilling;
public partial class BookQueryPage : ContentPage
@@ -71,23 +72,38 @@ namespace BookAStar.Pages
{
DataManager.Current.Contacts.Merge(BookQuery.Client);
DataManager.Current.Contacts.SaveEntity();
- estimateToEdit = new Estimate()
+ estimateToEdit = new Estimate
{
ClientId = BookQuery.Client.UserId,
CommandId = BookQuery.Id,
OwnerId = MainSettings.CurrentUser.Id,
- Id = 0,
- Description = "# **Hello Estimate!**"
+ Id = 0
};
- editEstimateViewModel = new EditEstimateViewModel(estimateToEdit, LocalState.New);
+ editEstimateViewModel = new EditEstimateViewModel(estimateToEdit);
}
else
- editEstimateViewModel = new EditEstimateViewModel(estimateToEdit, LocalState.UpToDate);
+ editEstimateViewModel = new EditEstimateViewModel(estimateToEdit);
DataManager.Current.EstimationCache.Add(editEstimateViewModel);
}
App.NavigationService.NavigateTo(true,
editEstimateViewModel);
+
+
+ }
+
+ private async void OnViewEstimate(object sender, EventArgs ev)
+ {
+ var bookQueryViewModel = (BookQueryViewModel) BindingContext;
+ var buttons = bookQueryViewModel.Estimates.Select(e => $"{e.Id} / {e.Title} / {e.Total}").ToArray();
+ var action = await App.DisplayActionSheet("Estimations validées", "Annuler", null, buttons);
+ if (buttons.Contains(action))
+ {
+ var index = Array.IndexOf(buttons,action);
+ var estimate = bookQueryViewModel.Estimates[index];
+ App.NavigationService.NavigateTo(true,
+ new EditEstimateViewModel(estimate));
+ }
}
protected override void OnSizeAllocated(double width, double height)
diff --git a/BookAStar/BookAStar/Pages/Estimate/EditBillingLinePage.xaml b/BookAStar/BookAStar/Pages/EstimatePages/EditBillingLinePage.xaml
similarity index 92%
rename from BookAStar/BookAStar/Pages/Estimate/EditBillingLinePage.xaml
rename to BookAStar/BookAStar/Pages/EstimatePages/EditBillingLinePage.xaml
index 624909f4..5384e39c 100644
--- a/BookAStar/BookAStar/Pages/Estimate/EditBillingLinePage.xaml
+++ b/BookAStar/BookAStar/Pages/EstimatePages/EditBillingLinePage.xaml
@@ -50,9 +50,6 @@
-