WIP
This commit is contained in:
parent
62ec876f78
commit
9c4621fe74
49 changed files with 742 additions and 444 deletions
71
BookAStar/BookAStar.Droid/Assets/test.html
Normal file
71
BookAStar/BookAStar.Droid/Assets/test.html
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<link rel="stylesheet" href="quill.snow.css" />
|
||||||
|
<style>
|
||||||
|
.standalone-container {
|
||||||
|
margin: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
#bubble-container {
|
||||||
|
width:100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
#bubble-container div.ql-editor {
|
||||||
|
margin-top:0;
|
||||||
|
}
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Title</h1>
|
||||||
|
<div class="standalone-container">
|
||||||
|
<div id="bubble-container"><h1><strong>Hello Estimate!</strong></h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="quill.min.js"></script>
|
||||||
|
<script type="text/javascript" src="jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="showdown.js"></script>
|
||||||
|
<script type="text/javascript" src="to-markdown.js"></script>
|
||||||
|
<script type="text/javascript" src="md-helpers.js"></script>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var toolbarOptions = [
|
||||||
|
['bold', 'italic', 'underline', 'strike'], // toggled buttons
|
||||||
|
['blockquote', 'code-block'],
|
||||||
|
|
||||||
|
[{ 'header': 1 }, { 'header': 2 }], // custom button values
|
||||||
|
[{ 'list': 'ordered' }, { 'list': 'bullet' }],
|
||||||
|
[{ 'indent': '-1' }, { 'indent': '+1' }], // outdent/indent
|
||||||
|
|
||||||
|
['clean'] // remove formatting button
|
||||||
|
];
|
||||||
|
|
||||||
|
var quill = new Quill('#bubble-container', {
|
||||||
|
modules: {
|
||||||
|
toolbar: toolbarOptions
|
||||||
|
},
|
||||||
|
placeholder: 'Composez votre texte ...',
|
||||||
|
theme: 'snow'
|
||||||
|
});
|
||||||
|
|
||||||
|
function getMD() {
|
||||||
|
return markdownize($('#bubble-container div.ql-editor').html())
|
||||||
|
}
|
||||||
|
quill.on('text-change', function (delta, oldDelta, source)
|
||||||
|
{
|
||||||
|
if (source === "user") {
|
||||||
|
$.get("file:validate?md=" + encodeURIComponent(getMD()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|
@ -88,7 +88,8 @@
|
||||||
<HintPath>..\..\packages\Xam.Plugin.Media.1.0.1\lib\MonoAndroid10\Media.Plugin.Abstractions.dll</HintPath>
|
<HintPath>..\..\packages\Xam.Plugin.Media.1.0.1\lib\MonoAndroid10\Media.Plugin.Abstractions.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Mono.Android" />
|
<Reference Include="Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065, processorArchitecture=MSIL" />
|
||||||
|
<Reference Include="Mono.Android.Export, Version=1.0.6099.33544, Culture=neutral, PublicKeyToken=84e04ff9cfb79065, processorArchitecture=MSIL" />
|
||||||
<Reference Include="Mono.Data.Sqlite" />
|
<Reference Include="Mono.Data.Sqlite" />
|
||||||
<Reference Include="mscorlib" />
|
<Reference Include="mscorlib" />
|
||||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
|
|
@ -203,6 +204,7 @@
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
<DependentUpon>MarkdownEditor.cshtml</DependentUpon>
|
<DependentUpon>MarkdownEditor.cshtml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="MarkdownViewRenderer.cs" />
|
||||||
<Compile Include="MarkdownWebViewClient.cs" />
|
<Compile Include="MarkdownWebViewClient.cs" />
|
||||||
<Compile Include="OAuth2\YaOAuth2Authenticator.cs" />
|
<Compile Include="OAuth2\YaOAuth2Authenticator.cs" />
|
||||||
<Compile Include="Resources\Resource.Designer.cs" />
|
<Compile Include="Resources\Resource.Designer.cs" />
|
||||||
|
|
@ -224,6 +226,9 @@
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
<None Include="Resources\AboutResources.txt" />
|
<None Include="Resources\AboutResources.txt" />
|
||||||
<AndroidAsset Include="Assets\AboutAssets.txt" />
|
<AndroidAsset Include="Assets\AboutAssets.txt" />
|
||||||
|
<AndroidResource Include="Resources\layout\EditEstimate.axml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</AndroidResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AndroidResource Include="Resources\drawable\icon.png" />
|
<AndroidResource Include="Resources\drawable\icon.png" />
|
||||||
|
|
@ -301,6 +306,7 @@
|
||||||
<AndroidResource Include="Resources\drawable\nfqrcode.png" />
|
<AndroidResource Include="Resources\drawable\nfqrcode.png" />
|
||||||
<AndroidResource Include="Resources\drawable\visuel_sexion.jpg" />
|
<AndroidResource Include="Resources\drawable\visuel_sexion.jpg" />
|
||||||
<AndroidResource Include="Resources\values\values-21\styles.xml" />
|
<AndroidResource Include="Resources\values\values-21\styles.xml" />
|
||||||
|
<AndroidResource Include="Resources\drawable\icon-anon.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Resources\drawable-hdpi\" />
|
<Folder Include="Resources\drawable-hdpi\" />
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,8 @@ using Android.Webkit;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
using Xamarin.Forms.Platform.Android;
|
using Xamarin.Forms.Platform.Android;
|
||||||
using Android.Views;
|
using Android.Views;
|
||||||
|
using BookAStar.Helpers;
|
||||||
|
using BookAStar.Interfaces;
|
||||||
|
|
||||||
namespace BookAStar.Droid
|
namespace BookAStar.Droid
|
||||||
{
|
{
|
||||||
|
|
@ -87,11 +88,11 @@ namespace BookAStar.Droid
|
||||||
{
|
{
|
||||||
|
|
||||||
var accStore = AccountStore.Create(this);
|
var accStore = AccountStore.Create(this);
|
||||||
var accounts = accStore.FindAccountsForService(MainSettings.ApplicationName);
|
var accounts = accStore.FindAccountsForService(Constants.ApplicationName);
|
||||||
|
|
||||||
accStore.Delete(
|
accStore.Delete(
|
||||||
accounts.Where(a => a.Username == userName).FirstOrDefault()
|
accounts.Where(a => a.Username == userName).FirstOrDefault()
|
||||||
, MainSettings.ApplicationName);
|
, Constants.ApplicationName);
|
||||||
Toast.MakeText(this,
|
Toast.MakeText(this,
|
||||||
Resource.String.yavscIdentRemoved
|
Resource.String.yavscIdentRemoved
|
||||||
, ToastLength.Short);
|
, ToastLength.Short);
|
||||||
|
|
@ -160,7 +161,7 @@ namespace BookAStar.Droid
|
||||||
using (var reader = new StreamReader(response.GetResponseStream()))
|
using (var reader = new StreamReader(response.GetResponseStream()))
|
||||||
{
|
{
|
||||||
responseText = reader.ReadToEnd();
|
responseText = reader.ReadToEnd();
|
||||||
Log.Debug(MainSettings.ApplicationName, responseText);
|
Log.Debug(Constants.ApplicationName, responseText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -180,7 +181,7 @@ namespace BookAStar.Droid
|
||||||
{
|
{
|
||||||
return await Task.Run(() => {
|
return await Task.Run(() => {
|
||||||
var manager = AccountStore.Create(this);
|
var manager = AccountStore.Create(this);
|
||||||
return manager.FindAccountsForService(MainSettings.ApplicationName);
|
return manager.FindAccountsForService(Constants.ApplicationName);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
YaOAuth2Authenticator auth = new YaOAuth2Authenticator(
|
YaOAuth2Authenticator auth = new YaOAuth2Authenticator(
|
||||||
|
|
@ -215,7 +216,7 @@ namespace BookAStar.Droid
|
||||||
|
|
||||||
// get me
|
// get me
|
||||||
// var request = new OAuth2Request("GET", new Uri(Constants.UserInfoUrl), null, eventArgs.Account);
|
// var request = new OAuth2Request("GET", new Uri(Constants.UserInfoUrl), null, eventArgs.Account);
|
||||||
var request = new HttpRequestMessage(HttpMethod.Get, MainSettings.UserInfoUrl);
|
var request = new HttpRequestMessage(HttpMethod.Get, Constants.UserInfoUrl);
|
||||||
|
|
||||||
request.Headers.Authorization =
|
request.Headers.Authorization =
|
||||||
new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", tokens.AccessToken);
|
new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", tokens.AccessToken);
|
||||||
|
|
@ -244,7 +245,7 @@ namespace BookAStar.Droid
|
||||||
};
|
};
|
||||||
|
|
||||||
MainSettings.SaveUser(newuser);
|
MainSettings.SaveUser(newuser);
|
||||||
accStore.Save(acc, MainSettings.ApplicationName);
|
accStore.Save(acc, Constants.ApplicationName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -332,34 +333,6 @@ namespace BookAStar.Droid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Xamarin.Forms.View CreateMarkdownView(string markdown, Action<string> update)
|
|
||||||
{
|
|
||||||
var view = new Android.Webkit.WebView(Forms.Context);
|
|
||||||
var viewclient = new MarkdownWebViewClient(update);
|
|
||||||
view.SetWebViewClient(viewclient);
|
|
||||||
var mde = new MarkdownEditor();
|
|
||||||
if (markdown!=null)
|
|
||||||
{
|
|
||||||
var md = new MarkdownDeep.Markdown();
|
|
||||||
mde.Model = md.Transform(markdown);
|
|
||||||
}
|
|
||||||
var html = mde.GenerateString();
|
|
||||||
view.Settings.BuiltInZoomControls = true;
|
|
||||||
view.Settings.JavaScriptEnabled = true;
|
|
||||||
view.Settings.LoadsImagesAutomatically = true;
|
|
||||||
view.Settings.SetAppCacheEnabled(true);
|
|
||||||
view.Settings.AllowContentAccess = true;
|
|
||||||
view.Settings.AllowFileAccess = true;
|
|
||||||
view.Settings.AllowFileAccessFromFileURLs = true;
|
|
||||||
view.Settings.AllowUniversalAccessFromFileURLs = true;
|
|
||||||
view.Settings.BlockNetworkImage = false;
|
|
||||||
view.Settings.BlockNetworkLoads = false;
|
|
||||||
view.LoadDataWithBaseURL("file:///android_asset/",
|
|
||||||
html, "text/html", "utf-8",null);
|
|
||||||
|
|
||||||
return view.ToView();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
|
|
||||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorTemplatePreprocessor", "4.1.2.18")]
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorTemplatePreprocessor", "4.2.0.680")]
|
||||||
public partial class MarkdownEditor : MarkdownEditorBase
|
public partial class MarkdownEditor : MarkdownEditorBase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -32,32 +32,30 @@ public string Model { get; set; }
|
||||||
|
|
||||||
public override void Execute()
|
public override void Execute()
|
||||||
{
|
{
|
||||||
WriteLiteral("<!DOCTYPE html>\r\n<html>\r\n<head>\r\n \r\n <meta");
|
WriteLiteral("<!DOCTYPE html>\r\n<html>\r\n<head>\r\n <meta");
|
||||||
|
|
||||||
WriteLiteral(" charset=\"utf-8\"");
|
WriteLiteral(" charset=\"utf-8\"");
|
||||||
|
|
||||||
WriteLiteral(">\r\n\r\n <link");
|
WriteLiteral(">\r\n <link");
|
||||||
|
|
||||||
WriteLiteral(" rel=\"stylesheet\"");
|
WriteLiteral(" rel=\"stylesheet\"");
|
||||||
|
|
||||||
WriteLiteral(" href=\"quill.snow.css\"");
|
WriteLiteral(" href=\"quill.snow.css\"");
|
||||||
|
|
||||||
WriteLiteral(@" />
|
WriteLiteral(@" />
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.standalone-container {
|
.standalone-container {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#bubble-container {
|
#bubble-container {
|
||||||
|
width:100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#bubble-container div.ql-editor {
|
#bubble-container div.ql-editor {
|
||||||
margin-top:3em;
|
margin-top:3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hidden {
|
.hidden {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
@ -65,7 +63,6 @@ WriteLiteral(@" />
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div");
|
<div");
|
||||||
|
|
||||||
WriteLiteral(" class=\"standalone-container\"");
|
WriteLiteral(" class=\"standalone-container\"");
|
||||||
|
|
@ -77,31 +74,13 @@ WriteLiteral(" id=\"bubble-container\"");
|
||||||
WriteLiteral(">");
|
WriteLiteral(">");
|
||||||
|
|
||||||
|
|
||||||
#line 33 "MarkdownEditor.cshtml"
|
#line 28 "MarkdownEditor.cshtml"
|
||||||
Write(Html.Write(Model));
|
Write(Html.Write(Model));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("</div>\r\n </div>\r\n <form><input");
|
WriteLiteral("</div>\r\n </div>\r\n \r\n <script");
|
||||||
|
|
||||||
WriteLiteral(" type=\"hidden\"");
|
|
||||||
|
|
||||||
WriteLiteral(" name=\"md\"");
|
|
||||||
|
|
||||||
WriteLiteral(" id=\"md\"");
|
|
||||||
|
|
||||||
WriteLiteral(" />\r\n <input");
|
|
||||||
|
|
||||||
WriteLiteral(" id=\"btnSubmit\"");
|
|
||||||
|
|
||||||
WriteLiteral(" type=\"button\"");
|
|
||||||
|
|
||||||
WriteLiteral(" value=\"Valider\"");
|
|
||||||
|
|
||||||
WriteLiteral(" class=\"hidden\"");
|
|
||||||
|
|
||||||
WriteLiteral(" /></form>\r\n <script");
|
|
||||||
|
|
||||||
WriteLiteral(" type=\"text/javascript\"");
|
WriteLiteral(" type=\"text/javascript\"");
|
||||||
|
|
||||||
|
|
@ -143,7 +122,7 @@ WriteLiteral(@">
|
||||||
[{ 'header': 1 }, { 'header': 2 }], // custom button values
|
[{ 'header': 1 }, { 'header': 2 }], // custom button values
|
||||||
[{ 'list': 'ordered' }, { 'list': 'bullet' }],
|
[{ 'list': 'ordered' }, { 'list': 'bullet' }],
|
||||||
[{ 'indent': '-1' }, { 'indent': '+1' }], // outdent/indent
|
[{ 'indent': '-1' }, { 'indent': '+1' }], // outdent/indent
|
||||||
|
['link', 'image'],
|
||||||
['clean'] // remove formatting button
|
['clean'] // remove formatting button
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -151,26 +130,19 @@ WriteLiteral(@">
|
||||||
modules: {
|
modules: {
|
||||||
toolbar: toolbarOptions
|
toolbar: toolbarOptions
|
||||||
},
|
},
|
||||||
placeholder: 'Composez votre texte ...',
|
placeholder: 'Composez votre texte ...',
|
||||||
theme: 'snow'
|
theme: 'snow'
|
||||||
});
|
});
|
||||||
|
|
||||||
function getMD() {
|
function getMD() {
|
||||||
return markdownize($('#bubble-container div.ql-editor').html())
|
return markdownize($('#bubble-container div.ql-editor').html())
|
||||||
}
|
|
||||||
quill.on('text-change', function (delta, oldDelta, source)
|
|
||||||
{
|
|
||||||
if (source === ""user"") {
|
|
||||||
$('#md').val(getMD());
|
|
||||||
$('#btnSubmit').removeClass('hidden');
|
|
||||||
}
|
}
|
||||||
});
|
quill.on('text-change', function (delta, oldDelta, source)
|
||||||
$(document).ready(function () {
|
{
|
||||||
$('#btnSubmit').on('click', function () {
|
if (source === ""user"") {
|
||||||
$.get(""file:validate?md="" + encodeURIComponent(getMD()),
|
invokeCSharpAction(getMD());
|
||||||
function (data, stat, jqXHR) { $('#result').html(""Okay"") })
|
}
|
||||||
})
|
});
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -2,25 +2,21 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
|
||||||
<link rel="stylesheet" href="quill.snow.css" />
|
<link rel="stylesheet" href="quill.snow.css" />
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.standalone-container {
|
.standalone-container {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#bubble-container {
|
#bubble-container {
|
||||||
|
width:100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#bubble-container div.ql-editor {
|
#bubble-container div.ql-editor {
|
||||||
margin-top:3em;
|
margin-top:3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hidden {
|
.hidden {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
@ -28,12 +24,10 @@
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="standalone-container">
|
<div class="standalone-container">
|
||||||
<div id="bubble-container">@Html.Write(Model)</div>
|
<div id="bubble-container">@Html.Write(Model)</div>
|
||||||
</div>
|
</div>
|
||||||
<form><input type="hidden" name="md" id="md" />
|
|
||||||
<input id="btnSubmit" type="button" value="Valider" class="hidden" /></form>
|
|
||||||
<script type="text/javascript" src="quill.min.js"></script>
|
<script type="text/javascript" src="quill.min.js"></script>
|
||||||
<script type="text/javascript" src="jquery.js"></script>
|
<script type="text/javascript" src="jquery.js"></script>
|
||||||
<script type="text/javascript" src="showdown.js"></script>
|
<script type="text/javascript" src="showdown.js"></script>
|
||||||
|
|
@ -48,7 +42,7 @@
|
||||||
[{ 'header': 1 }, { 'header': 2 }], // custom button values
|
[{ 'header': 1 }, { 'header': 2 }], // custom button values
|
||||||
[{ 'list': 'ordered' }, { 'list': 'bullet' }],
|
[{ 'list': 'ordered' }, { 'list': 'bullet' }],
|
||||||
[{ 'indent': '-1' }, { 'indent': '+1' }], // outdent/indent
|
[{ 'indent': '-1' }, { 'indent': '+1' }], // outdent/indent
|
||||||
|
['link', 'image'],
|
||||||
['clean'] // remove formatting button
|
['clean'] // remove formatting button
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -56,26 +50,19 @@
|
||||||
modules: {
|
modules: {
|
||||||
toolbar: toolbarOptions
|
toolbar: toolbarOptions
|
||||||
},
|
},
|
||||||
placeholder: 'Composez votre texte ...',
|
placeholder: 'Composez votre texte ...',
|
||||||
theme: 'snow'
|
theme: 'snow'
|
||||||
});
|
});
|
||||||
|
|
||||||
function getMD() {
|
function getMD() {
|
||||||
return markdownize($('#bubble-container div.ql-editor').html())
|
return markdownize($('#bubble-container div.ql-editor').html())
|
||||||
}
|
|
||||||
quill.on('text-change', function (delta, oldDelta, source)
|
|
||||||
{
|
|
||||||
if (source === "user") {
|
|
||||||
$('#md').val(getMD());
|
|
||||||
$('#btnSubmit').removeClass('hidden');
|
|
||||||
}
|
}
|
||||||
});
|
quill.on('text-change', function (delta, oldDelta, source)
|
||||||
$(document).ready(function () {
|
{
|
||||||
$('#btnSubmit').on('click', function () {
|
if (source === "user") {
|
||||||
$.get("file:validate?md=" + encodeURIComponent(getMD()),
|
invokeCSharpAction(getMD());
|
||||||
function (data, stat, jqXHR) { $('#result').html("Okay") })
|
}
|
||||||
})
|
});
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
94
BookAStar/BookAStar.Droid/MarkdownViewRenderer.cs
Normal file
94
BookAStar/BookAStar.Droid/MarkdownViewRenderer.cs
Normal file
|
|
@ -0,0 +1,94 @@
|
||||||
|
|
||||||
|
using BookAStar.Views;
|
||||||
|
using Android.Webkit;
|
||||||
|
using Xamarin.Forms.Platform.Android;
|
||||||
|
using BookAStar.Droid;
|
||||||
|
using System;
|
||||||
|
using Java.Interop;
|
||||||
|
|
||||||
|
[assembly: Xamarin.Forms.ExportRenderer(typeof(MarkdownView), typeof(MarkdownViewRenderer))]
|
||||||
|
namespace BookAStar.Droid
|
||||||
|
{
|
||||||
|
public class JSBridge : Java.Lang.Object
|
||||||
|
{
|
||||||
|
readonly WeakReference<MarkdownViewRenderer> hybridWebViewRenderer;
|
||||||
|
|
||||||
|
public JSBridge(MarkdownViewRenderer hybridRenderer)
|
||||||
|
{
|
||||||
|
hybridWebViewRenderer = new WeakReference<MarkdownViewRenderer>(hybridRenderer);
|
||||||
|
}
|
||||||
|
|
||||||
|
[JavascriptInterface]
|
||||||
|
[Export("invokeAction")]
|
||||||
|
public void InvokeAction(string data)
|
||||||
|
{
|
||||||
|
MarkdownViewRenderer hybridRenderer;
|
||||||
|
|
||||||
|
if (hybridWebViewRenderer != null && hybridWebViewRenderer.TryGetTarget(out hybridRenderer))
|
||||||
|
{
|
||||||
|
hybridRenderer.Element.Markdown=data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class MarkdownViewRenderer : ViewRenderer<MarkdownView, WebView>
|
||||||
|
{
|
||||||
|
private WebView editorView;
|
||||||
|
private MarkdownEditor editorTemplate = new MarkdownEditor();
|
||||||
|
private MarkdownDeep.Markdown markdown = new MarkdownDeep.Markdown();
|
||||||
|
const string JavaScriptFunction = "function invokeCSharpAction(data){jsBridge.invokeAction(data);}";
|
||||||
|
|
||||||
|
private void SetMDEditorText(string text)
|
||||||
|
{
|
||||||
|
editorTemplate.Model = (text == null) ? null : markdown.Transform(text);
|
||||||
|
var html = editorTemplate.GenerateString();
|
||||||
|
editorView.LoadDataWithBaseURL("file:///android_asset/",
|
||||||
|
html, "text/html", "utf-8", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnElementChanged(ElementChangedEventArgs<MarkdownView> e)
|
||||||
|
{
|
||||||
|
base.OnElementChanged(e);
|
||||||
|
if (Control == null)
|
||||||
|
{
|
||||||
|
editorView = new WebView(Context);
|
||||||
|
editorView.Settings.BuiltInZoomControls = true;
|
||||||
|
editorView.Settings.JavaScriptEnabled = true;
|
||||||
|
editorView.Settings.LoadsImagesAutomatically = true;
|
||||||
|
editorView.Settings.SetAppCacheEnabled(true);
|
||||||
|
editorView.Settings.AllowContentAccess = true;
|
||||||
|
editorView.Settings.AllowFileAccess = true;
|
||||||
|
editorView.Settings.AllowFileAccessFromFileURLs = true;
|
||||||
|
editorView.Settings.AllowUniversalAccessFromFileURLs = true;
|
||||||
|
editorView.Settings.BlockNetworkImage = false;
|
||||||
|
editorView.Settings.BlockNetworkLoads = false;
|
||||||
|
editorView.Settings.DomStorageEnabled = true;
|
||||||
|
// editorView.SetMinimumHeight(300);
|
||||||
|
SetNativeControl(editorView);
|
||||||
|
}
|
||||||
|
if (e.OldElement != null)
|
||||||
|
{
|
||||||
|
// Unsubscribe
|
||||||
|
}
|
||||||
|
if (e.NewElement != null)
|
||||||
|
{
|
||||||
|
// Subscribe
|
||||||
|
var viewclient = new MarkdownWebViewClient(
|
||||||
|
md => { e.NewElement.Markdown = md; });
|
||||||
|
editorView.SetWebViewClient(viewclient);
|
||||||
|
Control.AddJavascriptInterface(new JSBridge(this), "jsBridge");
|
||||||
|
SetMDEditorText(e.NewElement.Markdown);
|
||||||
|
InjectJS(JavaScriptFunction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void InjectJS(string script)
|
||||||
|
{
|
||||||
|
if (Control != null)
|
||||||
|
{
|
||||||
|
Control.LoadUrl(string.Format("javascript: {0}", script));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -16,6 +16,7 @@ using Android.Content.Res;
|
||||||
|
|
||||||
namespace BookAStar.Droid
|
namespace BookAStar.Droid
|
||||||
{
|
{
|
||||||
|
|
||||||
class MarkdownWebViewClient : WebViewClient
|
class MarkdownWebViewClient : WebViewClient
|
||||||
{
|
{
|
||||||
Action<string> update;
|
Action<string> update;
|
||||||
|
|
@ -25,7 +26,7 @@ namespace BookAStar.Droid
|
||||||
}
|
}
|
||||||
private static Activity getActivity ()
|
private static Activity getActivity ()
|
||||||
{
|
{
|
||||||
return (Activity)App.PlateformSpecificInstance;
|
return (Activity)App.PlatformSpecificInstance;
|
||||||
}
|
}
|
||||||
public string Markdown { get; private set; }
|
public string Markdown { get; private set; }
|
||||||
public override WebResourceResponse ShouldInterceptRequest(WebView view, IWebResourceRequest request)
|
public override WebResourceResponse ShouldInterceptRequest(WebView view, IWebResourceRequest request)
|
||||||
|
|
@ -34,6 +35,8 @@ namespace BookAStar.Droid
|
||||||
{
|
{
|
||||||
if (request.Url.Path=="/android_asset/validate")
|
if (request.Url.Path=="/android_asset/validate")
|
||||||
{
|
{
|
||||||
|
// TODO Better,
|
||||||
|
// by inspecting the form entries from the view
|
||||||
Markdown = request.Url.GetQueryParameter("md");
|
Markdown = request.Url.GetQueryParameter("md");
|
||||||
update(Markdown);
|
update(Markdown);
|
||||||
return new WebResourceResponse("application/json", "utf-8" ,200, "Ok", null, null);
|
return new WebResourceResponse("application/json", "utf-8" ,200, "Ok", null, null);
|
||||||
|
|
@ -41,5 +44,6 @@ namespace BookAStar.Droid
|
||||||
}
|
}
|
||||||
return base.ShouldInterceptRequest(view, request);
|
return base.ShouldInterceptRequest(view, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -13,7 +13,7 @@ using Android.App;
|
||||||
[assembly: AssemblyProduct("BookAStar.Droid")]
|
[assembly: AssemblyProduct("BookAStar.Droid")]
|
||||||
[assembly: AssemblyCopyright("Copyright © Paul Albert Schneider 2016")]
|
[assembly: AssemblyCopyright("Copyright © Paul Albert Schneider 2016")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("fr")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
// Version information for an assembly consists of the following four values:
|
||||||
|
|
|
||||||
|
|
@ -3232,64 +3232,67 @@ namespace BookAStar.Droid
|
||||||
public const int design_navigation_menu_item = 2130903076;
|
public const int design_navigation_menu_item = 2130903076;
|
||||||
|
|
||||||
// aapt resource value: 0x7f030025
|
// aapt resource value: 0x7f030025
|
||||||
public const int mr_chooser_dialog = 2130903077;
|
public const int EditEstimate = 2130903077;
|
||||||
|
|
||||||
// aapt resource value: 0x7f030026
|
// aapt resource value: 0x7f030026
|
||||||
public const int mr_chooser_list_item = 2130903078;
|
public const int mr_chooser_dialog = 2130903078;
|
||||||
|
|
||||||
// aapt resource value: 0x7f030027
|
// aapt resource value: 0x7f030027
|
||||||
public const int mr_controller_material_dialog_b = 2130903079;
|
public const int mr_chooser_list_item = 2130903079;
|
||||||
|
|
||||||
// aapt resource value: 0x7f030028
|
// aapt resource value: 0x7f030028
|
||||||
public const int mr_controller_volume_item = 2130903080;
|
public const int mr_controller_material_dialog_b = 2130903080;
|
||||||
|
|
||||||
// aapt resource value: 0x7f030029
|
// aapt resource value: 0x7f030029
|
||||||
public const int mr_playback_control = 2130903081;
|
public const int mr_controller_volume_item = 2130903081;
|
||||||
|
|
||||||
// aapt resource value: 0x7f03002a
|
// aapt resource value: 0x7f03002a
|
||||||
public const int mr_volume_control = 2130903082;
|
public const int mr_playback_control = 2130903082;
|
||||||
|
|
||||||
// aapt resource value: 0x7f03002b
|
// aapt resource value: 0x7f03002b
|
||||||
public const int notification_media_action = 2130903083;
|
public const int mr_volume_control = 2130903083;
|
||||||
|
|
||||||
// aapt resource value: 0x7f03002c
|
// aapt resource value: 0x7f03002c
|
||||||
public const int notification_media_cancel_action = 2130903084;
|
public const int notification_media_action = 2130903084;
|
||||||
|
|
||||||
// aapt resource value: 0x7f03002d
|
// aapt resource value: 0x7f03002d
|
||||||
public const int notification_template_big_media = 2130903085;
|
public const int notification_media_cancel_action = 2130903085;
|
||||||
|
|
||||||
// aapt resource value: 0x7f03002e
|
// aapt resource value: 0x7f03002e
|
||||||
public const int notification_template_big_media_narrow = 2130903086;
|
public const int notification_template_big_media = 2130903086;
|
||||||
|
|
||||||
// aapt resource value: 0x7f03002f
|
// aapt resource value: 0x7f03002f
|
||||||
public const int notification_template_lines = 2130903087;
|
public const int notification_template_big_media_narrow = 2130903087;
|
||||||
|
|
||||||
// aapt resource value: 0x7f030030
|
// aapt resource value: 0x7f030030
|
||||||
public const int notification_template_media = 2130903088;
|
public const int notification_template_lines = 2130903088;
|
||||||
|
|
||||||
// aapt resource value: 0x7f030031
|
// aapt resource value: 0x7f030031
|
||||||
public const int notification_template_part_chronometer = 2130903089;
|
public const int notification_template_media = 2130903089;
|
||||||
|
|
||||||
// aapt resource value: 0x7f030032
|
// aapt resource value: 0x7f030032
|
||||||
public const int notification_template_part_time = 2130903090;
|
public const int notification_template_part_chronometer = 2130903090;
|
||||||
|
|
||||||
// aapt resource value: 0x7f030033
|
// aapt resource value: 0x7f030033
|
||||||
public const int select_dialog_item_material = 2130903091;
|
public const int notification_template_part_time = 2130903091;
|
||||||
|
|
||||||
// aapt resource value: 0x7f030034
|
// aapt resource value: 0x7f030034
|
||||||
public const int select_dialog_multichoice_material = 2130903092;
|
public const int select_dialog_item_material = 2130903092;
|
||||||
|
|
||||||
// aapt resource value: 0x7f030035
|
// aapt resource value: 0x7f030035
|
||||||
public const int select_dialog_singlechoice_material = 2130903093;
|
public const int select_dialog_multichoice_material = 2130903093;
|
||||||
|
|
||||||
// aapt resource value: 0x7f030036
|
// aapt resource value: 0x7f030036
|
||||||
public const int support_simple_spinner_dropdown_item = 2130903094;
|
public const int select_dialog_singlechoice_material = 2130903094;
|
||||||
|
|
||||||
// aapt resource value: 0x7f030037
|
// aapt resource value: 0x7f030037
|
||||||
public const int Tabbar = 2130903095;
|
public const int support_simple_spinner_dropdown_item = 2130903095;
|
||||||
|
|
||||||
// aapt resource value: 0x7f030038
|
// aapt resource value: 0x7f030038
|
||||||
public const int Toolbar = 2130903096;
|
public const int Tabbar = 2130903096;
|
||||||
|
|
||||||
|
// aapt resource value: 0x7f030039
|
||||||
|
public const int Toolbar = 2130903097;
|
||||||
|
|
||||||
static Layout()
|
static Layout()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
BIN
BookAStar/BookAStar.Droid/Resources/drawable/Icon-anon-48px.png
Normal file
BIN
BookAStar/BookAStar.Droid/Resources/drawable/Icon-anon-48px.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
BIN
BookAStar/BookAStar.Droid/Resources/drawable/Icon-anon-64px.png
Normal file
BIN
BookAStar/BookAStar.Droid/Resources/drawable/Icon-anon-64px.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
BIN
BookAStar/BookAStar.Droid/Resources/drawable/Icon-anon-73px.png
Normal file
BIN
BookAStar/BookAStar.Droid/Resources/drawable/Icon-anon-73px.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
BIN
BookAStar/BookAStar.Droid/Resources/drawable/Icon-anon-org.png
Normal file
BIN
BookAStar/BookAStar.Droid/Resources/drawable/Icon-anon-org.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
BIN
BookAStar/BookAStar.Droid/Resources/drawable/icon-anon.png
Normal file
BIN
BookAStar/BookAStar.Droid/Resources/drawable/icon-anon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1 KiB |
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
@ -5,25 +5,33 @@
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<OnPlatform x:TypeArguments="Font" Android="Large" iOS="Large" WinPhone="Large" x:Key="HeaderFont" />
|
<OnPlatform x:TypeArguments="Font" Android="Large" iOS="Large" WinPhone="Large" x:Key="HeaderFont" />
|
||||||
<OnPlatform x:TypeArguments="Color" Android="White" iOS="White" WinPhone="White" x:Key="PrimaryTextColor" />
|
<OnPlatform x:TypeArguments="Color" Android="Black" iOS="Black" WinPhone="Black" x:Key="PrimaryTextColor" />
|
||||||
|
<OnPlatform x:TypeArguments="Color" Android="Red" iOS="Red" WinPhone="Red" x:Key="EmphasisTextColor" />
|
||||||
<OnPlatform x:TypeArguments="Font" Android="40" iOS="60" WinPhone="60" x:Key="LargeFontSize" />
|
<OnPlatform x:TypeArguments="Font" Android="40" iOS="60" WinPhone="60" x:Key="LargeFontSize" />
|
||||||
<OnPlatform x:TypeArguments="Font" Android="30" iOS="60" WinPhone="60" x:Key="MediumFontSize" />
|
<OnPlatform x:TypeArguments="Font" Android="30" iOS="60" WinPhone="60" x:Key="MediumFontSize" />
|
||||||
|
|
||||||
<Color x:key="backgroundColor">#30FAFAFA</Color>
|
<Color x:key="backgroundColor">#30FAFAFA</Color>
|
||||||
|
<Color x:key="oddColor">#207AFAFA</Color>
|
||||||
<Color x:key="textColor">#FF103010</Color>
|
<Color x:key="textColor">#FF103010</Color>
|
||||||
<Color x:key="labelColor">#FF303010</Color>
|
<Color x:key="labelColor">#FF303010</Color>
|
||||||
<Style x:Key="labelStyle" TargetType="Label">
|
<Style x:Key="BigEntry" TargetType="Entry">
|
||||||
<Setter Property="TextColor" Value="{DynamicResource labelColor}" />
|
<Setter Property="FontSize" Value="{DynamicResource LargeFontSize}" />
|
||||||
<Setter Property="FontAttributes" Value="Bold" />
|
<Setter Property="FontAttributes" Value="Bold" />
|
||||||
<Setter Property="FontSize" Value="Large" />
|
</Style>
|
||||||
|
<Style x:Key="labelStyle" TargetType="Label">
|
||||||
|
<Setter Property="TextColor" Value="{DynamicResource EmphasisTextColor}" />
|
||||||
|
<Setter Property="FontAttributes" Value="Bold" />
|
||||||
|
<Setter Property="FontSize" Value="{DynamicResource LargeFontSize}" />
|
||||||
<Setter Property="VerticalOptions" Value="Start" />
|
<Setter Property="VerticalOptions" Value="Start" />
|
||||||
<Setter Property="XAlign" Value="Center" />
|
<Setter Property="LineBreakMode" Value="WordWrap" />
|
||||||
|
|
||||||
</Style>
|
</Style>
|
||||||
<Style x:Key="entryStyle" TargetType="Entry">
|
<Style x:Key="entryStyle" TargetType="Entry">
|
||||||
<Setter Property="HorizontalOptions" Value="FillAndExpand"/>
|
<Setter Property="HorizontalOptions" Value="FillAndExpand"/>
|
||||||
</Style>
|
</Style>
|
||||||
<Style x:key="backbroundStyle" TargetType="VisualElement">
|
<Style x:key="backbroundStyle" TargetType="VisualElement">
|
||||||
<Setter Property="BackgoundColor" Value="{DynamicResource backgroundColor}" />
|
<Setter Property="BackgoundColor" Value="{StaticResource backgroundColor}" />
|
||||||
|
<Setter Property="TextColor" Value="{StaticResource textColor}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style x:Key="buttonStyle" TargetType="Button">
|
<Style x:Key="buttonStyle" TargetType="Button">
|
||||||
<Setter Property="HorizontalOptions" Value="Center" />
|
<Setter Property="HorizontalOptions" Value="Center" />
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,11 @@
|
||||||
using BookAStar.Model;
|
using BookAStar.Helpers;
|
||||||
using BookAStar.Model.Auth.Account;
|
using BookAStar.Interfaces;
|
||||||
|
using BookAStar.Model;
|
||||||
|
using BookAStar.Model.Workflow;
|
||||||
using BookAStar.Pages;
|
using BookAStar.Pages;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Collections.Generic;
|
||||||
using System.Net;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Net.Http.Headers;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
using Xamarin.Forms.Xaml;
|
|
||||||
/*
|
/*
|
||||||
Glyphish icons from
|
Glyphish icons from
|
||||||
http://www.glyphish.com/
|
http://www.glyphish.com/
|
||||||
|
|
@ -22,41 +18,47 @@ namespace BookAStar
|
||||||
{
|
{
|
||||||
public partial class App : Application // superclass new in 1.3
|
public partial class App : Application // superclass new in 1.3
|
||||||
{
|
{
|
||||||
SearchPage searchPage;
|
|
||||||
NavigationPage mp;
|
|
||||||
SettingsPage settingsPage;
|
|
||||||
PinPage pinPage;
|
|
||||||
ContentPage deviceInfoPage;
|
ContentPage deviceInfoPage;
|
||||||
BookQueryPage bookQueryPage;
|
SearchPage searchPage = new SearchPage
|
||||||
BookQueriesPage bookQueriesPage;
|
{
|
||||||
public static IPlatform PlateformSpecificInstance { get; set; }
|
Title = "Trouvez votre artiste",
|
||||||
|
Icon = "glyphish_07_map_marker.png"
|
||||||
|
};
|
||||||
|
NavigationPage mp;
|
||||||
|
SettingsPage settingsPage = new SettingsPage
|
||||||
|
{
|
||||||
|
Title = "Paramètres",
|
||||||
|
Icon = "ic_corp_icon.png"
|
||||||
|
};
|
||||||
|
PinPage pinPage = new PinPage
|
||||||
|
{
|
||||||
|
Title = "Carte",
|
||||||
|
Icon = "glyphish_07_map_marker.png"
|
||||||
|
};
|
||||||
|
BookQueryPage bookQueryPage = new BookQueryPage {
|
||||||
|
Title = "Demande de devis"
|
||||||
|
};
|
||||||
|
BookQueriesPage bookQueriesPage = new BookQueriesPage
|
||||||
|
{
|
||||||
|
Title = "Demandes de devis"
|
||||||
|
};
|
||||||
|
|
||||||
|
EditEstimatePage editEstimate = new EditEstimatePage
|
||||||
|
{
|
||||||
|
Title = "Création d'un devis"
|
||||||
|
};
|
||||||
|
public static IPlatform PlatformSpecificInstance { 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 DataManager DataManager { get; set; } = new DataManager();
|
||||||
|
|
||||||
public App(IPlatform instance)
|
public App(IPlatform instance)
|
||||||
{
|
{
|
||||||
DataManager = new DataManager();
|
|
||||||
deviceInfoPage = new DeviceInfoPage(instance.GetDeviceInfo());
|
deviceInfoPage = new DeviceInfoPage(instance.GetDeviceInfo());
|
||||||
bookQueriesPage = new BookQueriesPage();
|
PlatformSpecificInstance = instance;
|
||||||
|
|
||||||
PlateformSpecificInstance = instance;
|
|
||||||
searchPage = new SearchPage
|
|
||||||
{
|
|
||||||
Title = "Trouvez votre artiste",
|
|
||||||
Icon = "glyphish_07_map_marker.png"
|
|
||||||
};
|
|
||||||
mp = new NavigationPage(searchPage);
|
mp = new NavigationPage(searchPage);
|
||||||
settingsPage = new SettingsPage
|
|
||||||
{
|
|
||||||
Title = "Settings",
|
|
||||||
Icon = "ic_corp_icon.png"
|
|
||||||
};
|
|
||||||
|
|
||||||
var r = this.Resources;
|
|
||||||
//var hasLabelStyle = r.ContainsKey("labelStyle");
|
//var hasLabelStyle = r.ContainsKey("labelStyle");
|
||||||
|
|
||||||
// var stid = this.StyleId;
|
// var stid = this.StyleId;
|
||||||
// null var appsstyle = settingsPage.Style;
|
// null var appsstyle = settingsPage.Style;
|
||||||
// appsstyle.CanCascade = true;
|
// appsstyle.CanCascade = true;
|
||||||
|
|
@ -69,24 +71,16 @@ namespace BookAStar
|
||||||
mp.ToolbarItems.Add(tiSetts);
|
mp.ToolbarItems.Add(tiSetts);
|
||||||
tiSetts.Clicked += (object sender, EventArgs e) =>
|
tiSetts.Clicked += (object sender, EventArgs e) =>
|
||||||
{
|
{
|
||||||
if (settingsPage.Parent == null)
|
ShowPage (settingsPage);
|
||||||
mp.Navigation.PushAsync(settingsPage);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
settingsPage.Focus();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
ToolbarItem tiQueries = new ToolbarItem
|
ToolbarItem tiQueries = new ToolbarItem
|
||||||
{
|
{
|
||||||
Text = "Demandes"
|
Text = "Demandes"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
tiQueries.Clicked += (object sender, EventArgs e) =>
|
tiQueries.Clicked += (object sender, EventArgs e) =>
|
||||||
{
|
{
|
||||||
if (bookQueriesPage.Parent == null)
|
ShowPage (bookQueriesPage);
|
||||||
mp.Navigation.PushAsync(bookQueriesPage);
|
|
||||||
else bookQueriesPage.Focus();
|
|
||||||
};
|
};
|
||||||
mp.ToolbarItems.Add(tiQueries);
|
mp.ToolbarItems.Add(tiQueries);
|
||||||
ToolbarItem tiMap = new ToolbarItem
|
ToolbarItem tiMap = new ToolbarItem
|
||||||
|
|
@ -95,41 +89,46 @@ namespace BookAStar
|
||||||
Icon = "glyphish_07_map_marker.png"
|
Icon = "glyphish_07_map_marker.png"
|
||||||
};
|
};
|
||||||
mp.ToolbarItems.Add(tiMap);
|
mp.ToolbarItems.Add(tiMap);
|
||||||
pinPage = new PinPage
|
|
||||||
{
|
|
||||||
Title = "Carte",
|
|
||||||
Icon = "glyphish_07_map_marker.png"
|
|
||||||
};
|
|
||||||
tiMap.Clicked += (object sender, EventArgs e) =>
|
tiMap.Clicked += (object sender, EventArgs e) =>
|
||||||
{
|
{
|
||||||
if (pinPage.Parent == null)
|
ShowPage(pinPage);
|
||||||
mp.Navigation.PushAsync(pinPage);
|
|
||||||
else pinPage.Focus();
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bookQueriesPage.BindingContext = DataManager.BookQueries;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowDeviceInfo()
|
public void ShowDeviceInfo()
|
||||||
{
|
{
|
||||||
if (deviceInfoPage.Parent == null)
|
ShowPage(deviceInfoPage);
|
||||||
mp.Navigation.PushAsync(deviceInfoPage);
|
|
||||||
else deviceInfoPage.Focus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostDeviceInfo()
|
public void PostDeviceInfo()
|
||||||
{
|
{
|
||||||
var res = PlateformSpecificInstance.InvokeApi(
|
var res = PlatformSpecificInstance.InvokeApi(
|
||||||
"gcm/register",
|
"gcm/register",
|
||||||
PlateformSpecificInstance.GetDeviceInfo());
|
PlatformSpecificInstance.GetDeviceInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowBookQuery(BookQueryData data)
|
public void ShowBookQuery(BookQueryData data)
|
||||||
{
|
{
|
||||||
bookQueriesPage.BindingContext = data;
|
bookQueryPage.BindingContext = data;
|
||||||
mp.Navigation.PushAsync(bookQueriesPage);
|
ShowPage(bookQueryPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void EditEstimate(Estimate data)
|
||||||
|
{
|
||||||
|
editEstimate.Estimate = data;
|
||||||
|
ShowPage(editEstimate);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowPage(Page p)
|
||||||
|
{
|
||||||
|
if (p.Parent == null)
|
||||||
|
mp.Navigation.PushAsync(p);
|
||||||
|
else p.Focus();
|
||||||
|
}
|
||||||
public void CloseWindow()
|
public void CloseWindow()
|
||||||
{
|
{
|
||||||
mp.Navigation.PopAsync();
|
mp.Navigation.PopAsync();
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,12 @@
|
||||||
<Compile Include="App.xaml.cs">
|
<Compile Include="App.xaml.cs">
|
||||||
<DependentUpon>App.xaml</DependentUpon>
|
<DependentUpon>App.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="DataManager.cs" />
|
<Compile Include="Constants.cs" />
|
||||||
|
<Compile Include="Helpers\AvatarImageSource.cs" />
|
||||||
|
<Compile Include="Helpers\DataManager.cs" />
|
||||||
<Compile Include="Helpers\RemoteEntityRO.cs" />
|
<Compile Include="Helpers\RemoteEntityRO.cs" />
|
||||||
|
<Compile Include="Interfaces\IMDEditor.cs" />
|
||||||
|
<Compile Include="Model\ClientProviderInfo.cs" />
|
||||||
<Compile Include="Pages\BlogPage.cs" />
|
<Compile Include="Pages\BlogPage.cs" />
|
||||||
<Compile Include="Pages\BookQueriesPage.xaml.cs">
|
<Compile Include="Pages\BookQueriesPage.xaml.cs">
|
||||||
<DependentUpon>BookQueriesPage.xaml</DependentUpon>
|
<DependentUpon>BookQueriesPage.xaml</DependentUpon>
|
||||||
|
|
@ -53,7 +57,7 @@
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Helpers\MainSettings.cs" />
|
<Compile Include="Helpers\MainSettings.cs" />
|
||||||
<Compile Include="Helpers\RemoteEntity.cs" />
|
<Compile Include="Helpers\RemoteEntity.cs" />
|
||||||
<Compile Include="IPlatform.cs" />
|
<Compile Include="Interfaces\IPlatform.cs" />
|
||||||
<Compile Include="Pages\MainPage.xaml.cs">
|
<Compile Include="Pages\MainPage.xaml.cs">
|
||||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
@ -96,8 +100,8 @@
|
||||||
<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="Model\Workflow\Estimate.cs" />
|
<Compile Include="Model\Workflow\Estimate.cs" />
|
||||||
<Compile Include="Pages\MakeAnEstimatePage.xaml.cs">
|
<Compile Include="Pages\EditEstimatePage.xaml.cs">
|
||||||
<DependentUpon>MakeAnEstimatePage.xaml</DependentUpon>
|
<DependentUpon>EditEstimatePage.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Pages\MarkdownEditorPage.xaml.cs">
|
<Compile Include="Pages\MarkdownEditorPage.xaml.cs">
|
||||||
<DependentUpon>MarkdownEditorPage.xaml</DependentUpon>
|
<DependentUpon>MarkdownEditorPage.xaml</DependentUpon>
|
||||||
|
|
@ -105,9 +109,6 @@
|
||||||
<Compile Include="Pages\PinPage.cs" />
|
<Compile Include="Pages\PinPage.cs" />
|
||||||
<Compile Include="Views\MarkdownView.cs" />
|
<Compile Include="Views\MarkdownView.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Pages\QueriesPage.xaml.cs">
|
|
||||||
<DependentUpon>QueriesPage.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Pages\SearchPage.xaml.cs">
|
<Compile Include="Pages\SearchPage.xaml.cs">
|
||||||
<DependentUpon>SearchPage.xaml</DependentUpon>
|
<DependentUpon>SearchPage.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
@ -198,12 +199,6 @@
|
||||||
<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>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="Pages\MarkdownEditorPage.xaml">
|
<EmbeddedResource Include="Pages\MarkdownEditorPage.xaml">
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
|
|
@ -211,7 +206,7 @@
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="Pages\MakeAnEstimatePage.xaml">
|
<EmbeddedResource Include="Pages\EditEstimatePage.xaml">
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
|
@ -222,6 +217,9 @@
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="icon-anon.png" />
|
||||||
|
</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">
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,44 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace BookAStar
|
namespace BookAStar
|
||||||
{
|
{
|
||||||
public static class Constants
|
public static class Constants
|
||||||
{
|
{
|
||||||
public const string ApplicationName = "Booking Star";
|
public const string ApplicationName = "Booking Star";
|
||||||
public const string UserInfoUrl = "http://dev.pschneider.fr/api/me";
|
|
||||||
|
#region Uri
|
||||||
|
|
||||||
|
public const string YavscHomeUrl = "http://dev.pschneider.fr";
|
||||||
|
public static readonly string YavscApiUrl = YavscHomeUrl + "/api";
|
||||||
|
public static readonly string MobileRegistrationUrl = YavscApiUrl + "/gcm/register";
|
||||||
|
public static readonly string UserInfoUrl = YavscApiUrl + "/me";
|
||||||
|
public static readonly string BlogUrl = YavscApiUrl + "/blogs";
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Colors & sizes
|
||||||
|
|
||||||
|
public static readonly Thickness PagePadding =
|
||||||
|
new Thickness(5, Device.OnPlatform(20, 20, 20), 5, 5);
|
||||||
|
|
||||||
|
public static readonly Thickness DefaultPadding =
|
||||||
|
new Thickness(5, Device.OnPlatform(20, 20, 20), 3, 3);
|
||||||
|
|
||||||
|
public static readonly Font TitleFont =
|
||||||
|
Font.SystemFontOfSize(Device.OnPlatform(50, 50, 50), FontAttributes.Bold);
|
||||||
|
|
||||||
|
public static readonly Color OddBackgroundColor =
|
||||||
|
Device.OnPlatform(Color.Aqua, Color.Aqua, Color.Aqua);
|
||||||
|
|
||||||
|
public static readonly Color ForegroundColor =
|
||||||
|
Device.OnPlatform(Color.White, Color.White, Color.White);
|
||||||
|
|
||||||
|
public static readonly Color BackgroundColor =
|
||||||
|
Device.OnPlatform(Color.Black, Color.White, Color.White);
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
28
BookAStar/BookAStar/Helpers/AvatarImageSource.cs
Normal file
28
BookAStar/BookAStar/Helpers/AvatarImageSource.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
using Xamarin.Forms.Xaml;
|
||||||
|
|
||||||
|
namespace BookAStar
|
||||||
|
{
|
||||||
|
[ContentProperty("Source")]
|
||||||
|
public class AvatarImageSourceExtension : IMarkupExtension
|
||||||
|
{
|
||||||
|
public string Source { get; set; }
|
||||||
|
|
||||||
|
public object ProvideValue(IServiceProvider serviceProvider)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Do your translation lookup here, using whatever method you require
|
||||||
|
|
||||||
|
if (Source != null)
|
||||||
|
{
|
||||||
|
return ImageSource.FromUri(new Uri(Source));
|
||||||
|
}
|
||||||
|
return ImageSource.FromResource("BookAStar.icon-anon.png");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace BookAStar
|
namespace BookAStar.Helpers
|
||||||
{
|
{
|
||||||
using Model;
|
using Model;
|
||||||
using Model.Blog;
|
using Model.Blog;
|
||||||
|
|
@ -13,9 +13,11 @@ namespace BookAStar
|
||||||
public class DataManager
|
public class DataManager
|
||||||
{
|
{
|
||||||
// TODO userinfo estimatetemplate rating service product tag
|
// TODO userinfo estimatetemplate rating service product tag
|
||||||
public RemoteEntity<BookQueryData, long> BookQueries { get; set; }
|
public RemoteEntityRO<BookQueryData, long> BookQueries { get; set; }
|
||||||
public RemoteEntity<Estimate, long> Estimates { get; set; }
|
public RemoteEntity<Estimate, long> Estimates { get; set; }
|
||||||
public RemoteEntity<Blog, long> Blogspot { get; set; }
|
public RemoteEntity<Blog, long> Blogspot { get; set; }
|
||||||
|
public LocalEntity<ClientProviderInfo,string> Contacts { get; set; }
|
||||||
|
|
||||||
public static DataManager Current
|
public static DataManager Current
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -23,15 +25,18 @@ namespace BookAStar
|
||||||
return App.CurrentApp.DataManager;
|
return App.CurrentApp.DataManager;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataManager()
|
public DataManager()
|
||||||
{
|
{
|
||||||
BookQueries = new RemoteEntity<BookQueryData, long>("bookquery",
|
BookQueries = new RemoteEntityRO<BookQueryData, long>("bookquery",
|
||||||
q => q.Id);
|
q => q.Id);
|
||||||
Estimates = new RemoteEntity<Estimate, long>("estimate",
|
Estimates = new RemoteEntity<Estimate, long>("estimate",
|
||||||
x => x.Id);
|
x => x.Id);
|
||||||
Blogspot = new RemoteEntity<Blog, long>("blog",
|
Blogspot = new RemoteEntity<Blog, long>("blog",
|
||||||
x=>x.Id);
|
x=>x.Id);
|
||||||
|
Contacts = new LocalEntity<ClientProviderInfo, string>(c => c.UserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<BookQueryData> GetBookQuery(long bookQueryId)
|
public async Task<BookQueryData> GetBookQuery(long bookQueryId)
|
||||||
{
|
{
|
||||||
return await BookQueries.Get(bookQueryId);
|
return await BookQueries.Get(bookQueryId);
|
||||||
|
|
@ -204,11 +204,5 @@ namespace BookAStar
|
||||||
return environ;
|
return environ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public const string YavscHomeUrl = "http://dev.pschneider.fr";
|
|
||||||
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";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,27 +9,47 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace BookAStar
|
namespace BookAStar
|
||||||
{
|
{
|
||||||
public class RemoteEntity<V,K> : ObservableCollection<V>, ICommand where K : IEquatable<K>
|
public class LocalEntity<V, K> : ObservableCollection<V> where K : IEquatable<K>
|
||||||
|
{
|
||||||
|
protected Func<V, K> GetKey { get; set; }
|
||||||
|
public LocalEntity(Func<V, K> getKey) : base()
|
||||||
|
{
|
||||||
|
if (getKey == null) throw new InvalidOperationException();
|
||||||
|
GetKey = getKey;
|
||||||
|
}
|
||||||
|
public virtual void Merge(V item)
|
||||||
|
{
|
||||||
|
var key = GetKey(item);
|
||||||
|
if (this.Any(x => GetKey(x).Equals(key)))
|
||||||
|
{
|
||||||
|
Remove(LocalGet(key));
|
||||||
|
}
|
||||||
|
Add(item);
|
||||||
|
}
|
||||||
|
public V LocalGet(K key)
|
||||||
|
{
|
||||||
|
return this.Single(x => GetKey(x).Equals(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class RemoteEntity<V,K> : LocalEntity<V, K>, ICommand where K : IEquatable<K>
|
||||||
{
|
{
|
||||||
private string _controller;
|
private string _controller;
|
||||||
public event EventHandler CanExecuteChanged;
|
public event EventHandler CanExecuteChanged;
|
||||||
public bool IsExecuting { get; private set; }
|
public bool IsExecuting { get; private set; }
|
||||||
private HttpClient client;
|
|
||||||
private Uri controllerUri;
|
private Uri controllerUri;
|
||||||
protected Func<V, K> GetKey { get; set; }
|
|
||||||
public bool CanExecute(object parameter)
|
public bool CanExecute(object parameter)
|
||||||
{
|
{
|
||||||
return !IsExecuting;
|
return !IsExecuting;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RemoteEntity(string controllerName, Func<V,K> getKey):base()
|
public RemoteEntity(string controllerName, Func<V,K> getKey):base(getKey)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(controllerName) || getKey == null)
|
if (string.IsNullOrWhiteSpace(controllerName))
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
_controller = controllerName;
|
_controller = controllerName;
|
||||||
GetKey = getKey;
|
controllerUri = new Uri(Constants.YavscApiUrl + "/" + _controller);
|
||||||
client = new HttpClient();
|
|
||||||
controllerUri = new Uri(MainSettings.YavscApiUrl + "/" + _controller);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BeforeExecute()
|
private void BeforeExecute()
|
||||||
|
|
@ -49,38 +69,30 @@ namespace BookAStar
|
||||||
{
|
{
|
||||||
BeforeExecute();
|
BeforeExecute();
|
||||||
// Update credentials
|
// Update credentials
|
||||||
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(
|
using (HttpClient client = new HttpClient())
|
||||||
"Bearer", MainSettings.CurrentUser.YavscTokens.AccessToken);
|
|
||||||
// Get the whole data
|
|
||||||
|
|
||||||
var response = await client.GetAsync(controllerUri);
|
|
||||||
if (response.IsSuccessStatusCode)
|
|
||||||
{
|
{
|
||||||
var content = await response.Content.ReadAsStringAsync();
|
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(
|
||||||
List<V> col = JsonConvert.DeserializeObject<List<V>>(content);
|
"Bearer", MainSettings.CurrentUser.YavscTokens.AccessToken);
|
||||||
// LocalData.Clear();
|
// Get the whole data
|
||||||
foreach (var item in col)
|
|
||||||
|
using (var response = await client.GetAsync(controllerUri))
|
||||||
{
|
{
|
||||||
UpdateOrAdd(item);
|
if (response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
var content = await response.Content.ReadAsStringAsync();
|
||||||
|
List<V> col = JsonConvert.DeserializeObject<List<V>>(content);
|
||||||
|
// LocalData.Clear();
|
||||||
|
foreach (var item in col)
|
||||||
|
{
|
||||||
|
Merge(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AfterExecuting();
|
AfterExecuting();
|
||||||
}
|
}
|
||||||
protected virtual void UpdateOrAdd (V item)
|
|
||||||
{
|
|
||||||
var key = GetKey(item);
|
|
||||||
if (this.Any(x => GetKey(x).Equals(key)))
|
|
||||||
{
|
|
||||||
Remove(LocalGet(key));
|
|
||||||
}
|
|
||||||
Add(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
public V LocalGet(K key)
|
|
||||||
{
|
|
||||||
return this.Single(x => GetKey(x).Equals(key));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void AfterExecuting()
|
private void AfterExecuting()
|
||||||
{
|
{
|
||||||
|
|
@ -96,13 +108,18 @@ namespace BookAStar
|
||||||
// Get the whole data
|
// Get the whole data
|
||||||
var uri = new Uri(controllerUri.AbsolutePath+"/"+key.ToString());
|
var uri = new Uri(controllerUri.AbsolutePath+"/"+key.ToString());
|
||||||
|
|
||||||
var response = await client.GetAsync(uri);
|
using (HttpClient client = new HttpClient())
|
||||||
if (response.IsSuccessStatusCode)
|
|
||||||
{
|
{
|
||||||
var content = await response.Content.ReadAsStringAsync();
|
using (var response = await client.GetAsync(uri))
|
||||||
item = JsonConvert.DeserializeObject<V>(content);
|
{
|
||||||
// LocalData.Clear();
|
if (response.IsSuccessStatusCode)
|
||||||
UpdateOrAdd(item);
|
{
|
||||||
|
var content = await response.Content.ReadAsStringAsync();
|
||||||
|
item = JsonConvert.DeserializeObject<V>(content);
|
||||||
|
// LocalData.Clear();
|
||||||
|
Merge(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AfterExecuting();
|
AfterExecuting();
|
||||||
|
|
|
||||||
|
|
@ -7,14 +7,14 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace BookAStar.Helpers
|
namespace BookAStar.Helpers
|
||||||
{
|
{
|
||||||
class RemoteEntityRO<V,K>: RemoteEntity<V,K> where K: IEquatable<K>
|
public class RemoteEntityRO<V,K>: RemoteEntity<V,K> where K: IEquatable<K>
|
||||||
{
|
{
|
||||||
public RemoteEntityRO (string controllerName,
|
public RemoteEntityRO (string controllerName,
|
||||||
Func<V,K> getKey) : base(controllerName,getKey)
|
Func<V,K> getKey) : base(controllerName,getKey)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateOrAdd(V item)
|
public override void Merge(V item)
|
||||||
{
|
{
|
||||||
var key = GetKey(item);
|
var key = GetKey(item);
|
||||||
if (this.Any(x => GetKey(x).Equals(key))) { return; }
|
if (this.Any(x => GetKey(x).Equals(key))) { return; }
|
||||||
|
|
|
||||||
13
BookAStar/BookAStar/Interfaces/IMDEditor.cs
Normal file
13
BookAStar/BookAStar/Interfaces/IMDEditor.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
using System;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
namespace BookAStar.Interfaces
|
||||||
|
{
|
||||||
|
public interface IMDEditor
|
||||||
|
{
|
||||||
|
View EditorView { get; }
|
||||||
|
string Text { get; set; }
|
||||||
|
bool Editable { get; set; }
|
||||||
|
Action<string> Edited { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3,14 +3,13 @@ using System;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
using Yavsc.Models.Identity;
|
using Yavsc.Models.Identity;
|
||||||
|
|
||||||
namespace BookAStar
|
namespace BookAStar.Interfaces
|
||||||
{
|
{
|
||||||
public interface IPlatform
|
public interface IPlatform
|
||||||
{
|
{
|
||||||
void OpenWeb (string Uri);
|
void OpenWeb (string Uri);
|
||||||
|
|
||||||
// TODO Better
|
// TODO Better
|
||||||
|
|
||||||
string GCMStatusMessage { get; }
|
string GCMStatusMessage { get; }
|
||||||
|
|
||||||
bool EnablePushNotifications (bool enable);
|
bool EnablePushNotifications (bool enable);
|
||||||
|
|
@ -24,8 +23,6 @@ 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, Action<string> update);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3,12 +3,6 @@ using System;
|
||||||
|
|
||||||
namespace BookAStar.Model
|
namespace BookAStar.Model
|
||||||
{
|
{
|
||||||
public class ClientProviderInfo
|
|
||||||
{
|
|
||||||
public string UserName { get; set; }
|
|
||||||
public string UserId { get; set; }
|
|
||||||
public int Rate { get; set; }
|
|
||||||
}
|
|
||||||
public class BookQueryData
|
public class BookQueryData
|
||||||
{
|
{
|
||||||
public ClientProviderInfo Client { get; set; }
|
public ClientProviderInfo Client { get; set; }
|
||||||
|
|
|
||||||
23
BookAStar/BookAStar/Model/ClientProviderInfo.cs
Normal file
23
BookAStar/BookAStar/Model/ClientProviderInfo.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
using BookAStar.Model.Social;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BookAStar.Model
|
||||||
|
{
|
||||||
|
public class ClientProviderInfo
|
||||||
|
{
|
||||||
|
public string UserName { get; set; }
|
||||||
|
|
||||||
|
public string Avatar { get; set; }
|
||||||
|
// private string avatar;
|
||||||
|
// public string Avatar { get { return avatar ?? "icon-anon.png"; } set { avatar = value; } }
|
||||||
|
public string UserId { get; set; }
|
||||||
|
public int Rate { get; set; }
|
||||||
|
public string EMail { get; set; }
|
||||||
|
public string Phone { get; set; }
|
||||||
|
public Location BillingAddress { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,16 +6,13 @@ using System.Windows.Input;
|
||||||
|
|
||||||
namespace BookAStar
|
namespace BookAStar
|
||||||
{
|
{
|
||||||
|
[Obsolete("Use Helpers.DataManager")]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static class Manager
|
public static class Manager
|
||||||
{
|
{
|
||||||
static Manager ()
|
static Manager ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ICommand RefreshBookQueries;
|
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[] {
|
||||||
|
|
|
||||||
|
|
@ -27,18 +27,16 @@ 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 class LocalizedEvent : YaEvent
|
public class LocalizedEvent : YaEvent
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
public Location Location { get; set; }
|
public Location Location { get; set; }
|
||||||
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,13 +1,17 @@
|
||||||
using System.Collections.Generic;
|
using BookAStar.Helpers;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace BookAStar.Model.Workflow
|
namespace BookAStar.Model.Workflow
|
||||||
{
|
{
|
||||||
public partial class Estimate
|
public partial class Estimate
|
||||||
{
|
{
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
|
|
||||||
public long? CommandId { get; set; }
|
public long? CommandId { get; set; }
|
||||||
|
public string CommandType { get; set; }
|
||||||
|
// Markdown expected
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public int? Status { get; set; }
|
public int? Status { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
|
|
@ -23,7 +27,7 @@ namespace BookAStar.Model.Workflow
|
||||||
|
|
||||||
public string AttachedGraphicsString
|
public string AttachedGraphicsString
|
||||||
{
|
{
|
||||||
get { return string.Join(":", AttachedGraphicList); }
|
get { return AttachedGraphicList==null?null:string.Join(":", AttachedGraphicList); }
|
||||||
set { AttachedGraphicList = value.Split(':').ToList(); }
|
set { AttachedGraphicList = value.Split(':').ToList(); }
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -36,12 +40,32 @@ namespace BookAStar.Model.Workflow
|
||||||
public List<string> AttachedFiles { get; set; }
|
public List<string> AttachedFiles { get; set; }
|
||||||
public string AttachedFilesString
|
public string AttachedFilesString
|
||||||
{
|
{
|
||||||
get { return string.Join(":", AttachedFiles); }
|
get { return AttachedFiles == null ? null : string.Join(":", AttachedFiles); }
|
||||||
set { AttachedFiles = value.Split(':').ToList(); }
|
set { AttachedFiles = value.Split(':').ToList(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string OwnerId { get; set; }
|
public string OwnerId { get; set; }
|
||||||
|
|
||||||
public string ClientId { get; set; }
|
public string ClientId { get; set; }
|
||||||
|
|
||||||
|
public BookQueryData Query
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (CommandId.HasValue)
|
||||||
|
{
|
||||||
|
return DataManager.Current.BookQueries.LocalGet(CommandId.Value);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProviderInfo Client
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return DataManager.Current.Contacts.LocalGet(ClientId);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ namespace BookAStar.Pages
|
||||||
_source = new HtmlWebViewSource();
|
_source = new HtmlWebViewSource();
|
||||||
_sourceTitle = new HtmlWebViewSource();
|
_sourceTitle = new HtmlWebViewSource();
|
||||||
_md = new MarkdownDeep.Markdown();
|
_md = new MarkdownDeep.Markdown();
|
||||||
_sourceTitle.BaseUrl = _source.BaseUrl = MainSettings.YavscHomeUrl;
|
_sourceTitle.BaseUrl = _source.BaseUrl = Constants.YavscHomeUrl;
|
||||||
_sourceTitle.Html = "Hello";
|
_sourceTitle.Html = "Hello";
|
||||||
titleLabel = new WebView { Source = _sourceTitle };
|
titleLabel = new WebView { Source = _sourceTitle };
|
||||||
contentView = new WebView { Source = _source };
|
contentView = new WebView { Source = _source };
|
||||||
|
|
|
||||||
|
|
@ -1,40 +1,50 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
xmlns:local="clr-namespace:BookAStar.Views;assembly=BookAStar"
|
xmlns:local="clr-namespace:BookAStar;assembly=BookAStar"
|
||||||
x:Class="BookAStar.Pages.BookQueriesPage">
|
x:Class="BookAStar.Pages.BookQueriesPage"
|
||||||
<StackLayout>
|
Padding="{x:Static local:Constants.PagePadding}"
|
||||||
|
BackgroundColor="{x:Static local:Constants.BackgroundColor}"
|
||||||
|
>
|
||||||
|
<ContentPage.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
|
||||||
<ListView x:Name="list"
|
<Style x:Key="labelStyle" TargetType="Label">
|
||||||
HasUnevenRows="true" ItemTapped="OnViewDetail">
|
<Setter Property="TextColor" Value="{DynamicResource EmphasisTextColor}" />
|
||||||
<ListView.ItemTemplate>
|
<Setter Property="FontAttributes" Value="Bold" />
|
||||||
|
<Setter Property="FontSize" Value="{DynamicResource LargeFontSize}" />
|
||||||
|
<Setter Property="VerticalOptions" Value="Start" />
|
||||||
|
<Setter Property="LineBreakMode" Value="WordWrap" />
|
||||||
|
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
|
</ContentPage.Resources>
|
||||||
|
|
||||||
|
<StackLayout Padding="10,10,10,10">
|
||||||
|
|
||||||
|
<ListView x:Name="list" ItemTapped="OnViewDetail" HasUnevenRows="true" RowHeight="80">
|
||||||
|
<ListView.ItemTemplate HeightRequest="80" VerticalOptions="StartAndExpand">
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<ViewCell>
|
<ViewCell>
|
||||||
<ViewCell.View>
|
<ViewCell.View>
|
||||||
<StackLayout Orientation="Horizontal">
|
<StackLayout Orientation="Horizontal" Padding="10,10,10,10" VerticalOptions="StartAndExpand">
|
||||||
<StackLayout Orientation="Vertical">
|
<StackLayout Orientation="Vertical" BackgroundColor="{x:Static local:Constants.OddBackgroundColor}"
|
||||||
<Label Text="{Binding Title}" FontSize="12"/>
|
HeightRequest="80" VerticalOptions="StartAndExpand">
|
||||||
<Label Text="{Binding Description}"/>
|
|
||||||
<Label Text="{Binding Comment}"/>
|
|
||||||
<Label Text="{Binding CommandId}"/>
|
|
||||||
|
|
||||||
<StackLayout Orientation="Horizontal">
|
<StackLayout Orientation="Vertical" >
|
||||||
|
<Image Source="{Binding Client.Avatar}" />
|
||||||
<StackLayout>
|
<Label Text="{Binding Client.UserName}"
|
||||||
<Label Text="Date:" FontAttributes="Italic"/>
|
Style="{StaticResource labelStyle}"></Label>
|
||||||
<Label Text="{Binding StartDate, StringFormat='{0:jj/MM/yyyy}'}" VerticalOptions="End"/>
|
|
||||||
</StackLayout>
|
|
||||||
<StackLayout>
|
|
||||||
<Label Text="Heure:" FontAttributes="Italic" />
|
|
||||||
<Label Text="{Binding StartDate, StringFormat='{0:H:mm}'}" VerticalOptions="End"/>
|
|
||||||
</StackLayout>
|
|
||||||
<StackLayout>
|
|
||||||
<Label Text="Lieu:" FontAttributes="Italic" VerticalOptions="End"/>
|
|
||||||
<Label Text="{Binding Location.Address}"/>
|
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
|
|
||||||
|
<Label LineBreakMode="WordWrap" Text="{Binding EventDate, StringFormat='{0:dddd d MMMM à HH:mm}'}" FontSize="12" FontFamily="Italic"/>
|
||||||
|
</StackLayout>
|
||||||
|
<StackLayout Orientation="Vertical" VerticalOptions="StartAndExpand">
|
||||||
|
<Label LineBreakMode="WordWrap" Text="{Binding Location.Address}"/>
|
||||||
|
<Label Text="{Binding Previsionnal}"/>
|
||||||
|
<Label Text="{Binding Id}" HorizontalTextAlignment="End"/>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</StackLayout>
|
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ViewCell.View>
|
</ViewCell.View>
|
||||||
</ViewCell>
|
</ViewCell>
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,11 @@ namespace BookAStar.Pages
|
||||||
public BookQueriesPage()
|
public BookQueriesPage()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
BindingContext = App.CurrentApp.DataManager.BookQueries;
|
}
|
||||||
|
protected override void OnBindingContextChanged()
|
||||||
|
{
|
||||||
list.ItemsSource = BindingContext as ObservableCollection<BookQueryData>;
|
list.ItemsSource = BindingContext as ObservableCollection<BookQueryData>;
|
||||||
list.RefreshCommand = BindingContext as ICommand;
|
base.OnBindingContextChanged();
|
||||||
list.IsPullToRefreshEnabled = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public RemoteEntity<BookQueryData,long> Queries
|
public RemoteEntity<BookQueryData,long> Queries
|
||||||
|
|
@ -40,7 +41,6 @@ namespace BookAStar.Pages
|
||||||
{
|
{
|
||||||
BookQueryData data = e.Item as BookQueryData;
|
BookQueryData data = e.Item as BookQueryData;
|
||||||
App.CurrentApp.ShowBookQuery(data);
|
App.CurrentApp.ShowBookQuery(data);
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,35 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
xmlns:local="clr-namespace:BookAStar;assembly=BookAStar"
|
||||||
xmlns:maps="clr-namespace:Xamarin.Forms.Maps;assembly=Xamarin.Forms.Maps.dll"
|
xmlns:maps="clr-namespace:Xamarin.Forms.Maps;assembly=Xamarin.Forms.Maps.dll"
|
||||||
x:Class="BookAStar.Pages.BookQueryPage">
|
x:Class="BookAStar.Pages.BookQueryPage"
|
||||||
|
BackgroundColor="{x:Static local:Constants.BackgroundColor}"
|
||||||
|
Padding="{x:Static local:Constants.PagePadding}"
|
||||||
|
>
|
||||||
|
<ContentPage.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
|
||||||
|
<Style x:Key="labelStyle" TargetType="Label">
|
||||||
|
<Setter Property="TextColor" Value="{DynamicResource EmphasisTextColor}" />
|
||||||
|
<Setter Property="FontAttributes" Value="Bold" />
|
||||||
|
<Setter Property="FontSize" Value="{DynamicResource LargeFontSize}" />
|
||||||
|
<Setter Property="VerticalOptions" Value="Start" />
|
||||||
|
<Setter Property="LineBreakMode" Value="WordWrap" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
|
</ContentPage.Resources>
|
||||||
|
|
||||||
<StackLayout x:Name="bookQueryLayout">
|
<StackLayout x:Name="bookQueryLayout">
|
||||||
|
<Label Text="{Binding Client.UserName}" Style="{StaticResource labelStyle}"
|
||||||
|
VerticalOptions="Start" HorizontalOptions="Center" />
|
||||||
|
<Label Text="{Binding Location.Address}" VerticalOptions="FillAndExpand" HorizontalOptions="Center" />
|
||||||
|
<Label Text="{Binding Previsional}" VerticalOptions="Center" HorizontalOptions="Center" />
|
||||||
|
|
||||||
|
<Label Text="{Binding EventDate}" VerticalOptions="Center" HorizontalOptions="Center" />
|
||||||
<Label Text="{Binding Title}" VerticalOptions="Start" HorizontalOptions="Center" />
|
<Label Text="{Binding Location.Address}" VerticalOptions="Center" 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 Location}" VerticalOptions="Center" HorizontalOptions="Center" />
|
|
||||||
<maps:Map x:Name="map"></maps:Map>
|
<maps:Map x:Name="map"></maps:Map>
|
||||||
<Button Text="Faire un devis" Clicked="MakeAnEstimate" VerticalOptions="Center" HorizontalOptions="End"/>
|
<Button Text="Faire un devis" Clicked="MakeAnEstimate" VerticalOptions="Center" HorizontalOptions="End"/>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ContentPage>
|
</ContentPage>
|
||||||
|
|
@ -6,7 +6,9 @@ using Xamarin.Forms.Maps;
|
||||||
|
|
||||||
namespace BookAStar.Pages
|
namespace BookAStar.Pages
|
||||||
{
|
{
|
||||||
|
using Helpers;
|
||||||
using Model;
|
using Model;
|
||||||
|
using Model.Workflow;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
public partial class BookQueryPage : ContentPage
|
public partial class BookQueryPage : ContentPage
|
||||||
|
|
@ -43,8 +45,9 @@ namespace BookAStar.Pages
|
||||||
map.MoveToRegion(MapSpan.FromCenterAndRadius(
|
map.MoveToRegion(MapSpan.FromCenterAndRadius(
|
||||||
new Position(lat, lon), Distance.FromMeters(100)));
|
new Position(lat, lon), Distance.FromMeters(100)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public BookQueryPage(BookQueryData bookQuery)
|
public BookQueryPage(BookQueryData bookQuery=null)
|
||||||
{
|
{
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
@ -55,9 +58,18 @@ namespace BookAStar.Pages
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MakeAnEstimate(object sender, EventArgs e)
|
private void MakeAnEstimate(object sender, EventArgs ev)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
DataManager.Current.Contacts.Merge(BookQuery.Client);
|
||||||
|
var e = new Estimate()
|
||||||
|
{
|
||||||
|
ClientId = BookQuery.Client.UserId,
|
||||||
|
CommandId = BookQuery.Id,
|
||||||
|
OwnerId = MainSettings.CurrentUser.Id,
|
||||||
|
Id = 0,
|
||||||
|
Description = "# **Hello Estimate!**"
|
||||||
|
};
|
||||||
|
App.CurrentApp.EditEstimate(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
42
BookAStar/BookAStar/Pages/EditEstimatePage.xaml
Normal file
42
BookAStar/BookAStar/Pages/EditEstimatePage.xaml
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?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.EditEstimatePage"
|
||||||
|
xmlns:local="clr-namespace:BookAStar.Views;assembly=BookAStar"
|
||||||
|
>
|
||||||
|
<StackLayout Padding="10,10,10,10">
|
||||||
|
|
||||||
|
<StackLayout Orientation="Horizontal" Padding="10,10,10,10">
|
||||||
|
<Label Text="{Binding Client.UserName}"
|
||||||
|
LineBreakMode="WordWrap"></Label>
|
||||||
|
<Label Text="{Binding Query.Location.Address}"
|
||||||
|
LineBreakMode="WordWrap" ></Label>
|
||||||
|
<Label Text="{Binding Query.EventDate, StringFormat='{0:dddd d MMMM yyyy à hh:mm}'}"
|
||||||
|
LineBreakMode="WordWrap" ></Label>
|
||||||
|
</StackLayout>
|
||||||
|
|
||||||
|
<local:MarkdownView x:Name="mdview" Markdown="{Binding Description}"
|
||||||
|
Edited="OnDescriptionChanged" HorizontalOptions="FillAndExpand"
|
||||||
|
VerticalOptions="FillAndExpand">
|
||||||
|
|
||||||
|
</local:MarkdownView>
|
||||||
|
|
||||||
|
<!-- <ListView >
|
||||||
|
<ListView.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ViewCell>
|
||||||
|
<ViewCell.View>
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<Entry Placeholder="Ligne de facture"></Entry>
|
||||||
|
<Entry Placeholder="Compte"></Entry>
|
||||||
|
<Entry Placeholder="Prix unitaire" ></Entry>
|
||||||
|
</StackLayout>
|
||||||
|
</ViewCell.View>
|
||||||
|
</ViewCell>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListView.ItemTemplate>
|
||||||
|
</ListView> -->
|
||||||
|
<Label Text="Total TTC:"></Label>
|
||||||
|
<Button Text="Valider ce devis"></Button>
|
||||||
|
</StackLayout>
|
||||||
|
</ContentPage>
|
||||||
44
BookAStar/BookAStar/Pages/EditEstimatePage.xaml.cs
Normal file
44
BookAStar/BookAStar/Pages/EditEstimatePage.xaml.cs
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
using BookAStar.Model;
|
||||||
|
using BookAStar.Model.Workflow;
|
||||||
|
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 EditEstimatePage : ContentPage
|
||||||
|
{
|
||||||
|
public Estimate Estimate { get { return BindingContext as Estimate; } set {
|
||||||
|
BindingContext = value;
|
||||||
|
} }
|
||||||
|
public static readonly BindableProperty MarkdownProperty =
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
protected override void OnBindingContextChanged()
|
||||||
|
{
|
||||||
|
base.OnBindingContextChanged();
|
||||||
|
mdview.Markdown = Estimate?.Description;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void OnDescriptionChanged (object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Estimate.Description = mdview.Markdown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -15,7 +15,7 @@ namespace BookAStar
|
||||||
BindingContext = ev;
|
BindingContext = ev;
|
||||||
btn_webpage.Clicked += (object sender, EventArgs e) =>
|
btn_webpage.Clicked += (object sender, EventArgs e) =>
|
||||||
{
|
{
|
||||||
App.PlateformSpecificInstance.OpenWeb(ev.EventWebPage);
|
App.PlatformSpecificInstance.OpenWeb(ev.EventWebPage);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
<?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"
|
|
||||||
Markdown="hello estimate"></local:MarkdownView>
|
|
||||||
</ContentPage>
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
using BookAStar.Model.Workflow;
|
|
||||||
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 Estimate Estimate { get { return BindingContext as Estimate; } set {
|
|
||||||
BindingContext = value;
|
|
||||||
} }
|
|
||||||
|
|
||||||
public static readonly BindableProperty MarkdownProperty =
|
|
||||||
BindableProperty.Create("Description", typeof(string), typeof(Estimate),
|
|
||||||
null, BindingMode.TwoWay);
|
|
||||||
|
|
||||||
public MakeAnEstimatePage(string clientId,long bookQueryId)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
<?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>
|
|
||||||
|
|
@ -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
|
|
||||||
{
|
|
||||||
public partial class QueriesPage : ContentPage
|
|
||||||
{
|
|
||||||
public QueriesPage()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -6,10 +6,7 @@
|
||||||
Padding="10,40,10,10" >
|
Padding="10,40,10,10" >
|
||||||
<ContentPage.Content>
|
<ContentPage.Content>
|
||||||
<StackLayout>
|
<StackLayout>
|
||||||
<StackLayout Orientation="Horizontal">
|
|
||||||
<Label Text="Utiliser ma position" />
|
|
||||||
<Switch x:Name="use_my_pos" HorizontalOptions="End" />
|
|
||||||
</StackLayout>
|
|
||||||
|
|
||||||
<StackLayout Orientation="Horizontal">
|
<StackLayout Orientation="Horizontal">
|
||||||
<Editor x:Name="search_phrase" HorizontalOptions="FillAndExpand"/>
|
<Editor x:Name="search_phrase" HorizontalOptions="FillAndExpand"/>
|
||||||
|
|
@ -19,7 +16,6 @@
|
||||||
|
|
||||||
<ListView x:Name="list" ItemsSource="{x:Static local:Manager.Events}"
|
<ListView x:Name="list" ItemsSource="{x:Static local:Manager.Events}"
|
||||||
HasUnevenRows="true">
|
HasUnevenRows="true">
|
||||||
s
|
|
||||||
<ListView.ItemTemplate>
|
<ListView.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<ViewCell>
|
<ViewCell>
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,10 @@ BindingContext="." >
|
||||||
<ListView.ItemTemplate HeightRequest="60" VerticalOptions="StartAndExpand">
|
<ListView.ItemTemplate HeightRequest="60" VerticalOptions="StartAndExpand">
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<ViewCell>
|
<ViewCell>
|
||||||
<Grid Padding="0"
|
<Grid Padding="5"
|
||||||
ColumnSpacing="10"
|
ColumnSpacing="10"
|
||||||
RowSpacing="0">
|
RowSpacing="2">
|
||||||
|
<Image Source="{Binding Avatar}" HeightRequest="80" />
|
||||||
<Label Grid.Column="0" Text="{Binding UserName}" />
|
<Label Grid.Column="0" Text="{Binding UserName}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</ViewCell>
|
</ViewCell>
|
||||||
|
|
@ -42,17 +43,24 @@ BindingContext="." >
|
||||||
|
|
||||||
</ListView>
|
</ListView>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<StackLayout Orientation="Horizontal" VerticalOptions="Start">
|
<StackLayout Orientation="Horizontal" VerticalOptions="Start">
|
||||||
<Label Text="Recevoir les notifications push" StyleClass="Header"/>
|
<Label Text="Recevoir les notifications push" />
|
||||||
<Switch x:Name="pushstatus" />
|
<Switch x:Name="pushstatus" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
|
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<Label Text="Utiliser ma position" />
|
||||||
|
<Switch x:Name="use_my_pos" HorizontalOptions="End" />
|
||||||
|
</StackLayout>
|
||||||
|
|
||||||
|
|
||||||
<StackLayout Orientation="Horizontal" VerticalOptions="Start">
|
<StackLayout Orientation="Horizontal" VerticalOptions="Start">
|
||||||
<Label Text="Recevoir les demandes de devis de la part de professionnels uniquement"
|
<Label Text="Recevoir les demandes de devis de la part de professionnels uniquement"
|
||||||
StyleClass="Header"/>
|
StyleClass="Header"/>
|
||||||
<Switch x:Name="restrictToPro" />
|
<Switch x:Name="restrictToPro" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
|
|
||||||
<Button x:Name="BtnViewDeviceInfo" Text="Device info" StyleClass="Info"></Button>
|
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ContentPage>
|
</ContentPage>
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,6 @@ namespace BookAStar
|
||||||
|
|
||||||
pushstatus.Toggled += Pushstatus_Toggled;
|
pushstatus.Toggled += Pushstatus_Toggled;
|
||||||
|
|
||||||
BtnViewDeviceInfo.Clicked += BtnDeviceInfo_Clicked;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void BtnDeviceInfo_Clicked(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
((BookAStar.App) App.Current).ShowDeviceInfo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void Pushstatus_Toggled(object sender, ToggledEventArgs e)
|
protected void Pushstatus_Toggled(object sender, ToggledEventArgs e)
|
||||||
|
|
@ -64,7 +58,7 @@ namespace BookAStar
|
||||||
var doIt = await Confirm("Suppression de l'identification",
|
var doIt = await Confirm("Suppression de l'identification",
|
||||||
$"Vous êtes sur le point de supprimer votre identification pour ce compte : {user.UserName}\nContinuer ?");
|
$"Vous êtes sur le point de supprimer votre identification pour ce compte : {user.UserName}\nContinuer ?");
|
||||||
if (doIt)
|
if (doIt)
|
||||||
App.PlateformSpecificInstance.RevokeAccount(user.UserName);
|
App.PlatformSpecificInstance.RevokeAccount(user.UserName);
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task<bool> Confirm(string title, string procedure)
|
async Task<bool> Confirm(string title, string procedure)
|
||||||
|
|
@ -84,7 +78,7 @@ namespace BookAStar
|
||||||
|
|
||||||
private void AddAccountBtn_Clicked(object sender, EventArgs e)
|
private void AddAccountBtn_Clicked(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
App.PlateformSpecificInstance.AddAccount();
|
App.PlatformSpecificInstance.AddAccount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,11 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyTitle("BookAStar")]
|
[assembly: AssemblyTitle("BookAStar")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("Paul Schneider")]
|
||||||
[assembly: AssemblyProduct("BookAStar")]
|
[assembly: AssemblyProduct("BookAStar")]
|
||||||
[assembly: AssemblyCopyright("Copyright © Paul Albert Schneider 2016")]
|
[assembly: AssemblyCopyright("Copyright © Paul Albert Schneider 2016")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("Yavsc")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("fr")]
|
||||||
[assembly: NeutralResourcesLanguage("fr")]
|
[assembly: NeutralResourcesLanguage("fr")]
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
// Version information for an assembly consists of the following four values:
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using BookAStar.Interfaces;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection.Emit;
|
using System.Reflection.Emit;
|
||||||
|
|
@ -8,7 +9,7 @@ using Xamarin.Forms;
|
||||||
|
|
||||||
namespace BookAStar.Views
|
namespace BookAStar.Views
|
||||||
{
|
{
|
||||||
public partial class MarkdownView : ContentView
|
public class MarkdownView : View
|
||||||
{
|
{
|
||||||
public static readonly BindableProperty MarkdownProperty = BindableProperty.Create(
|
public static readonly BindableProperty MarkdownProperty = BindableProperty.Create(
|
||||||
"Markdown", typeof(string), typeof(MarkdownView), null, BindingMode.TwoWay
|
"Markdown", typeof(string), typeof(MarkdownView), null, BindingMode.TwoWay
|
||||||
|
|
@ -23,25 +24,20 @@ namespace BookAStar.Views
|
||||||
return markdown;
|
return markdown;
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
markdown = value;
|
if (markdown != value)
|
||||||
Content = App.PlateformSpecificInstance.CreateMarkdownView(
|
if (Edited != null)
|
||||||
markdown,
|
{
|
||||||
e => {
|
markdown = value;
|
||||||
Markdown = e;
|
Edited.Invoke(this, new EventArgs());
|
||||||
if (Validated != null)
|
return;
|
||||||
Validated.Invoke(this, new EventArgs());
|
|
||||||
}
|
}
|
||||||
);
|
|
||||||
|
|
||||||
|
markdown = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MarkdownView() : base()
|
public event EventHandler<EventArgs> Edited;
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public event EventHandler Validated;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
BIN
BookAStar/BookAStar/icon-anon.png
Normal file
BIN
BookAStar/BookAStar/icon-anon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1 KiB |
Loading…
Add table
Add a link
Reference in a new issue