WIP estimate
This commit is contained in:
parent
4d7de134ce
commit
d67c932af2
43 changed files with 816 additions and 94 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<AndroidDesignerPreferredDevice>Nexus 4</AndroidDesignerPreferredDevice>
|
<AndroidDesignerPreferredDevice>Nexus 4</AndroidDesignerPreferredDevice>
|
||||||
|
<SelectedDevice>Android_Accelerated_x86</SelectedDevice>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ReferencePath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v6.0\</ReferencePath>
|
<ReferencePath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v6.0\</ReferencePath>
|
||||||
|
|
|
||||||
88
BookAStar/BookAStar.Droid/MarkdownRazorWebViewClient.cs
Normal file
88
BookAStar/BookAStar.Droid/MarkdownRazorWebViewClient.cs
Normal file
|
|
@ -0,0 +1,88 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
using Android.App;
|
||||||
|
using Android.Content;
|
||||||
|
using Android.OS;
|
||||||
|
using Android.Runtime;
|
||||||
|
using Android.Views;
|
||||||
|
using Android.Widget;
|
||||||
|
using Android.Webkit;
|
||||||
|
using Java.Lang;
|
||||||
|
using Java.IO;
|
||||||
|
using Android.Content.Res;
|
||||||
|
|
||||||
|
namespace BookAStar.Droid
|
||||||
|
{
|
||||||
|
class MarkdownRazorWebViewClient : WebViewClient
|
||||||
|
{
|
||||||
|
Context context;
|
||||||
|
public MarkdownRazorWebViewClient(Context context)
|
||||||
|
{
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private WebResourceResponse getWebResourceResponseFromAssets(string name)
|
||||||
|
{
|
||||||
|
var desc =
|
||||||
|
getActivity().Assets.OpenFd(name);
|
||||||
|
var stream = desc.CreateInputStream();
|
||||||
|
string encoding = null;
|
||||||
|
string mimet = "text/html";
|
||||||
|
if (name.EndsWith(".css"))
|
||||||
|
{
|
||||||
|
mimet = "text/css";
|
||||||
|
encoding = "utf-8";
|
||||||
|
}
|
||||||
|
else if (name.EndsWith(".js"))
|
||||||
|
{ mimet = "text/js";
|
||||||
|
encoding = "utf-8";
|
||||||
|
}
|
||||||
|
else if (name.EndsWith(".ico"))
|
||||||
|
{ mimet = "image/ico";
|
||||||
|
encoding = "utf-8";
|
||||||
|
}
|
||||||
|
|
||||||
|
return new WebResourceResponse(mimet, encoding, stream );
|
||||||
|
|
||||||
|
}
|
||||||
|
private static Activity getActivity ()
|
||||||
|
{
|
||||||
|
return (Activity)App.PlateformSpecificInstance;
|
||||||
|
}
|
||||||
|
public override WebResourceResponse ShouldInterceptRequest(WebView view, IWebResourceRequest request)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (request.Url.Scheme=="file")
|
||||||
|
{
|
||||||
|
return getWebResourceResponseFromAssets(request.Url.Path);
|
||||||
|
}
|
||||||
|
if (request.Url.Scheme=="hybrid")
|
||||||
|
{
|
||||||
|
getActivity().RunOnUiThread(
|
||||||
|
() => testGetContent(view));
|
||||||
|
}
|
||||||
|
return base.ShouldInterceptRequest(view, request);
|
||||||
|
}
|
||||||
|
|
||||||
|
class ContentCallBack : Java.Lang.Object, IValueCallback
|
||||||
|
{
|
||||||
|
public string Result { get; private set; }
|
||||||
|
public void OnReceiveValue(Java.Lang.Object value)
|
||||||
|
{
|
||||||
|
if (value == null) { Result = null; }
|
||||||
|
else { Result = new string(((Java.Lang.String)value).ToCharArray()); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void testGetContent(WebView view)
|
||||||
|
{
|
||||||
|
var cb = new ContentCallBack();
|
||||||
|
view.EvaluateJavascript("$('#Content').val()", cb);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3310,9 +3310,6 @@ namespace BookAStar.Droid
|
||||||
// aapt resource value: 0x7f06004b
|
// aapt resource value: 0x7f06004b
|
||||||
public const int Description = 2131099723;
|
public const int Description = 2131099723;
|
||||||
|
|
||||||
// aapt resource value: 0x7f060052
|
|
||||||
public const int GoogleSenderId = 2131099730;
|
|
||||||
|
|
||||||
// aapt resource value: 0x7f06004d
|
// aapt resource value: 0x7f06004d
|
||||||
public const int Location = 2131099725;
|
public const int Location = 2131099725;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,5 +13,4 @@
|
||||||
<string name="url">url</string>
|
<string name="url">url</string>
|
||||||
<string name="url_hint">url_hint</string>
|
<string name="url_hint">url_hint</string>
|
||||||
<string name="picture">picture</string>
|
<string name="picture">picture</string>
|
||||||
<string name="GoogleSenderId">AA325408689282</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using Android.App;
|
|
||||||
using Android.Content;
|
|
||||||
using Android.OS;
|
|
||||||
using Android.Runtime;
|
|
||||||
using Android.Views;
|
|
||||||
using Android.Widget;
|
|
||||||
|
|
||||||
namespace BookAStar.Droid.Services
|
namespace BookAStar.Droid.Services
|
||||||
{
|
{
|
||||||
|
|
@ -16,37 +6,122 @@ namespace BookAStar.Droid.Services
|
||||||
using Android.Content;
|
using Android.Content;
|
||||||
using Android.OS;
|
using Android.OS;
|
||||||
using Android.Gms.Gcm;
|
using Android.Gms.Gcm;
|
||||||
using Android.Util;
|
using Model.Social;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Model;
|
||||||
|
|
||||||
namespace ClientApp
|
namespace ClientApp
|
||||||
{
|
{
|
||||||
[Service(Exported = false), IntentFilter(new[] { "com.google.android.c2dm.intent.RECEIVE" })]
|
[Service(Exported = false), IntentFilter(new[] { "com.google.android.c2dm.intent.RECEIVE" })]
|
||||||
public class MyGcmListenerService : GcmListenerService
|
public class MyGcmListenerService : GcmListenerService
|
||||||
{
|
{
|
||||||
public override void OnMessageReceived(string from, Bundle data)
|
private Notification.Builder notificationBuilder;
|
||||||
|
|
||||||
|
NotificationManager notificationManager;
|
||||||
|
|
||||||
|
public override void OnCreate()
|
||||||
{
|
{
|
||||||
var message = data.GetString("message");
|
base.OnCreate();
|
||||||
Log.Debug("MyGcmListenerService", "From: " + from);
|
notificationBuilder = new Notification.Builder(this)
|
||||||
Log.Debug("MyGcmListenerService", "Message: " + message);
|
.SetSmallIcon(Resource.Drawable.icon)
|
||||||
SendNotification(message);
|
.SetAutoCancel(true);
|
||||||
|
notificationManager = (NotificationManager)GetSystemService(Context.NotificationService);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendNotification(string message)
|
public override void OnDestroy()
|
||||||
|
{
|
||||||
|
base.OnDestroy();
|
||||||
|
notificationManager.Dispose();
|
||||||
|
notificationManager = null;
|
||||||
|
notificationBuilder.Dispose();
|
||||||
|
notificationBuilder = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnMessageReceived(string from, Bundle data)
|
||||||
|
{
|
||||||
|
var topic = data.GetString("Topic");
|
||||||
|
if (topic == "BookQuery")
|
||||||
|
{
|
||||||
|
DateTime startdate,enddate;
|
||||||
|
|
||||||
|
var sdatestr = data.GetString("StartDate");
|
||||||
|
DateTime.TryParse(sdatestr, out startdate);
|
||||||
|
|
||||||
|
var enddatestr = data.GetString("EndDate");
|
||||||
|
DateTime.TryParse(enddatestr, out enddate);
|
||||||
|
|
||||||
|
var locationJson = data.GetString("Location");
|
||||||
|
var location = JsonConvert.DeserializeObject<Location>(locationJson);
|
||||||
|
var cid = long.Parse(data.GetString("CommandId"));
|
||||||
|
var bq = new BookQueryData
|
||||||
|
{
|
||||||
|
Title = data.GetString("Title"),
|
||||||
|
Description = data.GetString("Description"),
|
||||||
|
Comment = data.GetString("Comment"),
|
||||||
|
StartDate = startdate,
|
||||||
|
EndDate = enddate,
|
||||||
|
CommandId = cid,
|
||||||
|
Address = location
|
||||||
|
};
|
||||||
|
|
||||||
|
SendBookQueryNotification(bq);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new NotImplementedException(topic);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SendNotification(string title, string message)
|
||||||
{
|
{
|
||||||
var intent = new Intent(this, typeof(MainActivity));
|
var intent = new Intent(this, typeof(MainActivity));
|
||||||
intent.AddFlags(ActivityFlags.ClearTop);
|
intent.AddFlags(ActivityFlags.ClearTop);
|
||||||
|
|
||||||
var pendingIntent = PendingIntent.GetActivity(this, 0, intent, PendingIntentFlags.OneShot);
|
var pendingIntent = PendingIntent.GetActivity(this, 0, intent, PendingIntentFlags.OneShot);
|
||||||
|
|
||||||
var notificationBuilder = new Notification.Builder(this)
|
var notificationBuilder = new Notification.Builder(this)
|
||||||
.SetSmallIcon(Resource.Drawable.icon)
|
.SetSmallIcon(Resource.Drawable.icon)
|
||||||
.SetContentTitle("GCM Message")
|
.SetContentTitle(title)
|
||||||
.SetContentText(message)
|
.SetContentText(message)
|
||||||
.SetAutoCancel(true)
|
.SetAutoCancel(true)
|
||||||
.SetContentIntent(pendingIntent);
|
.SetContentIntent(pendingIntent);
|
||||||
|
|
||||||
var notificationManager = (NotificationManager)GetSystemService(Context.NotificationService);
|
|
||||||
notificationManager.Notify(0, notificationBuilder.Build());
|
notificationManager.Notify(0, notificationBuilder.Build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SendBookQueryNotification(BookQueryData bquery)
|
||||||
|
{
|
||||||
|
var bookquerynotifications = MainSettings.AddBookQueryNotification(bquery);
|
||||||
|
var count = bookquerynotifications.Length;
|
||||||
|
var multiple = count > 1;
|
||||||
|
var title =
|
||||||
|
multiple ? $"{count} demandes" : bquery.Title;
|
||||||
|
var message = bquery.Description;
|
||||||
|
|
||||||
|
var intent = new Intent(this, typeof(MainActivity));
|
||||||
|
intent.AddFlags(ActivityFlags.ClearTop);
|
||||||
|
intent.PutExtra("BookQueryId", bquery.CommandId);
|
||||||
|
|
||||||
|
var pendingIntent = PendingIntent.GetActivity(this, 0, intent, PendingIntentFlags.OneShot);
|
||||||
|
Notification.InboxStyle inboxStyle = new Notification.InboxStyle();
|
||||||
|
int maxil = 5;
|
||||||
|
for (int cn = 0; cn < count && cn < maxil; cn++)
|
||||||
|
{
|
||||||
|
inboxStyle.AddLine(bookquerynotifications[cn].Description);
|
||||||
|
}
|
||||||
|
if (count > maxil)
|
||||||
|
inboxStyle.SetSummaryText($"Plus {count - maxil} autres");
|
||||||
|
else inboxStyle.SetSummaryText((string)null);
|
||||||
|
notificationBuilder.SetContentTitle(title).SetContentText(message)
|
||||||
|
.SetStyle(inboxStyle)
|
||||||
|
.SetContentIntent(pendingIntent);
|
||||||
|
|
||||||
|
var notification = notificationBuilder.Build();
|
||||||
|
notificationManager.Notify(bookQueryNotificationId, notification );
|
||||||
|
}
|
||||||
|
|
||||||
|
int bookQueryNotificationId=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -34,10 +34,6 @@
|
||||||
<Setter Property="WidthRequest" Value="200" />
|
<Setter Property="WidthRequest" Value="200" />
|
||||||
<Setter Property="TextColor" Value="Teal" />
|
<Setter Property="TextColor" Value="Teal" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style TargetType="Label">
|
|
||||||
<Setter Property="FontSize" Value="Large" />
|
|
||||||
<Setter Property="FontAttributes" Value="Bold" />
|
|
||||||
</Style>
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
using Xamarin.Forms.Xaml;
|
using Xamarin.Forms.Xaml;
|
||||||
using Yavsc.Helpers;
|
|
||||||
/*
|
/*
|
||||||
Glyphish icons from
|
Glyphish icons from
|
||||||
http://www.glyphish.com/
|
http://www.glyphish.com/
|
||||||
|
|
@ -29,8 +28,12 @@ namespace BookAStar
|
||||||
public static IPlatform PlateformSpecificInstance { get; set; }
|
public static IPlatform PlateformSpecificInstance { get; set; }
|
||||||
public static string AppName { get; set; }
|
public static string AppName { get; set; }
|
||||||
public static App CurrentApp { get { return Current as App; } }
|
public static App CurrentApp { get { return Current as App; } }
|
||||||
|
|
||||||
|
public DataManager DataManager { get; set; }
|
||||||
|
|
||||||
public App (IPlatform instance)
|
public App (IPlatform instance)
|
||||||
{
|
{
|
||||||
|
DataManager = new DataManager();
|
||||||
deviceInfoPage = new DeviceInfoPage(instance.GetDeviceInfo());
|
deviceInfoPage = new DeviceInfoPage(instance.GetDeviceInfo());
|
||||||
|
|
||||||
PlateformSpecificInstance = instance;
|
PlateformSpecificInstance = instance;
|
||||||
|
|
@ -60,7 +63,15 @@ namespace BookAStar
|
||||||
settingsPage.Focus();
|
settingsPage.Focus();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ToolbarItem tiMap = new ToolbarItem { Text = "Carte",
|
ToolbarItem tiQueries = new ToolbarItem
|
||||||
|
{
|
||||||
|
Text = "Demandes"
|
||||||
|
};
|
||||||
|
tiQueries.Clicked += (object sender, EventArgs e) => {
|
||||||
|
mp.Navigation.PushAsync(new Pages.MakeAnEstimatePage());
|
||||||
|
};
|
||||||
|
mp.ToolbarItems.Add(tiQueries);
|
||||||
|
ToolbarItem tiMap = new ToolbarItem { Text = "Carte",
|
||||||
Icon = "glyphish_07_map_marker.png"
|
Icon = "glyphish_07_map_marker.png"
|
||||||
};
|
};
|
||||||
mp.ToolbarItems.Add (tiMap);
|
mp.ToolbarItems.Add (tiMap);
|
||||||
|
|
@ -90,6 +101,10 @@ namespace BookAStar
|
||||||
PlateformSpecificInstance.GetDeviceInfo());
|
PlateformSpecificInstance.GetDeviceInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ShowBookQuery(long queryId)
|
||||||
|
{
|
||||||
|
mp.Navigation.PushAsync(new BookQueryPage(queryId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,18 +38,26 @@
|
||||||
<Compile Include="App.xaml.cs">
|
<Compile Include="App.xaml.cs">
|
||||||
<DependentUpon>App.xaml</DependentUpon>
|
<DependentUpon>App.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="DeviceInfoPage.cs" />
|
<Compile Include="DataManager.cs" />
|
||||||
<Compile Include="EventDetail.xaml.cs">
|
<Compile Include="Pages\BlogPage.cs" />
|
||||||
|
<Compile Include="Pages\BookQueryPage.xaml.cs">
|
||||||
|
<DependentUpon>BookQueryPage.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Pages\DeviceInfoPage.cs" />
|
||||||
|
<Compile Include="Pages\EventDetail.xaml.cs">
|
||||||
<DependentUpon>EventDetail.xaml</DependentUpon>
|
<DependentUpon>EventDetail.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Helpers\MainSettings.cs" />
|
<Compile Include="Helpers\MainSettings.cs" />
|
||||||
<Compile Include="IdentificationChangedEventArgs.cs" />
|
<Compile Include="Helpers\RemoteEntity.cs" />
|
||||||
<Compile Include="IPlatform.cs" />
|
<Compile Include="IPlatform.cs" />
|
||||||
<Compile Include="MainPage.xaml.cs">
|
<Compile Include="Pages\MainPage.xaml.cs">
|
||||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Model\Blog\Blog.cs" />
|
<Compile Include="Model\Blog\Blog.cs" />
|
||||||
<Compile Include="Model\Blog\BlogTag.cs" />
|
<Compile Include="Model\Blog\BlogTag.cs" />
|
||||||
|
<Compile Include="Model\BookQueryData.cs" />
|
||||||
|
<Compile Include="Model\Market\BaseProduct.cs" />
|
||||||
|
<Compile Include="Model\Workflow\CommandLine.cs" />
|
||||||
<Compile Include="Model\Manager.cs" />
|
<Compile Include="Model\Manager.cs" />
|
||||||
<Compile Include="Model\Auth\MobileAppDeclaration.cs" />
|
<Compile Include="Model\Auth\MobileAppDeclaration.cs" />
|
||||||
<Compile Include="Model\Auth\passwrecovery.cs" />
|
<Compile Include="Model\Auth\passwrecovery.cs" />
|
||||||
|
|
@ -83,18 +91,29 @@
|
||||||
<Compile Include="Model\Social\Messaging\YaEvent.cs" />
|
<Compile Include="Model\Social\Messaging\YaEvent.cs" />
|
||||||
<Compile Include="Model\Auth\Tokens.cs" />
|
<Compile Include="Model\Auth\Tokens.cs" />
|
||||||
<Compile Include="Model\Auth\User.cs" />
|
<Compile Include="Model\Auth\User.cs" />
|
||||||
<Compile Include="PinPage.cs" />
|
<Compile Include="Model\Workflow\Estimate.cs" />
|
||||||
|
<Compile Include="Pages\MakeAnEstimatePage.xaml.cs">
|
||||||
|
<DependentUpon>MakeAnEstimatePage.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Pages\MarkdownEditorPage.xaml.cs">
|
||||||
|
<DependentUpon>MarkdownEditorPage.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Pages\PinPage.cs" />
|
||||||
|
<Compile Include="Views\MarkdownView.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="SearchPage.xaml.cs">
|
<Compile Include="Pages\QueriesPage.xaml.cs">
|
||||||
|
<DependentUpon>QueriesPage.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Pages\SearchPage.xaml.cs">
|
||||||
<DependentUpon>SearchPage.xaml</DependentUpon>
|
<DependentUpon>SearchPage.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="SettingsPage.xaml.cs">
|
<Compile Include="Pages\SettingsPage.xaml.cs">
|
||||||
<DependentUpon>SettingsPage.xaml</DependentUpon>
|
<DependentUpon>SettingsPage.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Model\Tag.cs" />
|
<Compile Include="Model\Tag.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="MainPage.xaml">
|
<EmbeddedResource Include="Pages\MainPage.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
|
@ -109,26 +128,29 @@
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="EventDetail.xaml">
|
<EmbeddedResource Include="Pages\EventDetail.xaml">
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="SearchPage.xaml">
|
<EmbeddedResource Include="Pages\SearchPage.xaml">
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="SettingsPage.xaml">
|
<EmbeddedResource Include="Pages\SettingsPage.xaml">
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Model\Workflow\" />
|
<Folder Include="Model\Billing\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Json.NET.Web">
|
<Reference Include="Json.NET.Web">
|
||||||
<HintPath>..\..\packages\Json.NET.Web.1.0.49\lib\portable45-net45+win8+wpa81\Json.NET.Web.dll</HintPath>
|
<HintPath>..\..\packages\Json.NET.Web.1.0.49\lib\portable45-net45+win8+wpa81\Json.NET.Web.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="MarkdownDeep">
|
||||||
|
<HintPath>..\..\packages\MarkdownDeep-av.NET.1.5.2\lib\net451\MarkdownDeep.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="Mono.Android">
|
<Reference Include="Mono.Android">
|
||||||
<HintPath>..\..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v6.0\Mono.Android.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v6.0\Mono.Android.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
|
@ -160,12 +182,36 @@
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Pages\BookQueryPage.xaml">
|
||||||
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\Yavsc.Client\Yavsc.Client.csproj">
|
<ProjectReference Include="..\..\Yavsc.Client\Yavsc.Client.csproj">
|
||||||
<Project>{67F9D3A8-F71E-4428-913F-C37AE82CDB24}</Project>
|
<Project>{67f9d3a8-f71e-4428-913f-c37ae82cdb24}</Project>
|
||||||
<Name>Yavsc.Client</Name>
|
<Name>Yavsc.Client</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Pages\QueriesPage.xaml">
|
||||||
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Pages\MarkdownEditorPage.xaml">
|
||||||
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Pages\MakeAnEstimatePage.xaml">
|
||||||
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
||||||
<Import Project="..\..\packages\Xamarin.Forms.2.3.0.107\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.2.3.0.107\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
|
<Import Project="..\..\packages\Xamarin.Forms.2.3.0.107\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.2.3.0.107\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
|
|
|
||||||
33
BookAStar/BookAStar/DataManager.cs
Normal file
33
BookAStar/BookAStar/DataManager.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BookAStar
|
||||||
|
{
|
||||||
|
using Model;
|
||||||
|
using Model.Blog;
|
||||||
|
using Model.Workflow;
|
||||||
|
|
||||||
|
public class DataManager
|
||||||
|
{
|
||||||
|
public RemoteEntity<BookQueryData, long> BookQueries { get; set; }
|
||||||
|
public RemoteEntity<Estimate, long> Estimates { get; set; }
|
||||||
|
public RemoteEntity<Blog, long> Blogspot { get; set; }
|
||||||
|
|
||||||
|
public DataManager()
|
||||||
|
{
|
||||||
|
BookQueries = new RemoteEntity<BookQueryData, long>("bookqueries",
|
||||||
|
q => q.CommandId);
|
||||||
|
Estimates = new RemoteEntity<Estimate, long>("estimates",
|
||||||
|
x => x.Id);
|
||||||
|
Blogspot = new RemoteEntity<Blog, long>("blogspot",
|
||||||
|
x=>x.Id);
|
||||||
|
}
|
||||||
|
public async Task<BookQueryData> GetBookQuery(long bookQueryId)
|
||||||
|
{
|
||||||
|
return await BookQueries.Get(bookQueryId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
// Helpers/Settings.cs
|
// Helpers/Settings.cs
|
||||||
|
using BookAStar.Model;
|
||||||
using BookAStar.Model.Auth.Account;
|
using BookAStar.Model.Auth.Account;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Plugin.Settings;
|
using Plugin.Settings;
|
||||||
|
|
@ -58,7 +59,6 @@ namespace BookAStar
|
||||||
};
|
};
|
||||||
private static readonly Dictionary<string, double> environ = new Dictionary<string, double>();
|
private static readonly Dictionary<string, double> environ = new Dictionary<string, double>();
|
||||||
|
|
||||||
public static readonly string YavscApiUrl = "http://dev.pschneider.fr/api";
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
@ -68,6 +68,25 @@ namespace BookAStar
|
||||||
return AppSettings.GetValueOrDefault<string>(userNameKey, null);
|
return AppSettings.GetValueOrDefault<string>(userNameKey, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public const string bookQueryNotificationsKey = "BookQueryNotifications";
|
||||||
|
public static BookQueryData[] GetBookQueryNotifications()
|
||||||
|
{
|
||||||
|
// Do not return any null List
|
||||||
|
var json = AppSettings.GetValueOrDefault<string>(bookQueryNotificationsKey);
|
||||||
|
if (!string.IsNullOrWhiteSpace(json))
|
||||||
|
return JsonConvert.DeserializeObject<BookQueryData[]>(json);
|
||||||
|
return new BookQueryData[] {};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BookQueryData[] AddBookQueryNotification(BookQueryData query)
|
||||||
|
{
|
||||||
|
var existing = new List<BookQueryData>(GetBookQueryNotifications());
|
||||||
|
existing.Add(query);
|
||||||
|
var result = existing.ToArray();
|
||||||
|
AppSettings.AddOrUpdateValue(bookQueryNotificationsKey,
|
||||||
|
JsonConvert.SerializeObject(result));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public static string GoogleRegId
|
public static string GoogleRegId
|
||||||
{
|
{
|
||||||
|
|
@ -185,10 +204,11 @@ namespace BookAStar
|
||||||
return environ;
|
return environ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public const string YavscHomeUrl = "http://dev.pschneider.fr";
|
||||||
public const string MobileRegistrationUrl = "http://dev.pschneider.fr/api/gcm/register";
|
public static readonly string YavscApiUrl = "http://dev.pschneider.fr/api";
|
||||||
|
public static readonly string MobileRegistrationUrl = YavscApiUrl + "/gcm/register";
|
||||||
|
public static readonly string UserInfoUrl = YavscApiUrl + "/me";
|
||||||
|
public static readonly string BlogUrl = YavscApiUrl + "/blogs";
|
||||||
public const string ApplicationName = "BookAStar";
|
public const string ApplicationName = "BookAStar";
|
||||||
public static readonly string UserInfoUrl = "http://dev.pschneider.fr/api/me";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
113
BookAStar/BookAStar/Helpers/RemoteEntity.cs
Normal file
113
BookAStar/BookAStar/Helpers/RemoteEntity.cs
Normal file
|
|
@ -0,0 +1,113 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net.Http;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BookAStar
|
||||||
|
{
|
||||||
|
public class RemoteEntity<V,K> : ICommand where K : IEquatable<K>
|
||||||
|
{
|
||||||
|
private string _controller;
|
||||||
|
public event EventHandler CanExecuteChanged;
|
||||||
|
public bool IsExecuting { get; private set; }
|
||||||
|
public ObservableCollection<V> LocalData;
|
||||||
|
private Func<V, K> _getKey ;
|
||||||
|
private HttpClient client;
|
||||||
|
private Uri controllerUri;
|
||||||
|
|
||||||
|
public bool CanExecute(object parameter)
|
||||||
|
{
|
||||||
|
return !IsExecuting;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RemoteEntity(string controllerName, Func<V,K> getKey)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(controllerName) || getKey == null)
|
||||||
|
throw new InvalidOperationException();
|
||||||
|
_controller = controllerName;
|
||||||
|
_getKey = getKey;
|
||||||
|
LocalData = new ObservableCollection<V>();
|
||||||
|
client = new HttpClient();
|
||||||
|
controllerUri = new Uri(MainSettings.YavscApiUrl + "/" + _controller);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BeforeExecute()
|
||||||
|
{
|
||||||
|
if (IsExecuting)
|
||||||
|
throw new InvalidOperationException("Already executing");
|
||||||
|
IsExecuting = true;
|
||||||
|
if (CanExecuteChanged != null)
|
||||||
|
CanExecuteChanged.Invoke(this, new EventArgs());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Refresh the collection
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parameter"></param>
|
||||||
|
public async void Execute(object parameter)
|
||||||
|
{
|
||||||
|
BeforeExecute();
|
||||||
|
// Get the whole data
|
||||||
|
|
||||||
|
var response = await client.GetAsync(controllerUri);
|
||||||
|
if (response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
var content = await response.Content.ReadAsStringAsync();
|
||||||
|
List<V> col = JsonConvert.DeserializeObject<List<V>>(content);
|
||||||
|
// LocalData.Clear();
|
||||||
|
foreach (var item in col)
|
||||||
|
{
|
||||||
|
Update(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AfterExecuting();
|
||||||
|
}
|
||||||
|
private void Update (V item)
|
||||||
|
{
|
||||||
|
var key = _getKey(item);
|
||||||
|
if (LocalData.Any(x => _getKey(x).Equals(key)))
|
||||||
|
{
|
||||||
|
LocalData.Remove(LocalGet(key));
|
||||||
|
}
|
||||||
|
LocalData.Add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
public V LocalGet(K key)
|
||||||
|
{
|
||||||
|
return LocalData.Single(x => _getKey(x).Equals(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AfterExecuting()
|
||||||
|
{
|
||||||
|
IsExecuting = false;
|
||||||
|
if (CanExecuteChanged != null)
|
||||||
|
CanExecuteChanged.Invoke(this, new EventArgs());
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<V> Get(K key)
|
||||||
|
{
|
||||||
|
V item = default(V);
|
||||||
|
BeforeExecute();
|
||||||
|
// Get the whole data
|
||||||
|
var uri = new Uri(controllerUri.AbsolutePath+"/"+key.ToString());
|
||||||
|
|
||||||
|
var response = await client.GetAsync(uri);
|
||||||
|
if (response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
var content = await response.Content.ReadAsStringAsync();
|
||||||
|
item = JsonConvert.DeserializeObject<V>(content);
|
||||||
|
// LocalData.Clear();
|
||||||
|
Update(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
AfterExecuting();
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using BookAStar.Model.Auth.Account;
|
using BookAStar.Model.Auth.Account;
|
||||||
|
using Xamarin.Forms;
|
||||||
using Yavsc.Models.Identity;
|
using Yavsc.Models.Identity;
|
||||||
|
|
||||||
namespace BookAStar
|
namespace BookAStar
|
||||||
|
|
@ -22,6 +23,8 @@ namespace BookAStar
|
||||||
TAnswer InvokeApi<TAnswer>(string method, object arg);
|
TAnswer InvokeApi<TAnswer>(string method, object arg);
|
||||||
|
|
||||||
object InvokeApi(string method, object arg);
|
object InvokeApi(string method, object arg);
|
||||||
|
|
||||||
|
View CreateMarkdownView(string markdown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
using BookAStar.Model.Auth.Account;
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace BookAStar
|
|
||||||
{
|
|
||||||
public class IdentificationChangedEventArgs : EventArgs
|
|
||||||
{
|
|
||||||
public User NewIdentification { get; private set; }
|
|
||||||
public IdentificationChangedEventArgs(User newId)
|
|
||||||
{
|
|
||||||
NewIdentification = newId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -5,7 +5,7 @@ using Yavsc.Models.Identity;
|
||||||
|
|
||||||
namespace BookAStar.Model.Auth.Account
|
namespace BookAStar.Model.Auth.Account
|
||||||
{
|
{
|
||||||
public class GoogleCloudMobileDeclaration : IGoogleCloudMobileDeclaration
|
public class GoogleCloudMobileDeclaration
|
||||||
{
|
{
|
||||||
public string GCMRegistrationId { get; set; }
|
public string GCMRegistrationId { get; set; }
|
||||||
public string DeviceId { get; set; }
|
public string DeviceId { get; set; }
|
||||||
|
|
|
||||||
16
BookAStar/BookAStar/Model/BookQueryData.cs
Normal file
16
BookAStar/BookAStar/Model/BookQueryData.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
using BookAStar.Model.Social;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace BookAStar.Model
|
||||||
|
{
|
||||||
|
public class BookQueryData
|
||||||
|
{
|
||||||
|
public string Title { get; set; }
|
||||||
|
public string Description { set; get; }
|
||||||
|
public string Comment { get; set; }
|
||||||
|
public long CommandId { get; set; }
|
||||||
|
public DateTime StartDate { get; set; }
|
||||||
|
public DateTime EndDate { get; set; }
|
||||||
|
public Location Address { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,24 +1,30 @@
|
||||||
using BookAStar.Model.Social;
|
using BookAStar.Model.Social;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace BookAStar
|
namespace BookAStar
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static class Manager
|
public static class Manager
|
||||||
{
|
{
|
||||||
static Manager ()
|
static Manager ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
public static ICommand RefreshBookQueries;
|
||||||
|
|
||||||
|
|
||||||
// TODO WIP TEST rop this
|
// TODO WIP TEST rop this
|
||||||
private static Location[] _places = new Location[] {
|
private static Location[] _places = new Location[] {
|
||||||
new Location(48.8626458, 2.2065559, "2 bd Aristide Briand - Suresnes" ),
|
new Location { Latitude = 48.8626458, Longitude = 2.2065559, Address = "2 bd Aristide Briand - Suresnes" },
|
||||||
new Location(48.8632757, 2.2023099, "Théatre Jean Villard - Suresnes" ),
|
new Location{ Latitude =48.8632757, Longitude =2.2023099, Address ="Théatre Jean Villard - Suresnes" },
|
||||||
new Location(48.8647120, 2.2054588, "Place de la Paix - Suresnes" ),
|
new Location{ Latitude =48.8647120, Longitude =2.2054588,Address = "Place de la Paix - Suresnes" },
|
||||||
new Location(48.8640133, 2.2056573, "Restaurant" ),
|
new Location{ Latitude =48.8640133, Longitude =2.2056573, Address ="Restaurant" },
|
||||||
new Location(48.8634839, 2.2064137, "Square" ),
|
new Location{ Latitude =48.8634839, Longitude =2.2064137,Address = "Square" },
|
||||||
new Location(48.8653649, 2.2014945, "Stade de foot" ),
|
new Location{ Latitude =48.8653649, Longitude =2.2014945,Address = "Stade de foot" },
|
||||||
};
|
};
|
||||||
// TODO WIP TEST rop this
|
// TODO WIP TEST rop this
|
||||||
private static ObservableCollection<LocalizedEvent> _your_events = new ObservableCollection<LocalizedEvent> {
|
private static ObservableCollection<LocalizedEvent> _your_events = new ObservableCollection<LocalizedEvent> {
|
||||||
|
|
|
||||||
26
BookAStar/BookAStar/Model/Market/BaseProduct.cs
Normal file
26
BookAStar/BookAStar/Model/Market/BaseProduct.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
|
||||||
|
namespace BookAStar.Model.Workflow
|
||||||
|
{
|
||||||
|
public partial class BaseProduct
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An unique product identifier.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public long Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// A contractual description for this product.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Description { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Controls wether this product or service
|
||||||
|
/// may be offered to clients, or simply
|
||||||
|
/// are internal workflow entry point.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>true when this product belongs to the public catalog.</returns>
|
||||||
|
public bool Public { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using Android.Runtime;
|
||||||
using BookAStar.Model.Workflow.Messaging;
|
using BookAStar.Model.Workflow.Messaging;
|
||||||
|
|
||||||
namespace BookAStar.Model.Social
|
namespace BookAStar.Model.Social
|
||||||
|
|
@ -24,16 +26,11 @@ namespace BookAStar.Model.Social
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class Location : Position {
|
public class Location : Position {
|
||||||
|
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
public string Address { get; set; }
|
public string Address { get; set; }
|
||||||
public Location(double latitude, double longitude, string address)
|
|
||||||
{
|
|
||||||
this.Latitude = latitude;
|
|
||||||
this.Longitude = longitude;
|
|
||||||
this.Address = address;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
13
BookAStar/BookAStar/Model/Workflow/CommandLine.cs
Normal file
13
BookAStar/BookAStar/Model/Workflow/CommandLine.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
namespace BookAStar.Model.Workflow
|
||||||
|
{
|
||||||
|
|
||||||
|
public class CommandLine
|
||||||
|
{
|
||||||
|
public long Id { get; set; }
|
||||||
|
public string Comment { get; set; }
|
||||||
|
public BaseProduct Article { get; set; }
|
||||||
|
public int Count { get; set; }
|
||||||
|
public decimal UnitaryCost { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
58
BookAStar/BookAStar/Model/Workflow/Estimate.cs
Normal file
58
BookAStar/BookAStar/Model/Workflow/Estimate.cs
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BookAStar.Model.Workflow
|
||||||
|
{
|
||||||
|
public partial class Estimate
|
||||||
|
{
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
public long? CommandId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// A command is not required to create
|
||||||
|
/// an estimate,
|
||||||
|
/// it will result in a new estimate template
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public BookQueryPage Query { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
public int? Status { get; set; }
|
||||||
|
public string Title { get; set; }
|
||||||
|
public List<CommandLine> Bill { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// List of attached graphic files
|
||||||
|
/// to this estimate, as relative pathes to
|
||||||
|
/// the command performer's root path.
|
||||||
|
/// In db, they are separated by <c>:</c>
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<string> AttachedGraphicList { get; private set; }
|
||||||
|
|
||||||
|
public string AttachedGraphicsString
|
||||||
|
{
|
||||||
|
get { return string.Join(":", AttachedGraphicList); }
|
||||||
|
set { AttachedGraphicList = value.Split(':').ToList(); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// List of attached files
|
||||||
|
/// to this estimate, as relative pathes to
|
||||||
|
/// the command performer's root path.
|
||||||
|
/// In db, they are separated by <c>:</c>
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<string> AttachedFiles { get; set; }
|
||||||
|
public string AttachedFilesString
|
||||||
|
{
|
||||||
|
get { return string.Join(":", AttachedFiles); }
|
||||||
|
set { AttachedFiles = value.Split(':').ToList(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string OwnerId { get; set; }
|
||||||
|
private RemoteEntity<BookQueryData, long> BookQueries;
|
||||||
|
|
||||||
|
public string ClientId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
57
BookAStar/BookAStar/Pages/BlogPage.cs
Normal file
57
BookAStar/BookAStar/Pages/BlogPage.cs
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
using BookAStar.Model.Blog;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection.Emit;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
using Xamarin.Forms;
|
||||||
|
using Yavsc.Models;
|
||||||
|
|
||||||
|
namespace BookAStar
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public class BlogPage : ContentPage
|
||||||
|
{
|
||||||
|
HtmlWebViewSource _source;
|
||||||
|
HtmlWebViewSource _sourceTitle;
|
||||||
|
MarkdownDeep.Markdown _md;
|
||||||
|
WebView titleLabel;
|
||||||
|
WebView contentView;
|
||||||
|
|
||||||
|
public BlogPage()
|
||||||
|
{
|
||||||
|
_source = new HtmlWebViewSource();
|
||||||
|
_sourceTitle = new HtmlWebViewSource();
|
||||||
|
_md = new MarkdownDeep.Markdown();
|
||||||
|
_sourceTitle.BaseUrl = _source.BaseUrl = MainSettings.YavscHomeUrl;
|
||||||
|
_sourceTitle.Html = "Hello";
|
||||||
|
titleLabel = new WebView { Source = _sourceTitle };
|
||||||
|
contentView = new WebView { Source = _source };
|
||||||
|
|
||||||
|
Content = new StackLayout
|
||||||
|
{
|
||||||
|
Children = {
|
||||||
|
titleLabel,
|
||||||
|
contentView
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnBindingContextChanged()
|
||||||
|
{
|
||||||
|
base.OnBindingContextChanged();
|
||||||
|
var blog = BindingContext as Blog;
|
||||||
|
if (blog == null)
|
||||||
|
{
|
||||||
|
_sourceTitle.Html = _source.Html = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_sourceTitle.Html = _md.Transform(blog.bcontent);
|
||||||
|
_source.Html = _md.Transform(blog.bcontent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
BookAStar/BookAStar/Pages/BookQueryPage.xaml
Normal file
15
BookAStar/BookAStar/Pages/BookQueryPage.xaml
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
x:Class="BookAStar.BookQueryPage">
|
||||||
|
<StackLayout x:Name="bookQueryLayout">
|
||||||
|
<Label Text="{Binding Title}" VerticalOptions="Start" HorizontalOptions="Center" />
|
||||||
|
<Label Text="{Binding Description}" VerticalOptions="FillAndExpand" HorizontalOptions="Center" />
|
||||||
|
<Label Text="{Binding CommandId}" VerticalOptions="Center" HorizontalOptions="Center" />
|
||||||
|
<Label Text="{Binding Comment}" VerticalOptions="Center" HorizontalOptions="Center" />
|
||||||
|
<Label Text="{Binding StartDate}" VerticalOptions="Center" HorizontalOptions="Center" />
|
||||||
|
<Label Text="{Binding EndDate}" VerticalOptions="Center" HorizontalOptions="Center" />
|
||||||
|
<Label Text="{Binding Address}" VerticalOptions="Center" HorizontalOptions="Center" />
|
||||||
|
<Button Text="Faire un devis" Clicked="MakeAnEstimate" VerticalOptions="Center" HorizontalOptions="End"/>
|
||||||
|
</StackLayout>
|
||||||
|
</ContentPage>
|
||||||
56
BookAStar/BookAStar/Pages/BookQueryPage.xaml.cs
Normal file
56
BookAStar/BookAStar/Pages/BookQueryPage.xaml.cs
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
using Xamarin.Forms;
|
||||||
|
using Xamarin.Forms.Maps;
|
||||||
|
|
||||||
|
namespace BookAStar
|
||||||
|
{
|
||||||
|
using Model;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
public partial class BookQueryPage : ContentPage
|
||||||
|
{
|
||||||
|
private Map map;
|
||||||
|
public BookQueryPage(long bookQueryId)
|
||||||
|
{
|
||||||
|
|
||||||
|
InitializeComponent();
|
||||||
|
if (bookQueryId == 0)
|
||||||
|
throw new InvalidOperationException("No id");
|
||||||
|
BookQueryData bquery = null;
|
||||||
|
Task.Run( async () => { bquery = await App.CurrentApp.DataManager.BookQueries.Get(bookQueryId); });
|
||||||
|
|
||||||
|
BindingContext = bquery;
|
||||||
|
if (bquery==null)
|
||||||
|
throw new InvalidOperationException("No data");
|
||||||
|
|
||||||
|
var lat = bquery.Address.Latitude;
|
||||||
|
var lon = bquery.Address.Longitude;
|
||||||
|
var pin = new Pin
|
||||||
|
{
|
||||||
|
Type = PinType.SearchResult,
|
||||||
|
Position = new Position(
|
||||||
|
lat , lon ),
|
||||||
|
Label = bquery.Title,
|
||||||
|
Address = bquery.Address.Address
|
||||||
|
};
|
||||||
|
pin.BindingContext = bquery;
|
||||||
|
map.Pins.Add(pin);
|
||||||
|
map.MoveToRegion(MapSpan.FromCenterAndRadius(
|
||||||
|
new Position(lat, lon), Distance.FromMeters(100)));
|
||||||
|
bookQueryLayout.Children.Add(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MakeAnEstimate(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnBindingContextChanged()
|
||||||
|
{
|
||||||
|
base.OnBindingContextChanged();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -10,9 +10,6 @@ namespace BookAStar
|
||||||
{
|
{
|
||||||
public partial class EventDetail : ContentPage
|
public partial class EventDetail : ContentPage
|
||||||
{
|
{
|
||||||
|
|
||||||
public ObservableCollection<YaEvent> Events
|
|
||||||
{ get; private set; }
|
|
||||||
public EventDetail (YaEvent ev)
|
public EventDetail (YaEvent ev)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
@ -21,13 +18,6 @@ namespace BookAStar
|
||||||
App.PlateformSpecificInstance.OpenWeb(ev.EventWebPage);
|
App.PlateformSpecificInstance.OpenWeb(ev.EventWebPage);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
///protected override void OnDisappearing ()
|
|
||||||
|
|
||||||
// { Navigation.PopAsync (); }
|
|
||||||
|
|
||||||
//private async void Close() {
|
|
||||||
//await Navigation.PopAsync ();
|
|
||||||
//}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
9
BookAStar/BookAStar/Pages/MakeAnEstimatePage.xaml
Normal file
9
BookAStar/BookAStar/Pages/MakeAnEstimatePage.xaml
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
x:Class="BookAStar.Pages.MakeAnEstimatePage"
|
||||||
|
xmlns:local="clr-namespace:BookAStar.Views;assembly=BookAStar"
|
||||||
|
>
|
||||||
|
|
||||||
|
<local:MarkdownView x:Name="mdview" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" ></local:MarkdownView>
|
||||||
|
</ContentPage>
|
||||||
21
BookAStar/BookAStar/Pages/MakeAnEstimatePage.xaml.cs
Normal file
21
BookAStar/BookAStar/Pages/MakeAnEstimatePage.xaml.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
using BookAStar.Views;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
namespace BookAStar.Pages
|
||||||
|
{
|
||||||
|
public partial class MakeAnEstimatePage : ContentPage
|
||||||
|
{
|
||||||
|
public MakeAnEstimatePage()
|
||||||
|
{
|
||||||
|
var m = new MarkdownView();
|
||||||
|
InitializeComponent();
|
||||||
|
var md = this.mdview.Markdown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
BookAStar/BookAStar/Pages/MarkdownEditorPage.xaml
Normal file
9
BookAStar/BookAStar/Pages/MarkdownEditorPage.xaml
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
x:Class="BookAStar.Pages.MarkdownEditorPage">
|
||||||
|
<Editor VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"
|
||||||
|
x:Name="editor"
|
||||||
|
/>
|
||||||
|
<WebView x:Name="webView"></WebView>
|
||||||
|
</ContentPage>
|
||||||
23
BookAStar/BookAStar/Pages/MarkdownEditorPage.xaml.cs
Normal file
23
BookAStar/BookAStar/Pages/MarkdownEditorPage.xaml.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
namespace BookAStar.Pages
|
||||||
|
{
|
||||||
|
public partial class MarkdownEditorPage : ContentPage
|
||||||
|
{
|
||||||
|
public MarkdownEditorPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GetText()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
6
BookAStar/BookAStar/Pages/QueriesPage.xaml
Normal file
6
BookAStar/BookAStar/Pages/QueriesPage.xaml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
x:Class="BookAStar.QueriesPage">
|
||||||
|
<Label Text="{Binding MainText}" VerticalOptions="Center" HorizontalOptions="Center" />
|
||||||
|
</ContentPage>
|
||||||
18
BookAStar/BookAStar/Pages/QueriesPage.xaml.cs
Normal file
18
BookAStar/BookAStar/Pages/QueriesPage.xaml.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
namespace BookAStar
|
||||||
|
{
|
||||||
|
public partial class QueriesPage : ContentPage
|
||||||
|
{
|
||||||
|
public QueriesPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -51,11 +51,6 @@ namespace BookAStar
|
||||||
public Dictionary<string, double> Musical { get; private set; }
|
public Dictionary<string, double> Musical { get; private set; }
|
||||||
public Dictionary<string, double> Environ { get; private set; }
|
public Dictionary<string, double> Environ { get; private set; }
|
||||||
|
|
||||||
private void PlateformSpecificInstance_IdentificationChanged(object sender, IdentificationChangedEventArgs e)
|
|
||||||
{
|
|
||||||
// Assert AccountListView.SelectedItem == e.NewIdentification;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Accounts_ItemSelected(object sender, SelectedItemChangedEventArgs e)
|
private void Accounts_ItemSelected(object sender, SelectedItemChangedEventArgs e)
|
||||||
{
|
{
|
||||||
var user = e.SelectedItem as User;
|
var user = e.SelectedItem as User;
|
||||||
32
BookAStar/BookAStar/Views/MarkdownView.cs
Normal file
32
BookAStar/BookAStar/Views/MarkdownView.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection.Emit;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
namespace BookAStar.Views
|
||||||
|
{
|
||||||
|
public partial class MarkdownView : ContentView
|
||||||
|
{
|
||||||
|
private string markdown;
|
||||||
|
|
||||||
|
public string Markdown
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return markdown;
|
||||||
|
}
|
||||||
|
set { markdown = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public MarkdownView() : base()
|
||||||
|
{
|
||||||
|
markdown = "**Hello** _world_";
|
||||||
|
Content = App.PlateformSpecificInstance.CreateMarkdownView(markdown);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Json.NET.Web" version="1.0.49" targetFramework="portable45-net45+win8+wpa81" />
|
<package id="Json.NET.Web" version="1.0.49" targetFramework="portable45-net45+win8+wpa81" />
|
||||||
|
<package id="MarkdownDeep.NET" version="1.5" targetFramework="portable45-net45+win8+wpa81" />
|
||||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="portable45-net45+win8+wpa81" />
|
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="portable45-net45+win8+wpa81" />
|
||||||
<package id="Xam.Plugins.Settings" version="2.1.0" targetFramework="portable45-net45+win8+wpa81" />
|
<package id="Xam.Plugins.Settings" version="2.1.0" targetFramework="portable45-net45+win8+wpa81" />
|
||||||
<package id="Xamarin.Forms" version="2.3.0.107" targetFramework="portable45-net45+win8+wpa81" />
|
<package id="Xamarin.Forms" version="2.3.0.107" targetFramework="portable45-net45+win8+wpa81" />
|
||||||
|
|
|
||||||
1
Yavsc.Client/MarkdownParser.y
Normal file
1
Yavsc.Client/MarkdownParser.y
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
|
||||||
|
|
@ -48,6 +48,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="app.config" />
|
<None Include="app.config" />
|
||||||
|
<None Include="MarkdownParser.y" />
|
||||||
<None Include="packages.config">
|
<None Include="packages.config">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</None>
|
</None>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue