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>
|
||||
<Private>True</Private>
|
||||
</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="mscorlib" />
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
|
|
@ -203,6 +204,7 @@
|
|||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>MarkdownEditor.cshtml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MarkdownViewRenderer.cs" />
|
||||
<Compile Include="MarkdownWebViewClient.cs" />
|
||||
<Compile Include="OAuth2\YaOAuth2Authenticator.cs" />
|
||||
<Compile Include="Resources\Resource.Designer.cs" />
|
||||
|
|
@ -224,6 +226,9 @@
|
|||
<None Include="packages.config" />
|
||||
<None Include="Resources\AboutResources.txt" />
|
||||
<AndroidAsset Include="Assets\AboutAssets.txt" />
|
||||
<AndroidResource Include="Resources\layout\EditEstimate.axml">
|
||||
<SubType>Designer</SubType>
|
||||
</AndroidResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable\icon.png" />
|
||||
|
|
@ -301,6 +306,7 @@
|
|||
<AndroidResource Include="Resources\drawable\nfqrcode.png" />
|
||||
<AndroidResource Include="Resources\drawable\visuel_sexion.jpg" />
|
||||
<AndroidResource Include="Resources\values\values-21\styles.xml" />
|
||||
<AndroidResource Include="Resources\drawable\icon-anon.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\drawable-hdpi\" />
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ using Android.Webkit;
|
|||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.Android;
|
||||
using Android.Views;
|
||||
|
||||
using BookAStar.Helpers;
|
||||
using BookAStar.Interfaces;
|
||||
|
||||
namespace BookAStar.Droid
|
||||
{
|
||||
|
|
@ -87,11 +88,11 @@ namespace BookAStar.Droid
|
|||
{
|
||||
|
||||
var accStore = AccountStore.Create(this);
|
||||
var accounts = accStore.FindAccountsForService(MainSettings.ApplicationName);
|
||||
var accounts = accStore.FindAccountsForService(Constants.ApplicationName);
|
||||
|
||||
accStore.Delete(
|
||||
accounts.Where(a => a.Username == userName).FirstOrDefault()
|
||||
, MainSettings.ApplicationName);
|
||||
, Constants.ApplicationName);
|
||||
Toast.MakeText(this,
|
||||
Resource.String.yavscIdentRemoved
|
||||
, ToastLength.Short);
|
||||
|
|
@ -160,7 +161,7 @@ namespace BookAStar.Droid
|
|||
using (var reader = new StreamReader(response.GetResponseStream()))
|
||||
{
|
||||
responseText = reader.ReadToEnd();
|
||||
Log.Debug(MainSettings.ApplicationName, responseText);
|
||||
Log.Debug(Constants.ApplicationName, responseText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -180,7 +181,7 @@ namespace BookAStar.Droid
|
|||
{
|
||||
return await Task.Run(() => {
|
||||
var manager = AccountStore.Create(this);
|
||||
return manager.FindAccountsForService(MainSettings.ApplicationName);
|
||||
return manager.FindAccountsForService(Constants.ApplicationName);
|
||||
});
|
||||
}
|
||||
YaOAuth2Authenticator auth = new YaOAuth2Authenticator(
|
||||
|
|
@ -215,7 +216,7 @@ namespace BookAStar.Droid
|
|||
|
||||
// get me
|
||||
// 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 =
|
||||
new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", tokens.AccessToken);
|
||||
|
|
@ -244,7 +245,7 @@ namespace BookAStar.Droid
|
|||
};
|
||||
|
||||
MainSettings.SaveUser(newuser);
|
||||
accStore.Save(acc, MainSettings.ApplicationName);
|
||||
accStore.Save(acc, Constants.ApplicationName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -331,34 +332,6 @@ namespace BookAStar.Droid
|
|||
return m.InvokeJson(arg);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorTemplatePreprocessor", "4.1.2.18")]
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorTemplatePreprocessor", "4.2.0.680")]
|
||||
public partial class MarkdownEditor : MarkdownEditorBase
|
||||
{
|
||||
|
||||
|
|
@ -32,32 +32,30 @@ public string Model { get; set; }
|
|||
|
||||
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(">\r\n\r\n <link");
|
||||
WriteLiteral(">\r\n <link");
|
||||
|
||||
WriteLiteral(" rel=\"stylesheet\"");
|
||||
|
||||
WriteLiteral(" href=\"quill.snow.css\"");
|
||||
|
||||
WriteLiteral(@" />
|
||||
|
||||
<style>
|
||||
.standalone-container {
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#bubble-container {
|
||||
width:100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#bubble-container div.ql-editor {
|
||||
margin-top:3em;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
|
@ -65,7 +63,6 @@ WriteLiteral(@" />
|
|||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div");
|
||||
|
||||
WriteLiteral(" class=\"standalone-container\"");
|
||||
|
|
@ -77,31 +74,13 @@ WriteLiteral(" id=\"bubble-container\"");
|
|||
WriteLiteral(">");
|
||||
|
||||
|
||||
#line 33 "MarkdownEditor.cshtml"
|
||||
#line 28 "MarkdownEditor.cshtml"
|
||||
Write(Html.Write(Model));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</div>\r\n </div>\r\n <form><input");
|
||||
|
||||
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("</div>\r\n </div>\r\n \r\n <script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
|
|
@ -143,7 +122,7 @@ WriteLiteral(@">
|
|||
[{ 'header': 1 }, { 'header': 2 }], // custom button values
|
||||
[{ 'list': 'ordered' }, { 'list': 'bullet' }],
|
||||
[{ 'indent': '-1' }, { 'indent': '+1' }], // outdent/indent
|
||||
|
||||
['link', 'image'],
|
||||
['clean'] // remove formatting button
|
||||
];
|
||||
|
||||
|
|
@ -151,26 +130,19 @@ WriteLiteral(@">
|
|||
modules: {
|
||||
toolbar: toolbarOptions
|
||||
},
|
||||
placeholder: 'Composez votre texte ...',
|
||||
theme: 'snow'
|
||||
});
|
||||
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"") {
|
||||
$('#md').val(getMD());
|
||||
$('#btnSubmit').removeClass('hidden');
|
||||
function getMD() {
|
||||
return markdownize($('#bubble-container div.ql-editor').html())
|
||||
}
|
||||
});
|
||||
$(document).ready(function () {
|
||||
$('#btnSubmit').on('click', function () {
|
||||
$.get(""file:validate?md="" + encodeURIComponent(getMD()),
|
||||
function (data, stat, jqXHR) { $('#result').html(""Okay"") })
|
||||
})
|
||||
});
|
||||
quill.on('text-change', function (delta, oldDelta, source)
|
||||
{
|
||||
if (source === ""user"") {
|
||||
invokeCSharpAction(getMD());
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -2,25 +2,21 @@
|
|||
<!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:3em;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
|
@ -28,12 +24,10 @@
|
|||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="standalone-container">
|
||||
<div id="bubble-container">@Html.Write(Model)</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="jquery.js"></script>
|
||||
<script type="text/javascript" src="showdown.js"></script>
|
||||
|
|
@ -48,7 +42,7 @@
|
|||
[{ 'header': 1 }, { 'header': 2 }], // custom button values
|
||||
[{ 'list': 'ordered' }, { 'list': 'bullet' }],
|
||||
[{ 'indent': '-1' }, { 'indent': '+1' }], // outdent/indent
|
||||
|
||||
['link', 'image'],
|
||||
['clean'] // remove formatting button
|
||||
];
|
||||
|
||||
|
|
@ -56,26 +50,19 @@
|
|||
modules: {
|
||||
toolbar: toolbarOptions
|
||||
},
|
||||
placeholder: 'Composez votre texte ...',
|
||||
theme: 'snow'
|
||||
});
|
||||
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") {
|
||||
$('#md').val(getMD());
|
||||
$('#btnSubmit').removeClass('hidden');
|
||||
function getMD() {
|
||||
return markdownize($('#bubble-container div.ql-editor').html())
|
||||
}
|
||||
});
|
||||
$(document).ready(function () {
|
||||
$('#btnSubmit').on('click', function () {
|
||||
$.get("file:validate?md=" + encodeURIComponent(getMD()),
|
||||
function (data, stat, jqXHR) { $('#result').html("Okay") })
|
||||
})
|
||||
});
|
||||
quill.on('text-change', function (delta, oldDelta, source)
|
||||
{
|
||||
if (source === "user") {
|
||||
invokeCSharpAction(getMD());
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
</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
|
||||
{
|
||||
|
||||
class MarkdownWebViewClient : WebViewClient
|
||||
{
|
||||
Action<string> update;
|
||||
|
|
@ -25,7 +26,7 @@ namespace BookAStar.Droid
|
|||
}
|
||||
private static Activity getActivity ()
|
||||
{
|
||||
return (Activity)App.PlateformSpecificInstance;
|
||||
return (Activity)App.PlatformSpecificInstance;
|
||||
}
|
||||
public string Markdown { get; private set; }
|
||||
public override WebResourceResponse ShouldInterceptRequest(WebView view, IWebResourceRequest request)
|
||||
|
|
@ -34,6 +35,8 @@ namespace BookAStar.Droid
|
|||
{
|
||||
if (request.Url.Path=="/android_asset/validate")
|
||||
{
|
||||
// TODO Better,
|
||||
// by inspecting the form entries from the view
|
||||
Markdown = request.Url.GetQueryParameter("md");
|
||||
update(Markdown);
|
||||
return new WebResourceResponse("application/json", "utf-8" ,200, "Ok", null, null);
|
||||
|
|
@ -41,5 +44,6 @@ namespace BookAStar.Droid
|
|||
}
|
||||
return base.ShouldInterceptRequest(view, request);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -13,7 +13,7 @@ using Android.App;
|
|||
[assembly: AssemblyProduct("BookAStar.Droid")]
|
||||
[assembly: AssemblyCopyright("Copyright © Paul Albert Schneider 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: AssemblyCulture("fr")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 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;
|
||||
|
||||
// aapt resource value: 0x7f030025
|
||||
public const int mr_chooser_dialog = 2130903077;
|
||||
public const int EditEstimate = 2130903077;
|
||||
|
||||
// aapt resource value: 0x7f030026
|
||||
public const int mr_chooser_list_item = 2130903078;
|
||||
public const int mr_chooser_dialog = 2130903078;
|
||||
|
||||
// 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
|
||||
public const int mr_controller_volume_item = 2130903080;
|
||||
public const int mr_controller_material_dialog_b = 2130903080;
|
||||
|
||||
// aapt resource value: 0x7f030029
|
||||
public const int mr_playback_control = 2130903081;
|
||||
public const int mr_controller_volume_item = 2130903081;
|
||||
|
||||
// aapt resource value: 0x7f03002a
|
||||
public const int mr_volume_control = 2130903082;
|
||||
public const int mr_playback_control = 2130903082;
|
||||
|
||||
// aapt resource value: 0x7f03002b
|
||||
public const int notification_media_action = 2130903083;
|
||||
public const int mr_volume_control = 2130903083;
|
||||
|
||||
// aapt resource value: 0x7f03002c
|
||||
public const int notification_media_cancel_action = 2130903084;
|
||||
public const int notification_media_action = 2130903084;
|
||||
|
||||
// aapt resource value: 0x7f03002d
|
||||
public const int notification_template_big_media = 2130903085;
|
||||
public const int notification_media_cancel_action = 2130903085;
|
||||
|
||||
// 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
|
||||
public const int notification_template_lines = 2130903087;
|
||||
public const int notification_template_big_media_narrow = 2130903087;
|
||||
|
||||
// aapt resource value: 0x7f030030
|
||||
public const int notification_template_media = 2130903088;
|
||||
public const int notification_template_lines = 2130903088;
|
||||
|
||||
// aapt resource value: 0x7f030031
|
||||
public const int notification_template_part_chronometer = 2130903089;
|
||||
public const int notification_template_media = 2130903089;
|
||||
|
||||
// aapt resource value: 0x7f030032
|
||||
public const int notification_template_part_time = 2130903090;
|
||||
public const int notification_template_part_chronometer = 2130903090;
|
||||
|
||||
// aapt resource value: 0x7f030033
|
||||
public const int select_dialog_item_material = 2130903091;
|
||||
public const int notification_template_part_time = 2130903091;
|
||||
|
||||
// aapt resource value: 0x7f030034
|
||||
public const int select_dialog_multichoice_material = 2130903092;
|
||||
public const int select_dialog_item_material = 2130903092;
|
||||
|
||||
// aapt resource value: 0x7f030035
|
||||
public const int select_dialog_singlechoice_material = 2130903093;
|
||||
public const int select_dialog_multichoice_material = 2130903093;
|
||||
|
||||
// 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
|
||||
public const int Tabbar = 2130903095;
|
||||
public const int support_simple_spinner_dropdown_item = 2130903095;
|
||||
|
||||
// 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()
|
||||
{
|
||||
|
|
|
|||
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>
|
||||
<ResourceDictionary>
|
||||
<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="30" iOS="60" WinPhone="60" x:Key="MediumFontSize" />
|
||||
|
||||
<Color x:key="backgroundColor">#30FAFAFA</Color>
|
||||
<Color x:key="oddColor">#207AFAFA</Color>
|
||||
<Color x:key="textColor">#FF103010</Color>
|
||||
<Color x:key="labelColor">#FF303010</Color>
|
||||
<Style x:Key="labelStyle" TargetType="Label">
|
||||
<Setter Property="TextColor" Value="{DynamicResource labelColor}" />
|
||||
<Style x:Key="BigEntry" TargetType="Entry">
|
||||
<Setter Property="FontSize" Value="{DynamicResource LargeFontSize}" />
|
||||
<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="XAlign" Value="Center" />
|
||||
<Setter Property="LineBreakMode" Value="WordWrap" />
|
||||
|
||||
</Style>
|
||||
<Style x:Key="entryStyle" TargetType="Entry">
|
||||
<Setter Property="HorizontalOptions" Value="FillAndExpand"/>
|
||||
</Style>
|
||||
<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 x:Key="buttonStyle" TargetType="Button">
|
||||
<Setter Property="HorizontalOptions" Value="Center" />
|
||||
|
|
|
|||
|
|
@ -1,15 +1,11 @@
|
|||
using BookAStar.Model;
|
||||
using BookAStar.Model.Auth.Account;
|
||||
using BookAStar.Helpers;
|
||||
using BookAStar.Interfaces;
|
||||
using BookAStar.Model;
|
||||
using BookAStar.Model.Workflow;
|
||||
using BookAStar.Pages;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Xaml;
|
||||
/*
|
||||
Glyphish icons from
|
||||
http://www.glyphish.com/
|
||||
|
|
@ -22,41 +18,47 @@ namespace BookAStar
|
|||
{
|
||||
public partial class App : Application // superclass new in 1.3
|
||||
{
|
||||
SearchPage searchPage;
|
||||
NavigationPage mp;
|
||||
SettingsPage settingsPage;
|
||||
PinPage pinPage;
|
||||
ContentPage deviceInfoPage;
|
||||
BookQueryPage bookQueryPage;
|
||||
BookQueriesPage bookQueriesPage;
|
||||
public static IPlatform PlateformSpecificInstance { get; set; }
|
||||
SearchPage searchPage = new SearchPage
|
||||
{
|
||||
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 App CurrentApp { get { return Current as App; } }
|
||||
|
||||
public DataManager DataManager { get; set; }
|
||||
|
||||
public DataManager DataManager { get; set; } = new DataManager();
|
||||
|
||||
public App(IPlatform instance)
|
||||
{
|
||||
DataManager = new DataManager();
|
||||
deviceInfoPage = new DeviceInfoPage(instance.GetDeviceInfo());
|
||||
bookQueriesPage = new BookQueriesPage();
|
||||
|
||||
PlateformSpecificInstance = instance;
|
||||
searchPage = new SearchPage
|
||||
{
|
||||
Title = "Trouvez votre artiste",
|
||||
Icon = "glyphish_07_map_marker.png"
|
||||
};
|
||||
PlatformSpecificInstance = instance;
|
||||
mp = new NavigationPage(searchPage);
|
||||
settingsPage = new SettingsPage
|
||||
{
|
||||
Title = "Settings",
|
||||
Icon = "ic_corp_icon.png"
|
||||
};
|
||||
|
||||
var r = this.Resources;
|
||||
//var hasLabelStyle = r.ContainsKey("labelStyle");
|
||||
|
||||
// var stid = this.StyleId;
|
||||
// null var appsstyle = settingsPage.Style;
|
||||
// appsstyle.CanCascade = true;
|
||||
|
|
@ -69,24 +71,16 @@ namespace BookAStar
|
|||
mp.ToolbarItems.Add(tiSetts);
|
||||
tiSetts.Clicked += (object sender, EventArgs e) =>
|
||||
{
|
||||
if (settingsPage.Parent == null)
|
||||
mp.Navigation.PushAsync(settingsPage);
|
||||
else
|
||||
{
|
||||
settingsPage.Focus();
|
||||
}
|
||||
ShowPage (settingsPage);
|
||||
};
|
||||
ToolbarItem tiQueries = new ToolbarItem
|
||||
{
|
||||
Text = "Demandes"
|
||||
};
|
||||
|
||||
|
||||
tiQueries.Clicked += (object sender, EventArgs e) =>
|
||||
{
|
||||
if (bookQueriesPage.Parent == null)
|
||||
mp.Navigation.PushAsync(bookQueriesPage);
|
||||
else bookQueriesPage.Focus();
|
||||
ShowPage (bookQueriesPage);
|
||||
};
|
||||
mp.ToolbarItems.Add(tiQueries);
|
||||
ToolbarItem tiMap = new ToolbarItem
|
||||
|
|
@ -95,41 +89,46 @@ namespace BookAStar
|
|||
Icon = "glyphish_07_map_marker.png"
|
||||
};
|
||||
mp.ToolbarItems.Add(tiMap);
|
||||
pinPage = new PinPage
|
||||
{
|
||||
Title = "Carte",
|
||||
Icon = "glyphish_07_map_marker.png"
|
||||
};
|
||||
tiMap.Clicked += (object sender, EventArgs e) =>
|
||||
{
|
||||
if (pinPage.Parent == null)
|
||||
mp.Navigation.PushAsync(pinPage);
|
||||
else pinPage.Focus();
|
||||
|
||||
ShowPage(pinPage);
|
||||
};
|
||||
|
||||
bookQueriesPage.BindingContext = DataManager.BookQueries;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void ShowDeviceInfo()
|
||||
{
|
||||
if (deviceInfoPage.Parent == null)
|
||||
mp.Navigation.PushAsync(deviceInfoPage);
|
||||
else deviceInfoPage.Focus();
|
||||
ShowPage(deviceInfoPage);
|
||||
}
|
||||
|
||||
public void PostDeviceInfo()
|
||||
{
|
||||
var res = PlateformSpecificInstance.InvokeApi(
|
||||
var res = PlatformSpecificInstance.InvokeApi(
|
||||
"gcm/register",
|
||||
PlateformSpecificInstance.GetDeviceInfo());
|
||||
PlatformSpecificInstance.GetDeviceInfo());
|
||||
}
|
||||
|
||||
public void ShowBookQuery(BookQueryData data)
|
||||
{
|
||||
bookQueriesPage.BindingContext = data;
|
||||
mp.Navigation.PushAsync(bookQueriesPage);
|
||||
bookQueryPage.BindingContext = data;
|
||||
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()
|
||||
{
|
||||
mp.Navigation.PopAsync();
|
||||
|
|
|
|||
|
|
@ -38,8 +38,12 @@
|
|||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</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="Interfaces\IMDEditor.cs" />
|
||||
<Compile Include="Model\ClientProviderInfo.cs" />
|
||||
<Compile Include="Pages\BlogPage.cs" />
|
||||
<Compile Include="Pages\BookQueriesPage.xaml.cs">
|
||||
<DependentUpon>BookQueriesPage.xaml</DependentUpon>
|
||||
|
|
@ -53,7 +57,7 @@
|
|||
</Compile>
|
||||
<Compile Include="Helpers\MainSettings.cs" />
|
||||
<Compile Include="Helpers\RemoteEntity.cs" />
|
||||
<Compile Include="IPlatform.cs" />
|
||||
<Compile Include="Interfaces\IPlatform.cs" />
|
||||
<Compile Include="Pages\MainPage.xaml.cs">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
|
@ -96,8 +100,8 @@
|
|||
<Compile Include="Model\Auth\Tokens.cs" />
|
||||
<Compile Include="Model\Auth\User.cs" />
|
||||
<Compile Include="Model\Workflow\Estimate.cs" />
|
||||
<Compile Include="Pages\MakeAnEstimatePage.xaml.cs">
|
||||
<DependentUpon>MakeAnEstimatePage.xaml</DependentUpon>
|
||||
<Compile Include="Pages\EditEstimatePage.xaml.cs">
|
||||
<DependentUpon>EditEstimatePage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\MarkdownEditorPage.xaml.cs">
|
||||
<DependentUpon>MarkdownEditorPage.xaml</DependentUpon>
|
||||
|
|
@ -105,9 +109,6 @@
|
|||
<Compile Include="Pages\PinPage.cs" />
|
||||
<Compile Include="Views\MarkdownView.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Pages\QueriesPage.xaml.cs">
|
||||
<DependentUpon>QueriesPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\SearchPage.xaml.cs">
|
||||
<DependentUpon>SearchPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
|
@ -198,12 +199,6 @@
|
|||
<Name>Yavsc.Client</Name>
|
||||
</ProjectReference>
|
||||
</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>
|
||||
|
|
@ -211,7 +206,7 @@
|
|||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Pages\MakeAnEstimatePage.xaml">
|
||||
<EmbeddedResource Include="Pages\EditEstimatePage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
|
|
@ -222,6 +217,9 @@
|
|||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="icon-anon.png" />
|
||||
</ItemGroup>
|
||||
<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')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
|
|
|
|||
|
|
@ -3,12 +3,44 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace BookAStar
|
||||
{
|
||||
public static class Constants
|
||||
{
|
||||
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.Threading.Tasks;
|
||||
|
||||
namespace BookAStar
|
||||
namespace BookAStar.Helpers
|
||||
{
|
||||
using Model;
|
||||
using Model.Blog;
|
||||
|
|
@ -13,9 +13,11 @@ namespace BookAStar
|
|||
public class DataManager
|
||||
{
|
||||
// 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<Blog, long> Blogspot { get; set; }
|
||||
public LocalEntity<ClientProviderInfo,string> Contacts { get; set; }
|
||||
|
||||
public static DataManager Current
|
||||
{
|
||||
get
|
||||
|
|
@ -23,15 +25,18 @@ namespace BookAStar
|
|||
return App.CurrentApp.DataManager;
|
||||
}
|
||||
}
|
||||
|
||||
public DataManager()
|
||||
{
|
||||
BookQueries = new RemoteEntity<BookQueryData, long>("bookquery",
|
||||
BookQueries = new RemoteEntityRO<BookQueryData, long>("bookquery",
|
||||
q => q.Id);
|
||||
Estimates = new RemoteEntity<Estimate, long>("estimate",
|
||||
x => x.Id);
|
||||
Blogspot = new RemoteEntity<Blog, long>("blog",
|
||||
x=>x.Id);
|
||||
Contacts = new LocalEntity<ClientProviderInfo, string>(c => c.UserId);
|
||||
}
|
||||
|
||||
public async Task<BookQueryData> GetBookQuery(long bookQueryId)
|
||||
{
|
||||
return await BookQueries.Get(bookQueryId);
|
||||
|
|
@ -204,11 +204,5 @@ namespace BookAStar
|
|||
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
|
||||
{
|
||||
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;
|
||||
public event EventHandler CanExecuteChanged;
|
||||
public bool IsExecuting { get; private set; }
|
||||
private HttpClient client;
|
||||
|
||||
private Uri controllerUri;
|
||||
protected Func<V, K> GetKey { get; set; }
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
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();
|
||||
_controller = controllerName;
|
||||
GetKey = getKey;
|
||||
client = new HttpClient();
|
||||
controllerUri = new Uri(MainSettings.YavscApiUrl + "/" + _controller);
|
||||
controllerUri = new Uri(Constants.YavscApiUrl + "/" + _controller);
|
||||
}
|
||||
|
||||
private void BeforeExecute()
|
||||
|
|
@ -49,38 +69,30 @@ namespace BookAStar
|
|||
{
|
||||
BeforeExecute();
|
||||
// Update credentials
|
||||
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(
|
||||
"Bearer", MainSettings.CurrentUser.YavscTokens.AccessToken);
|
||||
// Get the whole data
|
||||
|
||||
var response = await client.GetAsync(controllerUri);
|
||||
if (response.IsSuccessStatusCode)
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
List<V> col = JsonConvert.DeserializeObject<List<V>>(content);
|
||||
// LocalData.Clear();
|
||||
foreach (var item in col)
|
||||
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(
|
||||
"Bearer", MainSettings.CurrentUser.YavscTokens.AccessToken);
|
||||
// Get the whole data
|
||||
|
||||
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();
|
||||
}
|
||||
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()
|
||||
{
|
||||
|
|
@ -96,13 +108,18 @@ namespace BookAStar
|
|||
// Get the whole data
|
||||
var uri = new Uri(controllerUri.AbsolutePath+"/"+key.ToString());
|
||||
|
||||
var response = await client.GetAsync(uri);
|
||||
if (response.IsSuccessStatusCode)
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
item = JsonConvert.DeserializeObject<V>(content);
|
||||
// LocalData.Clear();
|
||||
UpdateOrAdd(item);
|
||||
using (var response = await client.GetAsync(uri))
|
||||
{
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
item = JsonConvert.DeserializeObject<V>(content);
|
||||
// LocalData.Clear();
|
||||
Merge(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AfterExecuting();
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@ using System.Threading.Tasks;
|
|||
|
||||
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,
|
||||
Func<V,K> getKey) : base(controllerName,getKey)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void UpdateOrAdd(V item)
|
||||
public override void Merge(V item)
|
||||
{
|
||||
var key = GetKey(item);
|
||||
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 Yavsc.Models.Identity;
|
||||
|
||||
namespace BookAStar
|
||||
namespace BookAStar.Interfaces
|
||||
{
|
||||
public interface IPlatform
|
||||
{
|
||||
void OpenWeb (string Uri);
|
||||
|
||||
// TODO Better
|
||||
|
||||
string GCMStatusMessage { get; }
|
||||
|
||||
bool EnablePushNotifications (bool enable);
|
||||
|
|
@ -24,8 +23,6 @@ namespace BookAStar
|
|||
TAnswer InvokeApi<TAnswer>(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
|
||||
{
|
||||
public class ClientProviderInfo
|
||||
{
|
||||
public string UserName { get; set; }
|
||||
public string UserId { get; set; }
|
||||
public int Rate { get; set; }
|
||||
}
|
||||
public class BookQueryData
|
||||
{
|
||||
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; }
|
||||
}
|
||||
}
|
||||
|
|
@ -5,17 +5,14 @@ using System.Collections.ObjectModel;
|
|||
using System.Windows.Input;
|
||||
|
||||
namespace BookAStar
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
[Obsolete("Use Helpers.DataManager")]
|
||||
public static class Manager
|
||||
{
|
||||
static Manager ()
|
||||
{
|
||||
}
|
||||
|
||||
public static ICommand RefreshBookQueries;
|
||||
// TODO WIP TEST rop this
|
||||
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 string Address { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class LocalizedEvent : YaEvent
|
||||
public class LocalizedEvent : YaEvent
|
||||
{
|
||||
|
||||
|
||||
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.Threading.Tasks;
|
||||
|
||||
namespace BookAStar.Model.Workflow
|
||||
{
|
||||
public partial class Estimate
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
public long? CommandId { get; set; }
|
||||
public string CommandType { get; set; }
|
||||
// Markdown expected
|
||||
public string Description { get; set; }
|
||||
public int? Status { get; set; }
|
||||
public string Title { get; set; }
|
||||
|
|
@ -23,7 +27,7 @@ namespace BookAStar.Model.Workflow
|
|||
|
||||
public string AttachedGraphicsString
|
||||
{
|
||||
get { return string.Join(":", AttachedGraphicList); }
|
||||
get { return AttachedGraphicList==null?null:string.Join(":", AttachedGraphicList); }
|
||||
set { AttachedGraphicList = value.Split(':').ToList(); }
|
||||
}
|
||||
/// <summary>
|
||||
|
|
@ -36,12 +40,32 @@ namespace BookAStar.Model.Workflow
|
|||
public List<string> AttachedFiles { get; set; }
|
||||
public string AttachedFilesString
|
||||
{
|
||||
get { return string.Join(":", AttachedFiles); }
|
||||
get { return AttachedFiles == null ? null : string.Join(":", AttachedFiles); }
|
||||
set { AttachedFiles = value.Split(':').ToList(); }
|
||||
}
|
||||
|
||||
public string OwnerId { 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();
|
||||
_sourceTitle = new HtmlWebViewSource();
|
||||
_md = new MarkdownDeep.Markdown();
|
||||
_sourceTitle.BaseUrl = _source.BaseUrl = MainSettings.YavscHomeUrl;
|
||||
_sourceTitle.BaseUrl = _source.BaseUrl = Constants.YavscHomeUrl;
|
||||
_sourceTitle.Html = "Hello";
|
||||
titleLabel = new WebView { Source = _sourceTitle };
|
||||
contentView = new WebView { Source = _source };
|
||||
|
|
|
|||
|
|
@ -1,40 +1,50 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:local="clr-namespace:BookAStar.Views;assembly=BookAStar"
|
||||
x:Class="BookAStar.Pages.BookQueriesPage">
|
||||
<StackLayout>
|
||||
xmlns:local="clr-namespace:BookAStar;assembly=BookAStar"
|
||||
x:Class="BookAStar.Pages.BookQueriesPage"
|
||||
Padding="{x:Static local:Constants.PagePadding}"
|
||||
BackgroundColor="{x:Static local:Constants.BackgroundColor}"
|
||||
>
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
|
||||
<ListView x:Name="list"
|
||||
HasUnevenRows="true" ItemTapped="OnViewDetail">
|
||||
<ListView.ItemTemplate>
|
||||
<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 Padding="10,10,10,10">
|
||||
|
||||
<ListView x:Name="list" ItemTapped="OnViewDetail" HasUnevenRows="true" RowHeight="80">
|
||||
<ListView.ItemTemplate HeightRequest="80" VerticalOptions="StartAndExpand">
|
||||
<DataTemplate>
|
||||
<ViewCell>
|
||||
<ViewCell.View>
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<Label Text="{Binding Title}" FontSize="12"/>
|
||||
<Label Text="{Binding Description}"/>
|
||||
<Label Text="{Binding Comment}"/>
|
||||
<Label Text="{Binding CommandId}"/>
|
||||
|
||||
<StackLayout Orientation="Horizontal">
|
||||
|
||||
<StackLayout>
|
||||
<Label Text="Date:" FontAttributes="Italic"/>
|
||||
<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 Orientation="Horizontal" Padding="10,10,10,10" VerticalOptions="StartAndExpand">
|
||||
<StackLayout Orientation="Vertical" BackgroundColor="{x:Static local:Constants.OddBackgroundColor}"
|
||||
HeightRequest="80" VerticalOptions="StartAndExpand">
|
||||
|
||||
<StackLayout Orientation="Vertical" >
|
||||
<Image Source="{Binding Client.Avatar}" />
|
||||
<Label Text="{Binding Client.UserName}"
|
||||
Style="{StaticResource labelStyle}"></Label>
|
||||
</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>
|
||||
</ViewCell.View>
|
||||
</ViewCell>
|
||||
|
|
|
|||
|
|
@ -15,10 +15,11 @@ namespace BookAStar.Pages
|
|||
public BookQueriesPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
BindingContext = App.CurrentApp.DataManager.BookQueries;
|
||||
}
|
||||
protected override void OnBindingContextChanged()
|
||||
{
|
||||
list.ItemsSource = BindingContext as ObservableCollection<BookQueryData>;
|
||||
list.RefreshCommand = BindingContext as ICommand;
|
||||
list.IsPullToRefreshEnabled = true;
|
||||
base.OnBindingContextChanged();
|
||||
}
|
||||
|
||||
public RemoteEntity<BookQueryData,long> Queries
|
||||
|
|
@ -40,7 +41,6 @@ namespace BookAStar.Pages
|
|||
{
|
||||
BookQueryData data = e.Item as BookQueryData;
|
||||
App.CurrentApp.ShowBookQuery(data);
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,35 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
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"
|
||||
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">
|
||||
|
||||
|
||||
<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 Location}" VerticalOptions="Center" HorizontalOptions="Center" />
|
||||
<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 Location.Address}" VerticalOptions="Center" HorizontalOptions="Center" />
|
||||
<maps:Map x:Name="map"></maps:Map>
|
||||
<Button Text="Faire un devis" Clicked="MakeAnEstimate" VerticalOptions="Center" HorizontalOptions="End"/>
|
||||
</StackLayout>
|
||||
<Button Text="Faire un devis" Clicked="MakeAnEstimate" VerticalOptions="Center" HorizontalOptions="End"/>
|
||||
</StackLayout>
|
||||
</ContentPage>
|
||||
|
|
@ -6,7 +6,9 @@ using Xamarin.Forms.Maps;
|
|||
|
||||
namespace BookAStar.Pages
|
||||
{
|
||||
using Helpers;
|
||||
using Model;
|
||||
using Model.Workflow;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public partial class BookQueryPage : ContentPage
|
||||
|
|
@ -43,8 +45,9 @@ namespace BookAStar.Pages
|
|||
map.MoveToRegion(MapSpan.FromCenterAndRadius(
|
||||
new Position(lat, lon), Distance.FromMeters(100)));
|
||||
}
|
||||
|
||||
}
|
||||
public BookQueryPage(BookQueryData bookQuery)
|
||||
public BookQueryPage(BookQueryData bookQuery=null)
|
||||
{
|
||||
|
||||
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;
|
||||
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" >
|
||||
<ContentPage.Content>
|
||||
<StackLayout>
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Label Text="Utiliser ma position" />
|
||||
<Switch x:Name="use_my_pos" HorizontalOptions="End" />
|
||||
</StackLayout>
|
||||
|
||||
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Editor x:Name="search_phrase" HorizontalOptions="FillAndExpand"/>
|
||||
|
|
@ -19,7 +16,6 @@
|
|||
|
||||
<ListView x:Name="list" ItemsSource="{x:Static local:Manager.Events}"
|
||||
HasUnevenRows="true">
|
||||
s
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ViewCell>
|
||||
|
|
|
|||
|
|
@ -30,9 +30,10 @@ BindingContext="." >
|
|||
<ListView.ItemTemplate HeightRequest="60" VerticalOptions="StartAndExpand">
|
||||
<DataTemplate>
|
||||
<ViewCell>
|
||||
<Grid Padding="0"
|
||||
<Grid Padding="5"
|
||||
ColumnSpacing="10"
|
||||
RowSpacing="0">
|
||||
RowSpacing="2">
|
||||
<Image Source="{Binding Avatar}" HeightRequest="80" />
|
||||
<Label Grid.Column="0" Text="{Binding UserName}" />
|
||||
</Grid>
|
||||
</ViewCell>
|
||||
|
|
@ -42,10 +43,18 @@ BindingContext="." >
|
|||
|
||||
</ListView>
|
||||
|
||||
|
||||
|
||||
<StackLayout Orientation="Horizontal" VerticalOptions="Start">
|
||||
<Label Text="Recevoir les notifications push" StyleClass="Header"/>
|
||||
<Label Text="Recevoir les notifications push" />
|
||||
<Switch x:Name="pushstatus" />
|
||||
</StackLayout>
|
||||
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Label Text="Utiliser ma position" />
|
||||
<Switch x:Name="use_my_pos" HorizontalOptions="End" />
|
||||
</StackLayout>
|
||||
|
||||
|
||||
<StackLayout Orientation="Horizontal" VerticalOptions="Start">
|
||||
<Label Text="Recevoir les demandes de devis de la part de professionnels uniquement"
|
||||
|
|
@ -53,6 +62,5 @@ BindingContext="." >
|
|||
<Switch x:Name="restrictToPro" />
|
||||
</StackLayout>
|
||||
|
||||
<Button x:Name="BtnViewDeviceInfo" Text="Device info" StyleClass="Info"></Button>
|
||||
</StackLayout>
|
||||
</ContentPage>
|
||||
|
|
|
|||
|
|
@ -33,13 +33,7 @@ namespace BookAStar
|
|||
AccountListView.ItemSelected += Accounts_ItemSelected;
|
||||
|
||||
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)
|
||||
|
|
@ -64,7 +58,7 @@ namespace BookAStar
|
|||
var doIt = await Confirm("Suppression de l'identification",
|
||||
$"Vous êtes sur le point de supprimer votre identification pour ce compte : {user.UserName}\nContinuer ?");
|
||||
if (doIt)
|
||||
App.PlateformSpecificInstance.RevokeAccount(user.UserName);
|
||||
App.PlatformSpecificInstance.RevokeAccount(user.UserName);
|
||||
}
|
||||
|
||||
async Task<bool> Confirm(string title, string procedure)
|
||||
|
|
@ -84,7 +78,7 @@ namespace BookAStar
|
|||
|
||||
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: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyCompany("Paul Schneider")]
|
||||
[assembly: AssemblyProduct("BookAStar")]
|
||||
[assembly: AssemblyCopyright("Copyright © Paul Albert Schneider 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: AssemblyTrademark("Yavsc")]
|
||||
[assembly: AssemblyCulture("fr")]
|
||||
[assembly: NeutralResourcesLanguage("fr")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
|
|
|
|||
|
|
@ -1,14 +1,15 @@
|
|||
using System;
|
||||
using BookAStar.Interfaces;
|
||||
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
|
||||
public class MarkdownView : View
|
||||
{
|
||||
public static readonly BindableProperty MarkdownProperty = BindableProperty.Create(
|
||||
"Markdown", typeof(string), typeof(MarkdownView), null, BindingMode.TwoWay
|
||||
|
|
@ -23,25 +24,20 @@ namespace BookAStar.Views
|
|||
return markdown;
|
||||
}
|
||||
set {
|
||||
markdown = value;
|
||||
Content = App.PlateformSpecificInstance.CreateMarkdownView(
|
||||
markdown,
|
||||
e => {
|
||||
Markdown = e;
|
||||
if (Validated != null)
|
||||
Validated.Invoke(this, new EventArgs());
|
||||
if (markdown != value)
|
||||
if (Edited != null)
|
||||
{
|
||||
markdown = value;
|
||||
Edited.Invoke(this, new EventArgs());
|
||||
return;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
markdown = value;
|
||||
}
|
||||
}
|
||||
|
||||
public MarkdownView() : base()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public event EventHandler Validated;
|
||||
|
||||
|
||||
public event EventHandler<EventArgs> Edited;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
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