diff --git a/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj.user b/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj.user index 84b624c1..76cb4dfa 100644 --- a/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj.user +++ b/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj.user @@ -2,6 +2,7 @@ Nexus 4 + Android_Accelerated_x86 C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v6.0\ diff --git a/BookAStar/BookAStar.Droid/MarkdownRazorWebViewClient.cs b/BookAStar/BookAStar.Droid/MarkdownRazorWebViewClient.cs new file mode 100644 index 00000000..8cd6642d --- /dev/null +++ b/BookAStar/BookAStar.Droid/MarkdownRazorWebViewClient.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using Android.App; +using Android.Content; +using Android.OS; +using Android.Runtime; +using Android.Views; +using Android.Widget; +using Android.Webkit; +using Java.Lang; +using Java.IO; +using Android.Content.Res; + +namespace BookAStar.Droid +{ + class MarkdownRazorWebViewClient : WebViewClient + { + Context context; + public MarkdownRazorWebViewClient(Context context) + { + this.context = context; + } + + + private WebResourceResponse getWebResourceResponseFromAssets(string name) + { + var desc = + getActivity().Assets.OpenFd(name); + var stream = desc.CreateInputStream(); + string encoding = null; + string mimet = "text/html"; + if (name.EndsWith(".css")) + { + mimet = "text/css"; + encoding = "utf-8"; + } + else if (name.EndsWith(".js")) + { mimet = "text/js"; + encoding = "utf-8"; + } + else if (name.EndsWith(".ico")) + { mimet = "image/ico"; + encoding = "utf-8"; + } + + return new WebResourceResponse(mimet, encoding, stream ); + + } + private static Activity getActivity () + { + return (Activity)App.PlateformSpecificInstance; + } + public override WebResourceResponse ShouldInterceptRequest(WebView view, IWebResourceRequest request) + { + + if (request.Url.Scheme=="file") + { + return getWebResourceResponseFromAssets(request.Url.Path); + } + if (request.Url.Scheme=="hybrid") + { + getActivity().RunOnUiThread( + () => testGetContent(view)); + } + return base.ShouldInterceptRequest(view, request); + } + + class ContentCallBack : Java.Lang.Object, IValueCallback + { + public string Result { get; private set; } + public void OnReceiveValue(Java.Lang.Object value) + { + if (value == null) { Result = null; } + else { Result = new string(((Java.Lang.String)value).ToCharArray()); } + } + } + + void testGetContent(WebView view) + { + var cb = new ContentCallBack(); + view.EvaluateJavascript("$('#Content').val()", cb); + } + + } +} \ No newline at end of file diff --git a/BookAStar/BookAStar.Droid/Resources/Resource.Designer.cs b/BookAStar/BookAStar.Droid/Resources/Resource.Designer.cs index 666ea72b..2c444114 100644 --- a/BookAStar/BookAStar.Droid/Resources/Resource.Designer.cs +++ b/BookAStar/BookAStar.Droid/Resources/Resource.Designer.cs @@ -3310,9 +3310,6 @@ namespace BookAStar.Droid // aapt resource value: 0x7f06004b public const int Description = 2131099723; - // aapt resource value: 0x7f060052 - public const int GoogleSenderId = 2131099730; - // aapt resource value: 0x7f06004d public const int Location = 2131099725; diff --git a/BookAStar/BookAStar.Droid/Resources/values/strings.xml b/BookAStar/BookAStar.Droid/Resources/values/strings.xml index 6a6441b0..a5f60829 100644 --- a/BookAStar/BookAStar.Droid/Resources/values/strings.xml +++ b/BookAStar/BookAStar.Droid/Resources/values/strings.xml @@ -13,5 +13,4 @@ url url_hint picture - AA325408689282 diff --git a/BookAStar/BookAStar.Droid/Services/GcmListenerService.cs b/BookAStar/BookAStar.Droid/Services/GcmListenerService.cs index 7033ba05..f48c44de 100644 --- a/BookAStar/BookAStar.Droid/Services/GcmListenerService.cs +++ b/BookAStar/BookAStar.Droid/Services/GcmListenerService.cs @@ -1,14 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using Android.App; -using Android.Content; -using Android.OS; -using Android.Runtime; -using Android.Views; -using Android.Widget; namespace BookAStar.Droid.Services { @@ -16,37 +6,122 @@ namespace BookAStar.Droid.Services using Android.Content; using Android.OS; using Android.Gms.Gcm; - using Android.Util; + using Model.Social; + using Newtonsoft.Json; + using Model; namespace ClientApp { [Service(Exported = false), IntentFilter(new[] { "com.google.android.c2dm.intent.RECEIVE" })] public class MyGcmListenerService : GcmListenerService { + private Notification.Builder notificationBuilder; + + NotificationManager notificationManager; + + public override void OnCreate() + { + base.OnCreate(); + notificationBuilder = new Notification.Builder(this) + .SetSmallIcon(Resource.Drawable.icon) + .SetAutoCancel(true); + notificationManager = (NotificationManager)GetSystemService(Context.NotificationService); + + } + + public override void OnDestroy() + { + base.OnDestroy(); + notificationManager.Dispose(); + notificationManager = null; + notificationBuilder.Dispose(); + notificationBuilder = null; + } + public override void OnMessageReceived(string from, Bundle data) { - var message = data.GetString("message"); - Log.Debug("MyGcmListenerService", "From: " + from); - Log.Debug("MyGcmListenerService", "Message: " + message); - SendNotification(message); + var topic = data.GetString("Topic"); + if (topic == "BookQuery") + { + DateTime startdate,enddate; + + var sdatestr = data.GetString("StartDate"); + DateTime.TryParse(sdatestr, out startdate); + + var enddatestr = data.GetString("EndDate"); + DateTime.TryParse(enddatestr, out enddate); + + var locationJson = data.GetString("Location"); + var location = JsonConvert.DeserializeObject(locationJson); + var cid = long.Parse(data.GetString("CommandId")); + var bq = new BookQueryData + { + Title = data.GetString("Title"), + Description = data.GetString("Description"), + Comment = data.GetString("Comment"), + StartDate = startdate, + EndDate = enddate, + CommandId = cid, + Address = location + }; + + SendBookQueryNotification(bq); + } + else + { + throw new NotImplementedException(topic); + } } - void SendNotification(string message) + void SendNotification(string title, string message) { var intent = new Intent(this, typeof(MainActivity)); intent.AddFlags(ActivityFlags.ClearTop); + var pendingIntent = PendingIntent.GetActivity(this, 0, intent, PendingIntentFlags.OneShot); var notificationBuilder = new Notification.Builder(this) .SetSmallIcon(Resource.Drawable.icon) - .SetContentTitle("GCM Message") + .SetContentTitle(title) .SetContentText(message) .SetAutoCancel(true) .SetContentIntent(pendingIntent); - var notificationManager = (NotificationManager)GetSystemService(Context.NotificationService); notificationManager.Notify(0, notificationBuilder.Build()); } + + void SendBookQueryNotification(BookQueryData bquery) + { + var bookquerynotifications = MainSettings.AddBookQueryNotification(bquery); + var count = bookquerynotifications.Length; + var multiple = count > 1; + var title = + multiple ? $"{count} demandes" : bquery.Title; + var message = bquery.Description; + + var intent = new Intent(this, typeof(MainActivity)); + intent.AddFlags(ActivityFlags.ClearTop); + intent.PutExtra("BookQueryId", bquery.CommandId); + + var pendingIntent = PendingIntent.GetActivity(this, 0, intent, PendingIntentFlags.OneShot); + Notification.InboxStyle inboxStyle = new Notification.InboxStyle(); + int maxil = 5; + for (int cn = 0; cn < count && cn < maxil; cn++) + { + inboxStyle.AddLine(bookquerynotifications[cn].Description); + } + if (count > maxil) + inboxStyle.SetSummaryText($"Plus {count - maxil} autres"); + else inboxStyle.SetSummaryText((string)null); + notificationBuilder.SetContentTitle(title).SetContentText(message) + .SetStyle(inboxStyle) + .SetContentIntent(pendingIntent); + + var notification = notificationBuilder.Build(); + notificationManager.Notify(bookQueryNotificationId, notification ); + } + + int bookQueryNotificationId=1; } } } \ No newline at end of file diff --git a/BookAStar/BookAStar/App.xaml b/BookAStar/BookAStar/App.xaml index 643e7e9f..a92e358b 100644 --- a/BookAStar/BookAStar/App.xaml +++ b/BookAStar/BookAStar/App.xaml @@ -34,10 +34,6 @@ - diff --git a/BookAStar/BookAStar/App.xaml.cs b/BookAStar/BookAStar/App.xaml.cs index 5f294941..8c6bcd19 100644 --- a/BookAStar/BookAStar/App.xaml.cs +++ b/BookAStar/BookAStar/App.xaml.cs @@ -8,7 +8,6 @@ using System.Text; using System.Threading.Tasks; using Xamarin.Forms; using Xamarin.Forms.Xaml; -using Yavsc.Helpers; /* Glyphish icons from http://www.glyphish.com/ @@ -29,8 +28,12 @@ namespace BookAStar public static IPlatform PlateformSpecificInstance { get; set; } public static string AppName { get; set; } public static App CurrentApp { get { return Current as App; } } + + public DataManager DataManager { get; set; } + public App (IPlatform instance) { + DataManager = new DataManager(); deviceInfoPage = new DeviceInfoPage(instance.GetDeviceInfo()); PlateformSpecificInstance = instance; @@ -60,7 +63,15 @@ namespace BookAStar settingsPage.Focus(); } }; - ToolbarItem tiMap = new ToolbarItem { Text = "Carte", + ToolbarItem tiQueries = new ToolbarItem + { + Text = "Demandes" + }; + tiQueries.Clicked += (object sender, EventArgs e) => { + mp.Navigation.PushAsync(new Pages.MakeAnEstimatePage()); + }; + mp.ToolbarItems.Add(tiQueries); + ToolbarItem tiMap = new ToolbarItem { Text = "Carte", Icon = "glyphish_07_map_marker.png" }; mp.ToolbarItems.Add (tiMap); @@ -73,7 +84,7 @@ namespace BookAStar else pinPage.Focus(); }; - + } public void ShowDeviceInfo() @@ -90,6 +101,10 @@ namespace BookAStar PlateformSpecificInstance.GetDeviceInfo()); } + public void ShowBookQuery(long queryId) + { + mp.Navigation.PushAsync(new BookQueryPage(queryId)); + } } } diff --git a/BookAStar/BookAStar/BookAStar.csproj b/BookAStar/BookAStar/BookAStar.csproj index 37081a4e..21bc8cc7 100644 --- a/BookAStar/BookAStar/BookAStar.csproj +++ b/BookAStar/BookAStar/BookAStar.csproj @@ -38,18 +38,26 @@ App.xaml - - + + + + BookQueryPage.xaml + + + EventDetail.xaml - + - + MainPage.xaml + + + @@ -83,18 +91,29 @@ - + + + MakeAnEstimatePage.xaml + + + MarkdownEditorPage.xaml + + + - + + QueriesPage.xaml + + SearchPage.xaml - + SettingsPage.xaml - + Designer MSBuild:UpdateDesignTimeXaml @@ -109,26 +128,29 @@ - + MSBuild:UpdateDesignTimeXaml Designer - + MSBuild:UpdateDesignTimeXaml Designer - + MSBuild:UpdateDesignTimeXaml Designer - + ..\..\packages\Json.NET.Web.1.0.49\lib\portable45-net45+win8+wpa81\Json.NET.Web.dll + + ..\..\packages\MarkdownDeep-av.NET.1.5.2\lib\net451\MarkdownDeep.dll + ..\..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v6.0\Mono.Android.dll @@ -160,12 +182,36 @@ True + + + MSBuild:UpdateDesignTimeXaml + Designer + + - {67F9D3A8-F71E-4428-913F-C37AE82CDB24} + {67f9d3a8-f71e-4428-913f-c37ae82cdb24} Yavsc.Client + + + MSBuild:UpdateDesignTimeXaml + Designer + + + + + MSBuild:UpdateDesignTimeXaml + Designer + + + + + MSBuild:UpdateDesignTimeXaml + Designer + + diff --git a/BookAStar/BookAStar/DataManager.cs b/BookAStar/BookAStar/DataManager.cs new file mode 100644 index 00000000..d499cc92 --- /dev/null +++ b/BookAStar/BookAStar/DataManager.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BookAStar +{ + using Model; + using Model.Blog; + using Model.Workflow; + + public class DataManager + { + public RemoteEntity BookQueries { get; set; } + public RemoteEntity Estimates { get; set; } + public RemoteEntity Blogspot { get; set; } + + public DataManager() + { + BookQueries = new RemoteEntity("bookqueries", + q => q.CommandId); + Estimates = new RemoteEntity("estimates", + x => x.Id); + Blogspot = new RemoteEntity("blogspot", + x=>x.Id); + } + public async Task GetBookQuery(long bookQueryId) + { + return await BookQueries.Get(bookQueryId); + } + } +} diff --git a/BookAStar/BookAStar/Helpers/MainSettings.cs b/BookAStar/BookAStar/Helpers/MainSettings.cs index ab1e0acf..68ec1aec 100644 --- a/BookAStar/BookAStar/Helpers/MainSettings.cs +++ b/BookAStar/BookAStar/Helpers/MainSettings.cs @@ -1,4 +1,5 @@ // Helpers/Settings.cs +using BookAStar.Model; using BookAStar.Model.Auth.Account; using Newtonsoft.Json; using Plugin.Settings; @@ -58,7 +59,6 @@ namespace BookAStar }; private static readonly Dictionary environ = new Dictionary(); - public static readonly string YavscApiUrl = "http://dev.pschneider.fr/api"; #endregion @@ -68,6 +68,25 @@ namespace BookAStar return AppSettings.GetValueOrDefault(userNameKey, null); } } + public const string bookQueryNotificationsKey = "BookQueryNotifications"; + public static BookQueryData[] GetBookQueryNotifications() + { + // Do not return any null List + var json = AppSettings.GetValueOrDefault(bookQueryNotificationsKey); + if (!string.IsNullOrWhiteSpace(json)) + return JsonConvert.DeserializeObject(json); + return new BookQueryData[] {}; + } + + public static BookQueryData[] AddBookQueryNotification(BookQueryData query) + { + var existing = new List(GetBookQueryNotifications()); + existing.Add(query); + var result = existing.ToArray(); + AppSettings.AddOrUpdateValue(bookQueryNotificationsKey, + JsonConvert.SerializeObject(result)); + return result; + } public static string GoogleRegId { @@ -185,10 +204,11 @@ namespace BookAStar return environ; } } - - public const string MobileRegistrationUrl = "http://dev.pschneider.fr/api/gcm/register"; - + 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"; - public static readonly string UserInfoUrl = "http://dev.pschneider.fr/api/me"; } } diff --git a/BookAStar/BookAStar/Helpers/RemoteEntity.cs b/BookAStar/BookAStar/Helpers/RemoteEntity.cs new file mode 100644 index 00000000..831b7af9 --- /dev/null +++ b/BookAStar/BookAStar/Helpers/RemoteEntity.cs @@ -0,0 +1,113 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Windows.Input; +using System.Linq; +using System.Net.Http; +using Newtonsoft.Json; +using System.Threading.Tasks; + +namespace BookAStar +{ + public class RemoteEntity : ICommand where K : IEquatable + { + private string _controller; + public event EventHandler CanExecuteChanged; + public bool IsExecuting { get; private set; } + public ObservableCollection LocalData; + private Func _getKey ; + private HttpClient client; + private Uri controllerUri; + + public bool CanExecute(object parameter) + { + return !IsExecuting; + } + + public RemoteEntity(string controllerName, Func getKey) + { + if (string.IsNullOrWhiteSpace(controllerName) || getKey == null) + throw new InvalidOperationException(); + _controller = controllerName; + _getKey = getKey; + LocalData = new ObservableCollection(); + client = new HttpClient(); + controllerUri = new Uri(MainSettings.YavscApiUrl + "/" + _controller); + } + + private void BeforeExecute() + { + if (IsExecuting) + throw new InvalidOperationException("Already executing"); + IsExecuting = true; + if (CanExecuteChanged != null) + CanExecuteChanged.Invoke(this, new EventArgs()); + } + + /// + /// Refresh the collection + /// + /// + public async void Execute(object parameter) + { + BeforeExecute(); + // Get the whole data + + var response = await client.GetAsync(controllerUri); + if (response.IsSuccessStatusCode) + { + var content = await response.Content.ReadAsStringAsync(); + List col = JsonConvert.DeserializeObject>(content); + // LocalData.Clear(); + foreach (var item in col) + { + Update(item); + } + } + + AfterExecuting(); + } + private void Update (V item) + { + var key = _getKey(item); + if (LocalData.Any(x => _getKey(x).Equals(key))) + { + LocalData.Remove(LocalGet(key)); + } + LocalData.Add(item); + } + + public V LocalGet(K key) + { + return LocalData.Single(x => _getKey(x).Equals(key)); + } + + private void AfterExecuting() + { + IsExecuting = false; + if (CanExecuteChanged != null) + CanExecuteChanged.Invoke(this, new EventArgs()); + } + + public async Task Get(K key) + { + V item = default(V); + BeforeExecute(); + // Get the whole data + var uri = new Uri(controllerUri.AbsolutePath+"/"+key.ToString()); + + var response = await client.GetAsync(uri); + if (response.IsSuccessStatusCode) + { + var content = await response.Content.ReadAsStringAsync(); + item = JsonConvert.DeserializeObject(content); + // LocalData.Clear(); + Update(item); + } + + AfterExecuting(); + return item; + } + + } +} diff --git a/BookAStar/BookAStar/IPlatform.cs b/BookAStar/BookAStar/IPlatform.cs index 0483f67f..787e7f4b 100644 --- a/BookAStar/BookAStar/IPlatform.cs +++ b/BookAStar/BookAStar/IPlatform.cs @@ -1,4 +1,5 @@ using BookAStar.Model.Auth.Account; +using Xamarin.Forms; using Yavsc.Models.Identity; namespace BookAStar @@ -22,6 +23,8 @@ namespace BookAStar TAnswer InvokeApi(string method, object arg); object InvokeApi(string method, object arg); + + View CreateMarkdownView(string markdown); } } diff --git a/BookAStar/BookAStar/IdentificationChangedEventArgs.cs b/BookAStar/BookAStar/IdentificationChangedEventArgs.cs deleted file mode 100644 index 1d0ec63e..00000000 --- a/BookAStar/BookAStar/IdentificationChangedEventArgs.cs +++ /dev/null @@ -1,14 +0,0 @@ -using BookAStar.Model.Auth.Account; -using System; - -namespace BookAStar -{ - public class IdentificationChangedEventArgs : EventArgs - { - public User NewIdentification { get; private set; } - public IdentificationChangedEventArgs(User newId) - { - NewIdentification = newId; - } - } -} \ No newline at end of file diff --git a/BookAStar/BookAStar/Model/Auth/MobileAppDeclaration.cs b/BookAStar/BookAStar/Model/Auth/MobileAppDeclaration.cs index 250bc045..92b3fea7 100644 --- a/BookAStar/BookAStar/Model/Auth/MobileAppDeclaration.cs +++ b/BookAStar/BookAStar/Model/Auth/MobileAppDeclaration.cs @@ -5,7 +5,7 @@ using Yavsc.Models.Identity; namespace BookAStar.Model.Auth.Account { - public class GoogleCloudMobileDeclaration : IGoogleCloudMobileDeclaration + public class GoogleCloudMobileDeclaration { public string GCMRegistrationId { get; set; } public string DeviceId { get; set; } diff --git a/BookAStar/BookAStar/Model/BookQueryData.cs b/BookAStar/BookAStar/Model/BookQueryData.cs new file mode 100644 index 00000000..f12268b7 --- /dev/null +++ b/BookAStar/BookAStar/Model/BookQueryData.cs @@ -0,0 +1,16 @@ +using BookAStar.Model.Social; +using System; + +namespace BookAStar.Model +{ + public class BookQueryData + { + public string Title { get; set; } + public string Description { set; get; } + public string Comment { get; set; } + public long CommandId { get; set; } + public DateTime StartDate { get; set; } + public DateTime EndDate { get; set; } + public Location Address { get; set; } + } +} diff --git a/BookAStar/BookAStar/Model/Manager.cs b/BookAStar/BookAStar/Model/Manager.cs index a1ac48f2..0aaf9d23 100644 --- a/BookAStar/BookAStar/Model/Manager.cs +++ b/BookAStar/BookAStar/Model/Manager.cs @@ -1,24 +1,30 @@ using BookAStar.Model.Social; +using System; +using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Windows.Input; namespace BookAStar { + + + + + public static class Manager { static Manager () { } - - - + public static ICommand RefreshBookQueries; // TODO WIP TEST rop this - private static Location[] _places = new Location[] { - new Location(48.8626458, 2.2065559, "2 bd Aristide Briand - Suresnes" ), - new Location(48.8632757, 2.2023099, "Théatre Jean Villard - Suresnes" ), - new Location(48.8647120, 2.2054588, "Place de la Paix - Suresnes" ), - new Location(48.8640133, 2.2056573, "Restaurant" ), - new Location(48.8634839, 2.2064137, "Square" ), - new Location(48.8653649, 2.2014945, "Stade de foot" ), + private static Location[] _places = new Location[] { + new Location { Latitude = 48.8626458, Longitude = 2.2065559, Address = "2 bd Aristide Briand - Suresnes" }, + new Location{ Latitude =48.8632757, Longitude =2.2023099, Address ="Théatre Jean Villard - Suresnes" }, + new Location{ Latitude =48.8647120, Longitude =2.2054588,Address = "Place de la Paix - Suresnes" }, + new Location{ Latitude =48.8640133, Longitude =2.2056573, Address ="Restaurant" }, + new Location{ Latitude =48.8634839, Longitude =2.2064137,Address = "Square" }, + new Location{ Latitude =48.8653649, Longitude =2.2014945,Address = "Stade de foot" }, }; // TODO WIP TEST rop this private static ObservableCollection _your_events = new ObservableCollection { diff --git a/BookAStar/BookAStar/Model/Market/BaseProduct.cs b/BookAStar/BookAStar/Model/Market/BaseProduct.cs new file mode 100644 index 00000000..dc528140 --- /dev/null +++ b/BookAStar/BookAStar/Model/Market/BaseProduct.cs @@ -0,0 +1,26 @@ + +namespace BookAStar.Model.Workflow +{ + public partial class BaseProduct + { + /// + /// An unique product identifier. + /// + /// + public long Id { get; set; } + public string Name { get; set; } + /// + /// A contractual description for this product. + /// + /// + public string Description { get; set; } + + /// + /// Controls wether this product or service + /// may be offered to clients, or simply + /// are internal workflow entry point. + /// + /// true when this product belongs to the public catalog. + public bool Public { get; set; } + } +} diff --git a/BookAStar/BookAStar/Model/Social/Location.cs b/BookAStar/BookAStar/Model/Social/Location.cs index 3cf86d3c..751c11bf 100644 --- a/BookAStar/BookAStar/Model/Social/Location.cs +++ b/BookAStar/BookAStar/Model/Social/Location.cs @@ -1,5 +1,7 @@ +using System; +using Android.Runtime; using BookAStar.Model.Workflow.Messaging; namespace BookAStar.Model.Social @@ -24,16 +26,11 @@ namespace BookAStar.Model.Social } + public class Location : Position { public long Id { get; set; } public string Address { get; set; } - public Location(double latitude, double longitude, string address) - { - this.Latitude = latitude; - this.Longitude = longitude; - this.Address = address; - } } diff --git a/BookAStar/BookAStar/Model/Workflow/CommandLine.cs b/BookAStar/BookAStar/Model/Workflow/CommandLine.cs new file mode 100644 index 00000000..89f72c57 --- /dev/null +++ b/BookAStar/BookAStar/Model/Workflow/CommandLine.cs @@ -0,0 +1,13 @@ + +namespace BookAStar.Model.Workflow +{ + + public class CommandLine + { + public long Id { get; set; } + public string Comment { get; set; } + public BaseProduct Article { get; set; } + public int Count { get; set; } + public decimal UnitaryCost { get; set; } + } +} diff --git a/BookAStar/BookAStar/Model/Workflow/Estimate.cs b/BookAStar/BookAStar/Model/Workflow/Estimate.cs new file mode 100644 index 00000000..01af0385 --- /dev/null +++ b/BookAStar/BookAStar/Model/Workflow/Estimate.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BookAStar.Model.Workflow +{ + public partial class Estimate + { + public long Id { get; set; } + + public long? CommandId { get; set; } + /// + /// A command is not required to create + /// an estimate, + /// it will result in a new estimate template + /// + /// + public BookQueryPage Query { get; set; } + public string Description { get; set; } + public int? Status { get; set; } + public string Title { get; set; } + public List Bill { get; set; } + /// + /// List of attached graphic files + /// to this estimate, as relative pathes to + /// the command performer's root path. + /// In db, they are separated by : + /// + /// + public List AttachedGraphicList { get; private set; } + + public string AttachedGraphicsString + { + get { return string.Join(":", AttachedGraphicList); } + set { AttachedGraphicList = value.Split(':').ToList(); } + } + /// + /// List of attached files + /// to this estimate, as relative pathes to + /// the command performer's root path. + /// In db, they are separated by : + /// + /// + public List AttachedFiles { get; set; } + public string AttachedFilesString + { + get { return string.Join(":", AttachedFiles); } + set { AttachedFiles = value.Split(':').ToList(); } + } + + public string OwnerId { get; set; } + private RemoteEntity BookQueries; + + public string ClientId { get; set; } + } +} diff --git a/BookAStar/BookAStar/Pages/BlogPage.cs b/BookAStar/BookAStar/Pages/BlogPage.cs new file mode 100644 index 00000000..ded600fc --- /dev/null +++ b/BookAStar/BookAStar/Pages/BlogPage.cs @@ -0,0 +1,57 @@ +using BookAStar.Model.Blog; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection.Emit; +using System.Text; + +using Xamarin.Forms; +using Yavsc.Models; + +namespace BookAStar +{ + + + public class BlogPage : ContentPage + { + HtmlWebViewSource _source; + HtmlWebViewSource _sourceTitle; + MarkdownDeep.Markdown _md; + WebView titleLabel; + WebView contentView; + + public BlogPage() + { + _source = new HtmlWebViewSource(); + _sourceTitle = new HtmlWebViewSource(); + _md = new MarkdownDeep.Markdown(); + _sourceTitle.BaseUrl = _source.BaseUrl = MainSettings.YavscHomeUrl; + _sourceTitle.Html = "Hello"; + titleLabel = new WebView { Source = _sourceTitle }; + contentView = new WebView { Source = _source }; + + Content = new StackLayout + { + Children = { + titleLabel, + contentView + } + }; + } + + protected override void OnBindingContextChanged() + { + base.OnBindingContextChanged(); + var blog = BindingContext as Blog; + if (blog == null) + { + _sourceTitle.Html = _source.Html = ""; + } + else + { + _sourceTitle.Html = _md.Transform(blog.bcontent); + _source.Html = _md.Transform(blog.bcontent); + } + } + } +} diff --git a/BookAStar/BookAStar/Pages/BookQueryPage.xaml b/BookAStar/BookAStar/Pages/BookQueryPage.xaml new file mode 100644 index 00000000..1a60295b --- /dev/null +++ b/BookAStar/BookAStar/Pages/BookQueryPage.xaml @@ -0,0 +1,15 @@ + + + +