sweet home

This commit is contained in:
Paul Schneider 2017-02-25 17:45:44 +01:00
commit 438e2f8631
28 changed files with 569 additions and 168 deletions

View file

@ -379,8 +379,6 @@ namespace ZicMoove
public void SetupHubConnection()
{
if (chatHubConnection != null)
chatHubConnection.Dispose();
chatHubConnection = new HubConnection(Constants.SignalRHubsUrl);
chatHubConnection.Error += ChatHubConnection_Error;
@ -452,9 +450,11 @@ namespace ZicMoove
}
}
public static async Task PostDeviceInfo()
public static async Task<bool> PostDeviceInfo()
{
var info = GetDeviceInfo();
bool updateImages = false;
if (!string.IsNullOrWhiteSpace(info.GCMRegistrationId))
{
if (MainSettings.CurrentUser != null)
@ -479,7 +479,7 @@ namespace ZicMoove
if ((bool)jvalue["UpdateActivities"])
{
DataManager.Instance.Activities.Execute(null);
DataManager.Instance.Activities.SaveEntity();
updateImages = true;
}
}
}
@ -491,7 +491,9 @@ namespace ZicMoove
}
}
}
return (updateImages);
}
public static GCMRegIdDeclaration GetDeviceInfo()
{
var devinfo = CrossDeviceInfo.Current;
@ -511,7 +513,6 @@ namespace ZicMoove
};
}
public static void ShowBookQuery(BookQuery query)
{
var page = new BookQueryPage

View file

@ -28,6 +28,6 @@ namespace ZicMoove
public const string PermissionMapReceive = Constants.ApplicationName + ".permission.MAPS_RECEIVE";
public const string PermissionC2DMessage = Constants.ApplicationName + ".permission.C2D_MESSAGE";
public const string ImagePath = "images";
}
}

View file

@ -3,18 +3,17 @@ using System.Linq;
namespace ZicMoove.Data
{
/// <summary>
/// Use to not try and update any remote data ...
/// TODO implementation ...
/// </summary>
/// <typeparam name="V"></typeparam>
/// <typeparam name="K"></typeparam>
public class RemoteEntityRO<V,K>: RemoteEntity<V,K> where K: IEquatable<K>
{
public RemoteEntityRO (string controllerName,
Func<V,K> getKey) : base(controllerName,getKey)
{
}
public override void Merge(V item)
{
var key = GetKey(item);
if (this.Any(x => GetKey(x).Equals(key))) { return; }
Add(item);
}
}
}

View file

@ -21,6 +21,7 @@ namespace ZicMoove.Interfaces
void Pay(double amount, PayMethod method, string paymentName);
void UpdateAppImages();
}
}

View file

@ -74,5 +74,6 @@ namespace ZicMoove.Model.Workflow
get;
set;
}
public string LocalPhoto { get; set; }
}
}

View file

@ -3,6 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="ZicMoove.Pages.ClientPages.ActivityPage"
xmlns:local="clr-namespace:ZicMoove;assembly=ZicMoove"
xmlns:views="clr-namespace:ZicMoove.Views;assembly=ZicMoove"
>
<CarouselPage.ItemTemplate>
<DataTemplate>
@ -13,22 +14,32 @@
<ScrollView>
<StackLayout>
<Label Text="{Binding Name}" FontSize="Medium" HorizontalOptions="Center" />
<Image Source="{Binding PhotoUri}" Margin="10,10,10,10" HorizontalOptions="Center" VerticalOptions="CenterAndExpand" />
<Label Text="{Binding Descrition}" HorizontalOptions="Center" />
<ListView ItemsSource="{Binding Forms}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout>
<Button Text="{Binding Title}" CommandParameter="{Binding Action}"/>
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<Frame HasShadow="True">
<StackLayout>
<StackLayout Orientation="Horizontal">
<views:SvgImage Svg="{Binding LocalPhoto}" HorizontalOptions="Start" HeightRequest="100" WidthRequest="100"/>
<Label Text="{Binding Name}" FontSize="Medium" HorizontalOptions="Center" />
</StackLayout>
<Label Text="{Binding Description}" HorizontalOptions="Center" />
<ListView ItemsSource="{Binding Forms}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout>
<Button Text="{Binding Title}" CommandParameter="{Binding Action}"/>
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</Frame>
</StackLayout>
</ScrollView>
</ContentPage>

View file

@ -89,7 +89,7 @@
Grid.Row="0" Grid.Column="3"
FontFamily="Monospace"></Label>
<Image Grid.Row="0" Grid.Column="4" Style="{Binding
Path=ViewModelState.IsValid,
Path=ModelState.IsValid,
Converter={StaticResource boolToStyleImage}}" ></Image>
</Grid>
</ViewCell.View>

View file

@ -17,7 +17,7 @@
</ContentPage.Resources>
<ContentPage.Content>
<StackLayout Padding="10,10,10,10" x:Name="mainLayout">
<ScrollView>
<ScrollView VerticalOptions="Start">
<StackLayout>
<Grid MinimumHeightRequest="12">
<Grid.RowDefinitions>
@ -82,11 +82,11 @@
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand"
BackgroundColor="White"
CaptionText="{Binding Data.Owner?.UserName}" CaptionTextColor="Black"
CaptionText="{Binding CaptionText}" CaptionTextColor="Black"
ClearText="Effacer!" ClearTextColor="Red"
PromptText="Prompt Here" PromptTextColor="Red"
SignatureLineColor="Aqua" StrokeColor="Black" StrokeWidth="2" />
<Button Clicked="OnValidate" Text="Valider cette signature" x:Name="btnValidate" />
PromptText="{Binding PromptText}" PromptTextColor="Red"
SignatureLineColor="Green" StrokeColor="Black" StrokeWidth="3" />
<Button Clicked="OnValidate" Text="Valider cette signature" x:Name="btnValidate" VerticalOptions="End" />
</StackLayout>
</ContentPage.Content>

View file

@ -32,21 +32,8 @@ namespace ZicMoove.Pages.EstimatePages
var evm = (EditEstimateViewModel)BindingContext;
var estimate = evm.Data;
using (var stream = await padView.GetImageStreamAsync(SignatureImageFormat.Png))
{
/*
var signatureMemoryStream = pngStream as MemoryStream;
if (signatureMemoryStream == null)
{
signatureMemoryStream = new MemoryStream();
pngStream.CopyTo(signatureMemoryStream);
}
var byteArray = signatureMemoryStream.ToArray();
var base64String = Convert.ToBase64String(byteArray)
*/
stream.Seek(0, SeekOrigin.Begin);
await DataManager.Instance.Estimates.SignAsProvider(estimate, stream);
DataManager.Instance.Estimates.SaveEntity();
@ -60,33 +47,6 @@ namespace ZicMoove.Pages.EstimatePages
}
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;
}
}
}
}

View file

@ -12,6 +12,7 @@ namespace ZicMoove.Settings
using Model.Social;
using Model.Auth.Account;
using Model.Musical;
using System.Threading.Tasks;
/// <summary>
/// This is the Settings static class that can be used in your Core solution or in any
@ -92,7 +93,13 @@ namespace ZicMoove.Settings
// Inform the server of it.
if (oldregid != value)
{
App.PostDeviceInfo();
var dit = App.PostDeviceInfo();
dit.Wait();
if (dit.IsCompleted)
{
if (dit.Result)
App.PlatformSpecificInstance.UpdateAppImages();
}
}
}
get { return AppSettings.GetValueOrDefault<string>(GoogleRegIdKey); }

View file

@ -187,6 +187,24 @@ namespace ZicMoove {
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Bon pour accord et execution.
/// </summary>
public static string EstimateSigningCaption {
get {
return ResourceManager.GetString("EstimateSigningCaption", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Signez ici.
/// </summary>
public static string EstimateSigningPrompt {
get {
return ResourceManager.GetString("EstimateSigningPrompt", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Star.
/// </summary>

View file

@ -233,4 +233,10 @@
<data name="ProviderContracts" xml:space="preserve">
<value>Contrats fournisseur</value>
</data>
<data name="EstimateSigningCaption" xml:space="preserve">
<value>Bon pour accord et execution</value>
</data>
<data name="EstimateSigningPrompt" xml:space="preserve">
<value>Signez ici</value>
</data>
</root>

View file

@ -64,5 +64,20 @@ namespace ZicMoove.ViewModels.Signing
}
}
}
public string CaptionText
{
get
{
return Strings.EstimateSigningCaption;
}
}
public string PromptText
{
get
{
return Strings.EstimateSigningPrompt;
}
}
}
}

View file

@ -9,9 +9,9 @@
<signature:SignaturePadView x:Name="padView"
HeightRequest="150" WidthRequest="240"
BackgroundColor="White"
CaptionText="Caption This" CaptionTextColor="Black"
ClearText="Efface moi!" ClearTextColor="Red"
PromptText="Prompt Here" PromptTextColor="Red"
CaptionText="{Binding CaptionText}" CaptionTextColor="Black"
ClearText="{Binding ClearText}" ClearTextColor="Red"
PromptText="{Binding PromptText}" PromptTextColor="Red"
SignatureLineColor="Aqua" StrokeColor="Black" StrokeWidth="2" />
<Button Clicked="OnChangeTheme" Text="Changer le Theme" />
<Button Clicked="OnGetStats" Text="Obtenir les stats de la signature " />

View file

@ -11,53 +11,19 @@ namespace ZicMoove.Views
{
public partial class MDSigningView : ContentView
{
public static readonly BindableProperty SignForProperty = BindableProperty.Create(
"SignFor", typeof(string), typeof(MDSigningView), null, BindingMode.OneWay
);
public MDSigningView()
{
InitializeComponent();
}
private async void OnChangeTheme(object sender, EventArgs e)
public string SignFor
{
var action = await App.DisplayActionSheet(
"Change Theme", "Cancel", null,
new string[] { "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;
get {
return GetValue(SignForProperty) as string;
}
}
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 App.DisplayAlert("Stats", $"The signature has {linesCount} lines or {pointCount} points, and is {imageSize:#,###.0}KB (in memory) when saved as a PNG.", "Cool");
}
}
}

View file

@ -0,0 +1,23 @@
using Xamarin.Forms;
namespace ZicMoove.Views
{
public class SvgImage : View
{
public string Svg
{
get
{
return GetValue(SvgProperty) as string;
}
set
{
SetValue(SvgProperty, value);
}
}
public static readonly BindableProperty SvgProperty =
BindableProperty.Create("Svg", typeof(string), typeof(SvgImage),
null, BindingMode.TwoWay);
}
}

View file

@ -277,6 +277,7 @@
<Compile Include="Views\RatingView.xaml.cs">
<DependentUpon>RatingView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\SvgImage.cs" />
<Compile Include="Views\UserListView.xaml.cs">
<DependentUpon>UserListView.xaml</DependentUpon>
</Compile>
@ -389,6 +390,9 @@
<Reference Include="System.Web.Services">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Web.Services.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.Vector.Drawable">
<HintPath>..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Vector.Drawable.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.2.3.2.127\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Core.dll</HintPath>
<Private>True</Private>
@ -409,6 +413,13 @@
<HintPath>..\..\packages\XamForms.Controls.Calendar.1.0.7\lib\portable-net45+wp8+win8+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10+UAP10\XamForms.Controls.Calendar.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="XamSvg.Droid">
<HintPath>..\..\packages\Softlion.XamSvg.Free.2.3.2.5\lib\MonoAndroid44\XamSvg.Droid.dll</HintPath>
</Reference>
<Reference Include="XamSvg.Shared, Version=2.3.2.5, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Softlion.XamSvg.Free.2.3.2.5\lib\portable-win8+net45+wpa81+MonoAndroid44+Xamarin.iOS10\XamSvg.Shared.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="XLabs.Caching, Version=2.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\XLabs.Caching.2.3.0-pre02\lib\portable-net45+netcore45+wpa81+wp8+monoandroid+monotouch+xamarinios10+xamarinmac\XLabs.Caching.dll</HintPath>
<Private>True</Private>

View file

@ -8,6 +8,7 @@
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="portable45-net45+win8+wpa81" />
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="portable45-net45+win8+wpa81" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="portable45-net45+win8+wpa81" />
<package id="Softlion.XamSvg.Free" version="2.3.2.5" targetFramework="portable45-net45+win8+wpa81" />
<package id="SQLite.Net.Core-PCL" version="3.1.1" targetFramework="portable45-net45+win8+wpa81" />
<package id="SQLite.Net-PCL" version="3.1.1" targetFramework="portable45-net45+win8+wpa81" />
<package id="Xam.Plugin.Geofence" version="1.1.2" targetFramework="portable45-net45+win8+wpa81" developmentDependency="true" />