From 1ee8e83013bd907a65940c07c919b5f05b679de2 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Tue, 27 Sep 2016 02:35:45 +0200 Subject: [PATCH] intergartions XLabs.* WIP MVVM --- .../BookAStar.Droid/BookAStar.Droid.csproj | 208 +- BookAStar/BookAStar.Droid/Helpers/Settings.cs | 4 +- .../Helpers/SimpleJsonPostMethod.cs | 26 +- BookAStar/BookAStar.Droid/MainActivity.cs | 111 +- BookAStar/BookAStar.Droid/MainApplication.cs | 63 + .../BookAStar.Droid/MarkdownWebViewClient.cs | 12 - .../PluginsHelp/ConnectivityReadme.txt | 17 - .../PluginsHelp/GeolocatorReadme.txt | 24 - .../Resources/Resource.Designer.cs | 7411 +++++++++++------ .../drawable/{icon-anon.png => icon_anon.png} | Bin .../Resources/values/strings.xml | 1 + .../Resources/values/styles.xml | 18 +- .../Services/GcmListenerService.cs | 2 +- BookAStar/BookAStar.Droid/app.config | 8 + .../BookAStar.Droid/google-services.json | 78 + BookAStar/BookAStar.Droid/packages.config | 43 +- BookAStar/BookAStar.iOS/AppDelegate.cs | 51 +- BookAStar/BookAStar.iOS/BookAStar.iOS.csproj | 16 +- BookAStar/BookAStar.iOS/app.config | 4 + BookAStar/BookAStar.iOS/packages.config | 2 +- BookAStar/BookAStar/App.xaml | 23 +- BookAStar/BookAStar/App.xaml.cs | 234 +- BookAStar/BookAStar/BookAStar.csproj | 58 +- BookAStar/BookAStar/Constants.cs | 7 +- BookAStar/BookAStar/Factories/ViewFactory.cs | 58 + .../BookAStar/Helpers/AvatarImageSource.cs | 4 +- BookAStar/BookAStar/Helpers/DataManager.cs | 2 +- .../BookAStar/Helpers/PropertySupport.cs | 27 + BookAStar/BookAStar/Helpers/RemoteEntity.cs | 56 +- BookAStar/BookAStar/Helpers/Settings.cs | 43 + .../BookAStar/Interfaces/IComponentContext.cs | 11 + .../BookAStar/Interfaces/IModelViewModel.cs | 16 + .../BookAStar/Interfaces/IViewFactory.cs | 25 + .../BookAStar/Model/ClientProviderInfo.cs | 8 + .../BookAStar/Model/Workflow/Estimate.cs | 1 + .../BookAStar/Pages/BookQueriesPage.xaml.cs | 8 +- BookAStar/BookAStar/Pages/BookQueryPage.xaml | 6 +- .../BookAStar/Pages/BookQueryPage.xaml.cs | 1 + .../BookAStar/Pages/EditEstimatePage.xaml | 20 +- .../BookAStar/Pages/EditEstimatePage.xaml.cs | 2 +- BookAStar/BookAStar/Pages/SettingsPage.xaml | 107 +- .../ViewModels/BookQueriesViewModel.cs | 22 + .../ViewModels/BookQueryViewModel.cs | 32 + .../BookAStar/ViewModels/SettingsViewModel.cs | 11 + .../BookAStar/ViewModels/ViewModelBase.cs | 45 + BookAStar/BookAStar/app.config | 4 + BookAStar/BookAStar/packages.config | 14 +- Yavsc.Client/project.json | 4 +- Yavsc.Client/project.lock.json | 248 +- 49 files changed, 6236 insertions(+), 2960 deletions(-) create mode 100644 BookAStar/BookAStar.Droid/MainApplication.cs delete mode 100644 BookAStar/BookAStar.Droid/PluginsHelp/ConnectivityReadme.txt delete mode 100644 BookAStar/BookAStar.Droid/PluginsHelp/GeolocatorReadme.txt rename BookAStar/BookAStar.Droid/Resources/drawable/{icon-anon.png => icon_anon.png} (100%) create mode 100644 BookAStar/BookAStar.Droid/google-services.json create mode 100644 BookAStar/BookAStar/Factories/ViewFactory.cs create mode 100644 BookAStar/BookAStar/Helpers/PropertySupport.cs create mode 100644 BookAStar/BookAStar/Helpers/Settings.cs create mode 100644 BookAStar/BookAStar/Interfaces/IComponentContext.cs create mode 100644 BookAStar/BookAStar/Interfaces/IModelViewModel.cs create mode 100644 BookAStar/BookAStar/Interfaces/IViewFactory.cs create mode 100644 BookAStar/BookAStar/ViewModels/BookQueriesViewModel.cs create mode 100644 BookAStar/BookAStar/ViewModels/BookQueryViewModel.cs create mode 100644 BookAStar/BookAStar/ViewModels/SettingsViewModel.cs create mode 100644 BookAStar/BookAStar/ViewModels/ViewModelBase.cs diff --git a/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj b/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj index 20085de3..52765a5e 100644 --- a/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj +++ b/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj @@ -66,30 +66,21 @@ - - False - ..\..\packages\Xam.Plugin.DeviceInfo.1.0.0.2\lib\MonoAndroid10\DeviceInfo.Plugin.dll - - - False - ..\..\packages\Xam.Plugin.DeviceInfo.1.0.0.2\lib\MonoAndroid10\DeviceInfo.Plugin.Abstractions.dll + + ..\..\packages\ExifLib.PCL.1.0.1\lib\portable-net45+sl50+win+WindowsPhoneApp81+wp80+Xamarin.iOS10+MonoAndroid10+MonoTouch10\ExifLib.dll + True - ..\..\packages\Xamarin.Forms.2.3.0.107\lib\MonoAndroid10\FormsViewGroup.dll + ..\..\packages\Xamarin.Forms.2.3.2.127\lib\MonoAndroid10\FormsViewGroup.dll True + + ..\..\Components\GoogleMediaFramework-1.0\lib\android\GoogleMediaFramework.dll + ..\..\packages\MarkdownDeep-av.NET.1.5.2\lib\MonoAndroid10\MarkdownDeep.dll True - - ..\..\packages\Xam.Plugin.Media.1.0.1\lib\MonoAndroid10\Media.Plugin.dll - True - - - ..\..\packages\Xam.Plugin.Media.1.0.1\lib\MonoAndroid10\Media.Plugin.Abstractions.dll - True - @@ -98,12 +89,71 @@ ..\..\packages\Newtonsoft.Json.9.0.1\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll True - - ..\..\packages\Xam.Plugins.Settings.2.1.0\lib\MonoAndroid10\Plugin.Settings.dll + + ..\..\packages\Xam.Plugin.Connectivity.2.2.12\lib\MonoAndroid10\Plugin.Connectivity.dll + True + + + ..\..\packages\Xam.Plugin.Connectivity.2.2.12\lib\MonoAndroid10\Plugin.Connectivity.Abstractions.dll + True + + + ..\..\packages\Plugin.CurrentActivity.1.0.1\lib\MonoAndroid10\Plugin.CurrentActivity.dll + True + + + ..\..\packages\Xam.Plugin.DeviceInfo.2.0.2\lib\MonoAndroid10\Plugin.DeviceInfo.dll + True + + + ..\..\packages\Xam.Plugin.DeviceInfo.2.0.2\lib\MonoAndroid10\Plugin.DeviceInfo.Abstractions.dll + True + + + ..\..\packages\Xam.Plugin.Geolocator.3.0.4\lib\MonoAndroid10\Plugin.Geolocator.dll + True + + + ..\..\packages\Xam.Plugin.Geolocator.3.0.4\lib\MonoAndroid10\Plugin.Geolocator.Abstractions.dll True - - ..\..\packages\Xam.Plugins.Settings.2.1.0\lib\MonoAndroid10\Plugin.Settings.Abstractions.dll + + ..\..\packages\Xam.Plugin.Media.2.3.0\lib\MonoAndroid10\Plugin.Media.dll + True + + + ..\..\packages\Xam.Plugin.Media.2.3.0\lib\MonoAndroid10\Plugin.Media.Abstractions.dll + True + + + ..\..\packages\Plugin.Permissions.1.1.7\lib\MonoAndroid10\Plugin.Permissions.dll + True + + + ..\..\packages\Plugin.Permissions.1.1.7\lib\MonoAndroid10\Plugin.Permissions.Abstractions.dll + True + + + ..\..\packages\Xam.Plugins.Settings.2.5.1.0\lib\MonoAndroid10\Plugin.Settings.dll + True + + + ..\..\packages\Xam.Plugins.Settings.2.5.1.0\lib\MonoAndroid10\Plugin.Settings.Abstractions.dll + True + + + ..\..\packages\Xamarin.Controls.SignaturePad.1.4.0\lib\MonoAndroid\SignaturePad.dll + True + + + ..\..\packages\SQLite.Net.Core-PCL.3.1.1\lib\portable-win8+net45+wp8+wpa81+MonoAndroid1+MonoTouch1\SQLite.Net.dll + + + ..\..\packages\SQLite.Net.Async-PCL.3.1.1\lib\portable-win8+net45+wp8+wpa81+MonoAndroid1+MonoTouch1\SQLite.Net.Async.dll + True + + + ..\..\packages\SQLite.Net-PCL.3.1.1\lib\MonoAndroid\SQLite.Net.Platform.XamarinAndroid.dll True @@ -152,46 +202,90 @@ ..\..\Components\xamarin.auth-1.2.3.1\lib\android\Xamarin.Auth.Android.dll - ..\..\packages\Xamarin.Forms.2.3.0.107\lib\MonoAndroid10\Xamarin.Forms.Core.dll + ..\..\packages\Xamarin.Forms.2.3.2.127\lib\MonoAndroid10\Xamarin.Forms.Core.dll + True + + + ..\..\packages\Xamarin.Forms.Labs.1.0.1.0\lib\portable-net45+win+wp80+MonoAndroid10+MonoTouch10\Xamarin.Forms.Labs.dll True - + False - ..\..\packages\Xamarin.Forms.Maps.2.3.0.107\lib\MonoAndroid10\Xamarin.Forms.Maps.dll + ..\..\..\..\Visual Studio 2015\Projects\App2\packages\Xamarin.Forms.Maps.2.3.0.107\lib\MonoAndroid10\Xamarin.Forms.Maps.dll - - ..\..\packages\Xamarin.Forms.Maps.2.3.0.107\lib\MonoAndroid10\Xamarin.Forms.Maps.Android.dll + + False + ..\..\..\..\Visual Studio 2015\Projects\App2\packages\Xamarin.Forms.Maps.2.3.0.107\lib\MonoAndroid10\Xamarin.Forms.Maps.Android.dll - ..\..\packages\Xamarin.Forms.2.3.0.107\lib\MonoAndroid10\Xamarin.Forms.Platform.dll + ..\..\packages\Xamarin.Forms.2.3.2.127\lib\MonoAndroid10\Xamarin.Forms.Platform.dll True - ..\..\packages\Xamarin.Forms.2.3.0.107\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll + ..\..\packages\Xamarin.Forms.2.3.2.127\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll True - ..\..\packages\Xamarin.Forms.2.3.0.107\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll + ..\..\packages\Xamarin.Forms.2.3.2.127\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll True + + ..\..\packages\Xamarin.GooglePlayServices.Ads.29.0.0.2\lib\MonoAndroid41\Xamarin.GooglePlayServices.Ads.dll + True + + + ..\..\packages\Xamarin.GooglePlayServices.Analytics.29.0.0.2\lib\MonoAndroid41\Xamarin.GooglePlayServices.Analytics.dll + + False ..\..\packages\Xamarin.GooglePlayServices.Base.29.0.0.2\lib\MonoAndroid41\Xamarin.GooglePlayServices.Base.dll - True - + ..\..\packages\Xamarin.GooglePlayServices.Basement.29.0.0.2\lib\MonoAndroid41\Xamarin.GooglePlayServices.Basement.dll - True - + ..\..\packages\Xamarin.GooglePlayServices.Gcm.29.0.0.2\lib\MonoAndroid41\Xamarin.GooglePlayServices.Gcm.dll - True - + ..\..\packages\Xamarin.GooglePlayServices.Maps.29.0.0.2\lib\MonoAndroid41\Xamarin.GooglePlayServices.Maps.dll - True - + ..\..\packages\Xamarin.GooglePlayServices.Measurement.29.0.0.2\lib\MonoAndroid41\Xamarin.GooglePlayServices.Measurement.dll + + + ..\..\packages\XLabs.Caching.2.2.0-pre05\lib\portable-net45+netcore45+wpa81+wp8+monoandroid+monotouch+xamarinios10+xamarinmac\XLabs.Caching.dll + True + + + ..\..\packages\XLabs.Caching.SQLite.2.2.0-pre05\lib\portable-net45+netcore45+wpa81+wp8+monoandroid+monotouch+xamarinios10+xamarinmac\XLabs.Caching.Sqlite.dll + True + + + ..\..\packages\XLabs.Core.2.2.0-pre05\lib\portable-net45+netcore45+wpa81+wp8+monoandroid+monotouch+xamarinios10+xamarinmac\XLabs.Core.dll + True + + + ..\..\packages\XLabs.Forms.2.2.0-pre05\lib\monoandroid\XLabs.Forms.dll + True + + + ..\..\packages\XLabs.Forms.2.2.0-pre05\lib\monoandroid\XLabs.Forms.Droid.dll + True + + + ..\..\packages\XLabs.IoC.2.2.0-pre05\lib\portable-net45+netcore45+wpa81+wp8+monoandroid+monotouch+xamarinios10+xamarinmac\XLabs.IOC.dll + True + + + ..\..\packages\XLabs.Platform.2.2.0-pre05\lib\MonoAndroid\XLabs.Platform.dll + True + + + ..\..\packages\XLabs.Platform.2.2.0-pre05\lib\MonoAndroid\XLabs.Platform.Droid.dll + True + + + ..\..\packages\XLabs.Serialization.2.2.0-pre05\lib\portable-net45+netcore45+wpa81+wp8+monoandroid+monotouch+xamarinios10+xamarinmac\XLabs.Serialization.dll True @@ -201,6 +295,7 @@ + True True @@ -220,12 +315,15 @@ Designer + RazorTemplatePreprocessor MarkdownEditor.cs None - + + Designer + @@ -254,6 +352,10 @@ + + False + 1.0.3 + False 1.0.0.2 @@ -262,6 +364,14 @@ False 1.0.3 + + False + 1.0 + + + False + 22.0.0.0 + False 7.0.1 @@ -274,6 +384,18 @@ False 1.5.2 + + False + 1.4.0.0 + + + False + 21.0.3.0 + + + False + 23.1.1.1 + False 1.2.3.1 @@ -295,9 +417,9 @@ - - - + + Designer + @@ -308,7 +430,7 @@ - + @@ -322,11 +444,11 @@ - + - + + + diff --git a/BookAStar/BookAStar.Droid/Services/GcmListenerService.cs b/BookAStar/BookAStar.Droid/Services/GcmListenerService.cs index 9dc7f15a..148fbdd5 100644 --- a/BookAStar/BookAStar.Droid/Services/GcmListenerService.cs +++ b/BookAStar/BookAStar.Droid/Services/GcmListenerService.cs @@ -43,7 +43,7 @@ namespace BookAStar.Droid.Services var topic = data.GetString("Topic"); if (topic == "BookQuery") { - DateTime eventdate,enddate; + DateTime eventdate; var sdatestr = data.GetString("EventDate"); DateTime.TryParse(sdatestr, out eventdate); diff --git a/BookAStar/BookAStar.Droid/app.config b/BookAStar/BookAStar.Droid/app.config index 5ff34869..c8df8462 100644 --- a/BookAStar/BookAStar.Droid/app.config +++ b/BookAStar/BookAStar.Droid/app.config @@ -2,6 +2,10 @@ + + + + @@ -30,6 +34,10 @@ + + + + diff --git a/BookAStar/BookAStar.Droid/google-services.json b/BookAStar/BookAStar.Droid/google-services.json new file mode 100644 index 00000000..a6bd9aad --- /dev/null +++ b/BookAStar/BookAStar.Droid/google-services.json @@ -0,0 +1,78 @@ +{ + "project_info": { + "project_number": "325408689282", + "project_id": "yavsc-001" + }, + "client": [ + { + "client_info": { + "android_client_info": { + "package_name": "fr.pschneider.android.wearable.speedtracker" + } + }, + "oauth_client": [ + { + "client_id": "325408689282-6bekh7p3guj4k0f3301a6frf025cnrk1.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyBCAE_pc6lrxLf8_Vyho0KSxLsqjxecPFk" + } + ], + "services": { + "analytics_service": { + "status": 1 + }, + "appinvite_service": { + "status": 1, + "other_platform_oauth_client": [] + }, + "ads_service": { + "status": 1 + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:325408689282:android:50a2328516f10af3", + "android_client_info": { + "package_name": "fr.pschneider.bas" + } + }, + "oauth_client": [ + { + "client_id": "325408689282-emdeucmt5pr9jg7170t0q9gnndacsqqf.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "fr.pschneider.bas", + "certificate_hash": "E97A345457861B8E2E7BA79BB814BB1ACC0471A6" + } + }, + { + "client_id": "325408689282-6bekh7p3guj4k0f3301a6frf025cnrk1.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyBCAE_pc6lrxLf8_Vyho0KSxLsqjxecPFk" + } + ], + "services": { + "analytics_service": { + "status": 1 + }, + "appinvite_service": { + "status": 1, + "other_platform_oauth_client": [] + }, + "ads_service": { + "status": 1 + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/BookAStar/BookAStar.Droid/packages.config b/BookAStar/BookAStar.Droid/packages.config index 3c8a0a89..b25e9b63 100644 --- a/BookAStar/BookAStar.Droid/packages.config +++ b/BookAStar/BookAStar.Droid/packages.config @@ -1,12 +1,19 @@  + - - - - - + + + + + + + + + + + @@ -15,11 +22,23 @@ - - - - - - - + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BookAStar/BookAStar.iOS/AppDelegate.cs b/BookAStar/BookAStar.iOS/AppDelegate.cs index 78b47126..dbcd76b8 100644 --- a/BookAStar/BookAStar.iOS/AppDelegate.cs +++ b/BookAStar/BookAStar.iOS/AppDelegate.cs @@ -4,6 +4,9 @@ using System.Linq; using Foundation; using UIKit; +using BookAStar; +using BookAStar.Interfaces; +using Yavsc.Models.Identity; namespace App2.iOS { @@ -11,8 +14,27 @@ namespace App2.iOS // User Interface of the application, as well as listening (and optionally responding) to // application events from iOS. [Register("AppDelegate")] - public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate + public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate, + IPlatform { + public string GCMStatusMessage + { + get + { + throw new NotImplementedException(); + } + } + + public void AddAccount() + { + throw new NotImplementedException(); + } + + public bool EnablePushNotifications(bool enable) + { + throw new NotImplementedException(); + } + // // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window @@ -23,9 +45,34 @@ namespace App2.iOS public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.Init(); - LoadApplication(new App()); + LoadApplication(new App(this)); return base.FinishedLaunching(app, options); } + + public IGCMDeclaration GetDeviceInfo() + { + throw new NotImplementedException(); + } + + public object InvokeApi(string method, object arg) + { + throw new NotImplementedException(); + } + + public TAnswer InvokeApi(string method, object arg) + { + throw new NotImplementedException(); + } + + public void OpenWeb(string Uri) + { + throw new NotImplementedException(); + } + + public void RevokeAccount(string userName) + { + throw new NotImplementedException(); + } } } diff --git a/BookAStar/BookAStar.iOS/BookAStar.iOS.csproj b/BookAStar/BookAStar.iOS/BookAStar.iOS.csproj index ca76670d..0cce83b0 100644 --- a/BookAStar/BookAStar.iOS/BookAStar.iOS.csproj +++ b/BookAStar/BookAStar.iOS/BookAStar.iOS.csproj @@ -133,35 +133,39 @@ - ..\..\packages\Xamarin.Forms.2.0.0.6482\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll + ..\..\packages\Xamarin.Forms.2.3.2.127\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll True - ..\..\packages\Xamarin.Forms.2.0.0.6482\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll + ..\..\packages\Xamarin.Forms.2.3.2.127\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll True - ..\..\packages\Xamarin.Forms.2.0.0.6482\lib\Xamarin.iOS10\Xamarin.Forms.Platform.iOS.dll + ..\..\packages\Xamarin.Forms.2.3.2.127\lib\Xamarin.iOS10\Xamarin.Forms.Platform.iOS.dll True - ..\..\packages\Xamarin.Forms.2.0.0.6482\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll + ..\..\packages\Xamarin.Forms.2.3.2.127\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll True + + {67F9D3A8-F71E-4428-913F-C37AE82CDB24} + Yavsc.Client + {A0815650-0A0A-47B0-8826-771F0E1AD137} BookAStar - + Ce projet fait référence à des packages NuGet qui sont manquants sur cet ordinateur. Utilisez l'option de restauration des packages NuGet pour les télécharger. Pour plus d'informations, consultez http://go.microsoft.com/fwlink/?LinkID=322105. Le fichier manquant est : {0}. - + \ No newline at end of file diff --git a/BookAStar/BookAStar.iOS/app.config b/BookAStar/BookAStar.iOS/app.config index 8460dd43..bb76392c 100644 --- a/BookAStar/BookAStar.iOS/app.config +++ b/BookAStar/BookAStar.iOS/app.config @@ -6,6 +6,10 @@ + + + + \ No newline at end of file diff --git a/BookAStar/BookAStar.iOS/packages.config b/BookAStar/BookAStar.iOS/packages.config index c044abf8..b78e7945 100644 --- a/BookAStar/BookAStar.iOS/packages.config +++ b/BookAStar/BookAStar.iOS/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/BookAStar/BookAStar/App.xaml b/BookAStar/BookAStar/App.xaml index a3f0bde3..9b6d74a0 100644 --- a/BookAStar/BookAStar/App.xaml +++ b/BookAStar/BookAStar/App.xaml @@ -1,11 +1,16 @@  + x:Class="BookAStar.App" + xmlns:sys="clr-namespace:System;assembly=mscorlib"> + + - #f0f0ff + #30FAFAFA + #ffffff + #000000 Black Blue #5050ff @@ -15,9 +20,10 @@ + + - - #30FAFAFA + #30AAAAFA #207AFAFA #FF103010 #FF303010 @@ -47,6 +53,10 @@ + - diff --git a/BookAStar/BookAStar/App.xaml.cs b/BookAStar/BookAStar/App.xaml.cs index fa13a098..40882687 100644 --- a/BookAStar/BookAStar/App.xaml.cs +++ b/BookAStar/BookAStar/App.xaml.cs @@ -3,9 +3,19 @@ using BookAStar.Interfaces; using BookAStar.Model; using BookAStar.Model.Workflow; using BookAStar.Pages; +using BookAStar.ViewModels; using System; -using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Linq; +using System.Reflection; +using System.Threading.Tasks; using Xamarin.Forms; +using XLabs.Forms.Mvvm; +using XLabs.Forms.Services; +using XLabs.Ioc; +using XLabs.Platform.Mvvm; +using XLabs.Platform.Services; /* Glyphish icons from http://www.glyphish.com/ @@ -18,97 +28,151 @@ namespace BookAStar { public partial class App : Application // superclass new in 1.3 { - 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" - }; - - - - - - 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; } = new DataManager(); - - internal void EditCommandLine(CommandLine com) + public static void Init() { - CommandLineEditorPage editCommandLine = new CommandLineEditorPage + var app = Resolver.Resolve(); + if (app == null) { - Title = "Edition d'une ligne de facture", - BindingContext = com - }; - mp.Navigation.PushAsync(editCommandLine); + return; + } + // navigation registration + + app.Closing += (o, e) => Debug.WriteLine("Application Closing"); + app.Error += (o, e) => Debug.WriteLine("Application Error"); + app.Initialize += (o, e) => Debug.WriteLine("Application Initialized"); + app.Resumed += (o, e) => Debug.WriteLine("Application Resumed"); + app.Rotation += (o, e) => Debug.WriteLine("Application Rotated"); + app.Startup += (o, e) => Debug.WriteLine("Application Startup"); + app.Suspended += (o, e) => Debug.WriteLine("Application Suspended"); + } public App(IPlatform instance) { + PlatformSpecificInstance = instance; InitializeComponent(); + Init(); + MainPage = GetMainPage(); + } - PlatformSpecificInstance = instance; - mp = new NavigationPage(searchPage) + public static Page GetMainPage() + { + ViewFactory.Register(); + ViewFactory.Register( + resolver => new BookQueryViewModel () + ); + + var bQueriesPage = new BookQueriesPage { - BackgroundColor = (Color)Application.Current.Resources["PageBackgroundColor"] + BindingContext = DataManager.Current.BookQueries, + Title = "Demandes" }; - var color = Application.Current.Resources["PageBackgroundColor"]; - //var hasLabelStyle = r.ContainsKey("labelStyle"); - // var stid = this.StyleId; - // null var appsstyle = settingsPage.Style; - // appsstyle.CanCascade = true; - MainPage = mp; + + // var mainPage = new NavigationPage(bQueriesPage); + + var mainPage = new XLabs.Forms.Pages.ExtendedMasterDetailPage() { + Title="MainPAge" + }; + + mainPage.Master = bQueriesPage; + mainPage.Detail = new SettingsPage(); + + Resolver.Resolve() + .Register(t => new NavigationService(mainPage.Navigation)); + ToolbarItem tiSetts = new ToolbarItem() { - Text = "Settings", + Text = "Paramètres", Icon = "ic_corp_icon.png" }; - mp.ToolbarItems.Add(tiSetts); - tiSetts.Clicked += (object sender, EventArgs e) => - { - ShowPage (settingsPage); - }; - ToolbarItem tiQueries = new ToolbarItem - { - Text = "Demandes" - }; - tiQueries.Clicked += (object sender, EventArgs e) => - { - BookQueriesPage bookQueriesPage = new BookQueriesPage - { - Title = "Demandes de devis" - }; - bookQueriesPage.BindingContext = DataManager.BookQueries; - ShowPage(bookQueriesPage); - }; - mp.ToolbarItems.Add(tiQueries); - ToolbarItem tiMap = new ToolbarItem + ToolbarItem tiHome = new ToolbarItem() { - Text = "Carte", - Icon = "glyphish_07_map_marker.png" + Text = "Accueil", + Icon = "icon.png" }; - mp.ToolbarItems.Add(tiMap); - tiMap.Clicked += (object sender, EventArgs e) => + mainPage.ToolbarItems.Add(tiHome); + mainPage.ToolbarItems.Add(tiSetts); + return mainPage; + + /* searchPage = new SearchPage + { + Title = "Trouvez votre artiste", + Icon = "glyphish_07_map_marker.png" + }; + + settingsPage = new SettingsPage + { + Title = "Paramètres", + Icon = "ic_corp_icon.png" + }; + + pinPage = new PinPage + { + Title = "Carte", + Icon = "glyphish_07_map_marker.png" + }; + PlatformSpecificInstance = instance; + Navigation = new NavigationPage(searchPage); + + //var hasLabelStyle = r.ContainsKey("labelStyle"); + // var stid = this.StyleId; + // null var appsstyle = settingsPage.Style; + // appsstyle.CanCascade = true; + MainPage = Navigation; + ToolbarItem tiSetts = new ToolbarItem() + { + Text = "Settings", + Icon = "ic_corp_icon.png" + }; + Navigation.ToolbarItems.Add(tiSetts); + tiSetts.Clicked += (object sender, EventArgs e) => + { + ShowPage (settingsPage); + }; + ToolbarItem tiQueries = new ToolbarItem + { + Text = "Demandes" + }; + + tiQueries.Clicked += (object sender, EventArgs e) => + { + BookQueriesPage bookQueriesPage = new BookQueriesPage + { + Title = "Demandes de devis" + }; + bookQueriesPage.BindingContext = DataManager.BookQueries; + ShowPage(bookQueriesPage); + }; + Navigation.ToolbarItems.Add(tiQueries); + ToolbarItem tiMap = new ToolbarItem + { + Text = "Carte", + Icon = "glyphish_07_map_marker.png" + }; + Navigation.ToolbarItems.Add(tiMap); + tiMap.Clicked += (object sender, EventArgs e) => + { + ShowPage(pinPage); + }; + MainPage = Navigation; + */ + + + } + + internal void EditCommandLine(Page parentPage, CommandLine com) + { + CommandLineEditorPage editCommandLine = new CommandLineEditorPage { - ShowPage(pinPage); + Title = "Edition d'une ligne de facture", + BindingContext = com }; - + parentPage.Navigation.PushAsync(editCommandLine); } public void PostDeviceInfo() @@ -122,31 +186,45 @@ namespace BookAStar { BookQueryPage bookQueryPage = new BookQueryPage { - Title = "Demande de devis" + Title = "Demande de devis", + BindingContext = data }; - bookQueryPage.BindingContext = data; - ShowPage(bookQueryPage); + ShowPage(bookQueryPage); } public void EditEstimate(Estimate data) { + throw new NotImplementedException(); EditEstimatePage editEstimate = new EditEstimatePage { Title = "Création d'un devis" }; editEstimate.Estimate = data; - ShowPage(editEstimate); + // ShowPage(editEstimate); } // TODO système de persistance de l'état de l'appli - private void ShowPage(Page p) + + /// + /// Shows a page asynchronously by locating the default constructor, creating the page, + /// the pushing it onto the navigation stack. + /// + /// Parent Page + /// Type of page to show + /// + private static async Task ShowPage(VisualElement parentPage, Type pageType) { - if (p.Parent!=null) + // Get all the constructors of the page type. + var constructors = pageType.GetTypeInfo().DeclaredConstructors; + + foreach ( var page in + from constructor in constructors + where constructor.GetParameters().Length == 0 + select (Page)constructor.Invoke(null)) { - mp.Navigation.RemovePage(p); - p.Parent = null; + await parentPage.Navigation.PushAsync(page); + break; } - mp.Navigation.PushAsync(p); } } } diff --git a/BookAStar/BookAStar/BookAStar.csproj b/BookAStar/BookAStar/BookAStar.csproj index e7744bb4..b2216ffc 100644 --- a/BookAStar/BookAStar/BookAStar.csproj +++ b/BookAStar/BookAStar/BookAStar.csproj @@ -41,10 +41,16 @@ App.xaml + + + + + + @@ -105,6 +111,10 @@ EditEstimatePage.xaml + + + + CommandLineEditor.xaml @@ -147,6 +157,10 @@ + + ..\..\packages\ExifLib.PCL.1.0.1\lib\portable-net45+sl50+win+WindowsPhoneApp81+wp80+Xamarin.iOS10+MonoAndroid10+MonoTouch10\ExifLib.dll + True + ..\..\packages\Json.NET.Web.1.0.49\lib\portable45-net45+win8+wpa81\Json.NET.Web.dll @@ -159,28 +173,52 @@ ..\..\packages\Newtonsoft.Json.9.0.1\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll - - ..\..\packages\Xam.Plugins.Settings.2.1.0\lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10+UAP10\Plugin.Settings.dll + + ..\..\packages\Xam.Plugins.Settings.2.5.1.0\lib\portable-net45+wp80+win8+wpa81\Plugin.Settings.dll + True + + + ..\..\packages\Xam.Plugins.Settings.2.5.1.0\lib\portable-net45+wp80+win8+wpa81\Plugin.Settings.Abstractions.dll True - - ..\..\packages\Xam.Plugins.Settings.2.1.0\lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10+UAP10\Plugin.Settings.Abstractions.dll + + ..\..\packages\SQLite.Net-PCL.3.1.1\lib\portable-win8+net45+wp8+wpa81+MonoAndroid1+MonoTouch1\SQLite.Net.dll True - ..\..\packages\Xamarin.Forms.2.3.0.107\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Core.dll + ..\..\packages\Xamarin.Forms.2.3.2.127\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Core.dll True - ..\..\packages\Xamarin.Forms.Maps.2.3.0.107\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Maps.dll + ..\..\packages\Xamarin.Forms.Maps.2.3.2.127\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Maps.dll True - ..\..\packages\Xamarin.Forms.2.3.0.107\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Platform.dll + ..\..\packages\Xamarin.Forms.2.3.2.127\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Platform.dll True - ..\..\packages\Xamarin.Forms.2.3.0.107\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Xaml.dll + ..\..\packages\Xamarin.Forms.2.3.2.127\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Xaml.dll + True + + + ..\..\packages\XLabs.Core.2.2.0-pre05\lib\portable-net45+netcore45+wpa81+wp8+monoandroid+monotouch+xamarinios10+xamarinmac\XLabs.Core.dll + True + + + ..\..\packages\XLabs.Forms.2.2.0-pre05\lib\portable-net45+netcore45+wpa81+monoandroid+MonoTouch+Xamarin.iOS10\XLabs.Forms.dll + True + + + ..\..\packages\XLabs.IoC.2.2.0-pre05\lib\portable-net45+netcore45+wpa81+wp8+monoandroid+monotouch+xamarinios10+xamarinmac\XLabs.IOC.dll + True + + + ..\..\packages\XLabs.Platform.2.2.0-pre05\lib\portable-net45+netcore45+wpa81+monoandroid+MonoTouch+Xamarin.iOS10\XLabs.Platform.dll + True + + + ..\..\packages\XLabs.Serialization.2.2.0-pre05\lib\portable-net45+netcore45+wpa81+wp8+monoandroid+monotouch+xamarinios10+xamarinmac\XLabs.Serialization.dll True @@ -224,12 +262,12 @@ - + Ce projet fait référence à des packages NuGet qui sont manquants sur cet ordinateur. Utilisez l'option de restauration des packages NuGet pour les télécharger. Pour plus d'informations, consultez http://go.microsoft.com/fwlink/?LinkID=322105. Le fichier manquant est : {0}. - +