This commit is contained in:
Paul Schneider 2016-09-29 04:54:14 +02:00
commit a72d457eef
52 changed files with 919 additions and 280 deletions

View file

@ -71,7 +71,7 @@
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="FormsViewGroup, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="FormsViewGroup, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.2.3.2.127\lib\MonoAndroid10\FormsViewGroup.dll</HintPath> <HintPath>..\..\packages\Xamarin.Forms.2.3.0.34-pre1\lib\MonoAndroid10\FormsViewGroup.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="GoogleMediaFramework"> <Reference Include="GoogleMediaFramework">
@ -202,7 +202,7 @@
<HintPath>..\..\Components\xamarin.auth-1.2.3.1\lib\android\Xamarin.Auth.Android.dll</HintPath> <HintPath>..\..\Components\xamarin.auth-1.2.3.1\lib\android\Xamarin.Auth.Android.dll</HintPath>
</Reference> </Reference>
<Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.2.3.2.127\lib\MonoAndroid10\Xamarin.Forms.Core.dll</HintPath> <HintPath>..\..\packages\Xamarin.Forms.2.3.0.34-pre1\lib\MonoAndroid10\Xamarin.Forms.Core.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Xamarin.Forms.Labs, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Xamarin.Forms.Labs, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
@ -218,15 +218,15 @@
<HintPath>..\..\..\..\Visual Studio 2015\Projects\App2\packages\Xamarin.Forms.Maps.2.3.0.107\lib\MonoAndroid10\Xamarin.Forms.Maps.Android.dll</HintPath> <HintPath>..\..\..\..\Visual Studio 2015\Projects\App2\packages\Xamarin.Forms.Maps.2.3.0.107\lib\MonoAndroid10\Xamarin.Forms.Maps.Android.dll</HintPath>
</Reference> </Reference>
<Reference Include="Xamarin.Forms.Platform, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Xamarin.Forms.Platform, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.2.3.2.127\lib\MonoAndroid10\Xamarin.Forms.Platform.dll</HintPath> <HintPath>..\..\packages\Xamarin.Forms.2.3.0.34-pre1\lib\MonoAndroid10\Xamarin.Forms.Platform.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Xamarin.Forms.Platform.Android, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Xamarin.Forms.Platform.Android, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.2.3.2.127\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll</HintPath> <HintPath>..\..\packages\Xamarin.Forms.2.3.0.34-pre1\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.2.3.2.127\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll</HintPath> <HintPath>..\..\packages\Xamarin.Forms.2.3.0.34-pre1\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Xamarin.GooglePlayServices.Ads, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Xamarin.GooglePlayServices.Ads, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
@ -444,11 +444,11 @@
</PropertyGroup> </PropertyGroup>
<Error Condition="!Exists('..\..\packages\Xamarin.GooglePlayServices.Basement.29.0.0.2\build\Xamarin.GooglePlayServices.Basement.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.GooglePlayServices.Basement.29.0.0.2\build\Xamarin.GooglePlayServices.Basement.targets'))" /> <Error Condition="!Exists('..\..\packages\Xamarin.GooglePlayServices.Basement.29.0.0.2\build\Xamarin.GooglePlayServices.Basement.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.GooglePlayServices.Basement.29.0.0.2\build\Xamarin.GooglePlayServices.Basement.targets'))" />
<Error Condition="!Exists('..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets'))" /> <Error Condition="!Exists('..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets'))" />
<Error Condition="!Exists('..\..\packages\Xamarin.Forms.2.3.2.127\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.2.3.2.127\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets'))" /> <Error Condition="!Exists('..\..\packages\Xamarin.Forms.2.3.0.34-pre1\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.2.3.0.34-pre1\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets'))" />
</Target> </Target>
<Import Project="..\..\packages\Xamarin.GooglePlayServices.Basement.29.0.0.2\build\Xamarin.GooglePlayServices.Basement.targets" Condition="Exists('..\..\packages\Xamarin.GooglePlayServices.Basement.29.0.0.2\build\Xamarin.GooglePlayServices.Basement.targets')" /> <Import Project="..\..\packages\Xamarin.GooglePlayServices.Basement.29.0.0.2\build\Xamarin.GooglePlayServices.Basement.targets" Condition="Exists('..\..\packages\Xamarin.GooglePlayServices.Basement.29.0.0.2\build\Xamarin.GooglePlayServices.Basement.targets')" />
<Import Project="..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" /> <Import Project="..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" />
<Import Project="..\..\packages\Xamarin.Forms.2.3.2.127\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.2.3.2.127\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" /> <Import Project="..\..\packages\Xamarin.Forms.2.3.0.34-pre1\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.2.3.0.34-pre1\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">

View file

@ -41,7 +41,7 @@ using XLabs.Caching;
namespace BookAStar.Droid namespace BookAStar.Droid
{ {
[Activity(Name="fr.pschneider.bas.MainActivity", Label = "BookAStar", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] [Activity(Name="fr.pschneider.bas.MainActivity", Label = "BookAStar", Theme = "@style/MainTheme", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : public class MainActivity :
XFormsApplicationDroid, XFormsApplicationDroid,
// was global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity, // was global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity,
@ -51,23 +51,23 @@ namespace BookAStar.Droid
{ {
base.OnCreate(bundle); base.OnCreate(bundle);
// Window.RequestFeature(Android.Views.WindowFeatures.ActionBar);
if (Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat) if (Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat)
{ {
Android.Webkit.WebView.SetWebContentsDebuggingEnabled(true); Android.Webkit.WebView.SetWebContentsDebuggingEnabled(true);
} }
// no Resolver.IsSet IXFormsApp<XFormsApplicationDroid> app =null;
if (!Resolver.IsSet) if (!Resolver.IsSet)
{ {
this.SetIoc(); this.SetIoc();
} }
else else
{ {
var app = Resolver.Resolve<IXFormsApp>() as IXFormsApp<XFormsApplicationDroid>; app = Resolver.Resolve<IXFormsApp>() as IXFormsApp<XFormsApplicationDroid>;
if (app != null) app.AppContext = this; if (app != null)
app.AppContext = this;
} }
global::Xamarin.Forms.Forms.Init(this, bundle); global::Xamarin.Forms.Forms.Init(this, bundle);
global::Xamarin.FormsMaps.Init(this, bundle); global::Xamarin.FormsMaps.Init(this, bundle);
@ -86,14 +86,14 @@ namespace BookAStar.Droid
// Theme.ApplyStyle(Resource.Style.MainTheme, false); // Theme.ApplyStyle(Resource.Style.MainTheme, false);
// XmlREader tb = Resources.GetLayout(Resource.Layout.Toolbar); // XmlREader tb = Resources.GetLayout(Resource.Layout.Toolbar);
var tb = new Toolbar(this.BaseContext); // FIXME Why does Forms try to theme this toolbar?
var tb = new Toolbar(this.BaseContext);
this.SetActionBar(tb); this.SetActionBar(tb);
LoadApplication(new BookAStar.App(this)); LoadApplication(new BookAStar.App(this));
/*
// TabLayoutResource = Resource.Layout.Tabbar; // TabLayoutResource = Resource.Layout.Tabbar;
// ToolbarResource = Resource.Layout.Toolbar; // ToolbarResource = Resource.Layout.Toolbar;
/*
base.OnCreate(bundle); base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle); global::Xamarin.Forms.Forms.Init(this, bundle);
global::Xamarin.FormsMaps.Init(this, bundle); global::Xamarin.FormsMaps.Init(this, bundle);
@ -112,8 +112,8 @@ namespace BookAStar.Droid
app.Init(this); app.Init(this);
var documents = app.AppDataDirectory; var documents = app.AppDataDirectory;
var pathToDatabase = Path.Combine(documents, "xforms.db"); var pathToDatabase = Path.Combine(documents, "xforms.db");
resolverContainer.Register<IDevice>(t => AndroidDevice.CurrentDevice) resolverContainer.Register<IDevice>(t => AndroidDevice.CurrentDevice)
.Register<IDisplay>(t => t.Resolve<IDevice>().Display) .Register<IDisplay>(t => t.Resolve<IDevice>().Display)
@ -127,8 +127,6 @@ namespace BookAStar.Droid
.Register<ICacheProvider>( .Register<ICacheProvider>(
t => new SQLiteSimpleCache(new SQLitePlatformAndroid(), t => new SQLiteSimpleCache(new SQLitePlatformAndroid(),
new SQLiteConnectionString(pathToDatabase, true), t.Resolve<IJsonSerializer>())); new SQLiteConnectionString(pathToDatabase, true), t.Resolve<IJsonSerializer>()));
Resolver.SetResolver(resolverContainer.GetResolver()); Resolver.SetResolver(resolverContainer.GetResolver());
} }
@ -199,7 +197,7 @@ namespace BookAStar.Droid
{ {
Task.Run(async () => Task.Run(async () =>
{ {
App.CurrentApp.ShowBookQuery( App.ShowBookQuery(
await DataManager.Current.BookQueries.Get(queryId)); await DataManager.Current.BookQueries.Get(queryId));
}); });
} }

View file

@ -5,7 +5,6 @@
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="monoandroid60" /> <package id="Newtonsoft.Json" version="9.0.1" targetFramework="monoandroid60" />
<package id="Plugin.CurrentActivity" version="1.0.1" targetFramework="monoandroid70" /> <package id="Plugin.CurrentActivity" version="1.0.1" targetFramework="monoandroid70" />
<package id="Plugin.Permissions" version="1.1.7" targetFramework="monoandroid70" /> <package id="Plugin.Permissions" version="1.1.7" targetFramework="monoandroid70" />
<package id="Scorchio.NinjaCoder.Xamarin.Forms.Labs" version="2.0.0" targetFramework="monoandroid70" />
<package id="SQLite.Net.Async-PCL" version="3.1.1" targetFramework="monoandroid70" /> <package id="SQLite.Net.Async-PCL" version="3.1.1" targetFramework="monoandroid70" />
<package id="SQLite.Net.Core-PCL" version="3.1.1" targetFramework="monoandroid70" /> <package id="SQLite.Net.Core-PCL" version="3.1.1" targetFramework="monoandroid70" />
<package id="SQLite.Net-PCL" version="3.1.1" targetFramework="monoandroid70" /> <package id="SQLite.Net-PCL" version="3.1.1" targetFramework="monoandroid70" />
@ -23,7 +22,7 @@
<package id="Xamarin.Android.Support.v7.RecyclerView" version="23.3.0" targetFramework="monoandroid60" /> <package id="Xamarin.Android.Support.v7.RecyclerView" version="23.3.0" targetFramework="monoandroid60" />
<package id="Xamarin.Android.Support.Vector.Drawable" version="23.3.0" targetFramework="monoandroid60" /> <package id="Xamarin.Android.Support.Vector.Drawable" version="23.3.0" targetFramework="monoandroid60" />
<package id="Xamarin.Controls.SignaturePad" version="1.4.0" targetFramework="monoandroid70" /> <package id="Xamarin.Controls.SignaturePad" version="1.4.0" targetFramework="monoandroid70" />
<package id="Xamarin.Forms" version="2.3.2.127" targetFramework="monoandroid70" /> <package id="Xamarin.Forms" version="2.3.0.34-pre1" targetFramework="monoandroid70" />
<package id="Xamarin.Forms.Labs" version="1.0.1.0" targetFramework="monoandroid70" /> <package id="Xamarin.Forms.Labs" version="1.0.1.0" targetFramework="monoandroid70" />
<package id="Xamarin.GooglePlayServices.Ads" version="29.0.0.2" targetFramework="monoandroid41" /> <package id="Xamarin.GooglePlayServices.Ads" version="29.0.0.2" targetFramework="monoandroid41" />
<package id="Xamarin.GooglePlayServices.Analytics" version="29.0.0.2" targetFramework="monoandroid41" /> <package id="Xamarin.GooglePlayServices.Analytics" version="29.0.0.2" targetFramework="monoandroid41" />

View file

@ -40,14 +40,13 @@
<Setter Property="FontAttributes" Value="Italic" /> <Setter Property="FontAttributes" Value="Italic" />
<Setter Property="HorizontalOptions" Value="Center" /> <Setter Property="HorizontalOptions" Value="Center" />
<Setter Property="TextColor" Value="{StaticResource GroupingTextColor}" /> <Setter Property="TextColor" Value="{StaticResource GroupingTextColor}" />
<Setter Property="VerticalOptions" Value="Start" />
</Style> </Style>
<Style x:Key="LabelStyle" TargetType="Label"> <Style x:Key="LabelStyle" TargetType="Label">
<Setter Property="TextColor" Value="{StaticResource TextColor}" /> <Setter Property="TextColor" Value="{StaticResource TextColor}" />
<Setter Property="FontAttributes" Value="Bold" /> <Setter Property="FontAttributes" Value="Bold" />
<Setter Property="FontSize" Value="{StaticResource MediumFontSize}" /> <Setter Property="FontSize" Value="{StaticResource MediumFontSize}" />
<Setter Property="VerticalOptions" Value="Start" />
<Setter Property="HorizontalOptions" Value="Start" />
<Setter Property="LineBreakMode" Value="WordWrap" /> <Setter Property="LineBreakMode" Value="WordWrap" />
</Style> </Style>

View file

@ -11,7 +11,9 @@ using System.Linq;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
using XLabs.Forms.Controls;
using XLabs.Forms.Mvvm; using XLabs.Forms.Mvvm;
using XLabs.Forms.Pages;
using XLabs.Forms.Services; using XLabs.Forms.Services;
using XLabs.Ioc; using XLabs.Ioc;
using XLabs.Platform.Mvvm; using XLabs.Platform.Mvvm;
@ -30,16 +32,30 @@ namespace BookAStar
{ {
public static IPlatform PlatformSpecificInstance { get; set; } public static IPlatform PlatformSpecificInstance { get; set; }
public static string AppName { get; set; } public static string AppName { get; set; }
public void ShowQueries()
{
masterDetail.Detail = bQueriesPage;
masterDetail.SendBackButtonPressed();
}
public void ShowAccounts()
{
masterDetail.Detail = accChooserPage;
masterDetail.SendBackButtonPressed();
}
// Exists in order to dispose of a static instance strongly typed
// TODO : replace all references to this field
// by Views resolution, and then, drop it
public static App CurrentApp { get { return Current as App; } } public static App CurrentApp { get { return Current as App; } }
public DataManager DataManager { get; set; } = new DataManager();
public static void Init() public static void Init()
{ {
var app = Resolver.Resolve<IXFormsApp>(); var app = Resolver.Resolve<IXFormsApp>();
if (app == null) if (app == null)
{ {
return; return;
} }
// navigation registration
app.Closing += (o, e) => Debug.WriteLine("Application Closing"); app.Closing += (o, e) => Debug.WriteLine("Application Closing");
app.Error += (o, e) => Debug.WriteLine("Application Error"); app.Error += (o, e) => Debug.WriteLine("Application Error");
@ -50,40 +66,54 @@ namespace BookAStar
app.Suspended += (o, e) => Debug.WriteLine("Application Suspended"); app.Suspended += (o, e) => Debug.WriteLine("Application Suspended");
} }
public void Configure(IXFormsApp app)
{
ViewFactory.EnableCache = true;
ViewFactory.Register<DashboardPage, DashboardViewModel>(
resolver => new DashboardViewModel());
ViewFactory.Register<BookQueryPage, BookQueryViewModel>();
ViewFactory.Register<EditBillingLinePage, BillingLineViewModel>();
ViewFactory.Register<EditEstimatePage, EstimateViewModel>();
}
ExtendedMasterDetailPage masterDetail;
public App(IPlatform instance) public App(IPlatform instance)
{ {
PlatformSpecificInstance = instance; PlatformSpecificInstance = instance;
InitializeComponent(); InitializeComponent();
Init(); Init();
MainPage = GetMainPage(); BuildMainPage();
} }
BookQueriesPage bQueriesPage;
AccountChooserPage accChooserPage;
HomePage home;
public static Page GetMainPage() private void BuildMainPage()
{ {
ViewFactory.Register<SettingsPage,SettingsViewModel>(); accChooserPage = new AccountChooserPage();
ViewFactory.Register<BookQueryPage, BookQueryViewModel>(
resolver => new BookQueryViewModel ()
);
var bQueriesPage = new BookQueriesPage bQueriesPage = new BookQueriesPage
{ {
BindingContext = DataManager.Current.BookQueries, BindingContext = DataManager.Current.BookQueries,
Title = "Demandes" Title = "Demandes"
}; };
// var mainPage = new NavigationPage(bQueriesPage); home = new HomePage() { Title = "Accueil" };
var mainPage = new XLabs.Forms.Pages.ExtendedMasterDetailPage() { // var mainPage = new NavigationPage(bQueriesPage);
/*
masterDetail = new ExtendedMasterDetailPage() {
Title="MainPAge" Title="MainPAge"
}; };
mainPage.Master = bQueriesPage; masterDetail.Master = new DashboardPage {
mainPage.Detail = new SettingsPage(); Title = "Bookingstar",
BindingContext = new DashboardViewModel() };
Resolver.Resolve<IDependencyContainer>() masterDetail.Detail = new HomePage { Title = "Accueil" };
.Register<INavigationService>(t => new NavigationService(mainPage.Navigation));
*/
ToolbarItem tiSetts = new ToolbarItem() ToolbarItem tiSetts = new ToolbarItem()
{ {
Text = "Paramètres", Text = "Paramètres",
@ -95,9 +125,11 @@ namespace BookAStar
Text = "Accueil", Text = "Accueil",
Icon = "icon.png" Icon = "icon.png"
}; };
mainPage.ToolbarItems.Add(tiHome);
mainPage.ToolbarItems.Add(tiSetts);
return mainPage;
/* searchPage = new SearchPage /* searchPage = new SearchPage
{ {
@ -161,13 +193,33 @@ namespace BookAStar
}; };
MainPage = Navigation; MainPage = Navigation;
*/ */
var mainTab = new ExtendedTabbedPage()
{
Title = "XLabs",
SwipeEnabled = true,
TintColor = Color.White,
BarTintColor = Color.Blue,
Badges = { "1", "2", "3" },
TabBarBackgroundImage = "visuel_sexion.png",
TabBarSelectedImage = "icon.png",
};
var navPage = new NavigationPage(bQueriesPage);
//var navPage = new NavigationPage(mainTab);
navPage.ToolbarItems.Add(tiHome);
navPage.ToolbarItems.Add(tiSetts);
this.MainPage = navPage;
Resolver.Resolve<IDependencyContainer>()
.Register<INavigationService>(t => new NavigationService(navPage.Navigation))
;
} }
internal void EditCommandLine(Page parentPage, CommandLine com) internal void EditCommandLine(Page parentPage, BillingLine com)
{ {
CommandLineEditorPage editCommandLine = new CommandLineEditorPage EditBillingLinePage editCommandLine = new EditBillingLinePage
{ {
Title = "Edition d'une ligne de facture", Title = "Edition d'une ligne de facture",
BindingContext = com BindingContext = com
@ -182,25 +234,11 @@ namespace BookAStar
PlatformSpecificInstance.GetDeviceInfo()); PlatformSpecificInstance.GetDeviceInfo());
} }
public void ShowBookQuery(BookQueryData data) public static void ShowBookQuery (BookQueryData query)
{ {
BookQueryPage bookQueryPage = new BookQueryPage var page = ViewFactory.CreatePage<BookQueryViewModel
{ , BookQueryPage>(null, new BookQueryViewModel(query));
Title = "Demande de devis", App.Current.MainPage.Navigation.PushAsync(page as Page);
BindingContext = data
};
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);
} }
// TODO système de persistance de l'état de l'appli // TODO système de persistance de l'état de l'appli
@ -212,12 +250,12 @@ namespace BookAStar
/// <param name="parentPage">Parent Page</param> /// <param name="parentPage">Parent Page</param>
/// <param name="pageType">Type of page to show</param> /// <param name="pageType">Type of page to show</param>
/// <returns></returns> /// <returns></returns>
private static async Task ShowPage(VisualElement parentPage, Type pageType) public static async Task ShowPage(VisualElement parentPage, Type pageType)
{ {
// Get all the constructors of the page type. // Get all the constructors of the page type.
var constructors = pageType.GetTypeInfo().DeclaredConstructors; var constructors = pageType.GetTypeInfo().DeclaredConstructors;
foreach ( var page in foreach (var page in
from constructor in constructors from constructor in constructors
where constructor.GetParameters().Length == 0 where constructor.GetParameters().Length == 0
select (Page)constructor.Invoke(null)) select (Page)constructor.Invoke(null))

View file

@ -42,16 +42,20 @@
</Compile> </Compile>
<Compile Include="Constants.cs" /> <Compile Include="Constants.cs" />
<Compile Include="Factories\ViewFactory.cs" /> <Compile Include="Factories\ViewFactory.cs" />
<Compile Include="Helpers\AvatarImageSource.cs" />
<Compile Include="Helpers\DataManager.cs" /> <Compile Include="Helpers\DataManager.cs" />
<Compile Include="Helpers\PageHelpers.cs" />
<Compile Include="Helpers\PropertySupport.cs" /> <Compile Include="Helpers\PropertySupport.cs" />
<Compile Include="Helpers\RemoteEntityRO.cs" /> <Compile Include="Helpers\RemoteEntityRO.cs" />
<Compile Include="Helpers\Settings.cs" /> <Compile Include="Helpers\Settings.cs" />
<Compile Include="Helpers\UserHelpers.cs" />
<Compile Include="Interfaces\IComponentContext.cs" /> <Compile Include="Interfaces\IComponentContext.cs" />
<Compile Include="Interfaces\IMDEditor.cs" /> <Compile Include="Interfaces\IMDEditor.cs" />
<Compile Include="Interfaces\IModelViewModel.cs" /> <Compile Include="Interfaces\IModelViewModel.cs" />
<Compile Include="Interfaces\IViewFactory.cs" /> <Compile Include="Interfaces\IViewFactory.cs" />
<Compile Include="Model\ClientProviderInfo.cs" /> <Compile Include="Model\ClientProviderInfo.cs" />
<Compile Include="Interfaces\IBookQueryData.cs" />
<Compile Include="Interfaces\IBillingLine.cs" />
<Compile Include="Interfaces\IEstimate.cs" />
<Compile Include="Pages\BlogPage.cs" /> <Compile Include="Pages\BlogPage.cs" />
<Compile Include="Pages\BookQueriesPage.xaml.cs"> <Compile Include="Pages\BookQueriesPage.xaml.cs">
<DependentUpon>BookQueriesPage.xaml</DependentUpon> <DependentUpon>BookQueriesPage.xaml</DependentUpon>
@ -59,8 +63,11 @@
<Compile Include="Pages\BookQueryPage.xaml.cs"> <Compile Include="Pages\BookQueryPage.xaml.cs">
<DependentUpon>BookQueryPage.xaml</DependentUpon> <DependentUpon>BookQueryPage.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Pages\CommandLineEditorPage.xaml.cs"> <Compile Include="Pages\EditBillingLinePage.xaml.cs">
<DependentUpon>CommandLineEditorPage.xaml</DependentUpon> <DependentUpon>EditBillingLinePage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\DashboardPage.xaml.cs">
<DependentUpon>DashboardPage.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Pages\EventDetail.xaml.cs"> <Compile Include="Pages\EventDetail.xaml.cs">
<DependentUpon>EventDetail.xaml</DependentUpon> <DependentUpon>EventDetail.xaml</DependentUpon>
@ -72,7 +79,7 @@
<Compile Include="Model\Blog\BlogTag.cs" /> <Compile Include="Model\Blog\BlogTag.cs" />
<Compile Include="Model\BookQueryData.cs" /> <Compile Include="Model\BookQueryData.cs" />
<Compile Include="Model\Market\BaseProduct.cs" /> <Compile Include="Model\Market\BaseProduct.cs" />
<Compile Include="Model\Workflow\CommandLine.cs" /> <Compile Include="Model\Workflow\BillingLine.cs" />
<Compile Include="Model\Manager.cs" /> <Compile Include="Model\Manager.cs" />
<Compile Include="Model\Auth\MobileAppDeclaration.cs" /> <Compile Include="Model\Auth\MobileAppDeclaration.cs" />
<Compile Include="Model\Auth\passwrecovery.cs" /> <Compile Include="Model\Auth\passwrecovery.cs" />
@ -110,10 +117,16 @@
<Compile Include="Pages\EditEstimatePage.xaml.cs"> <Compile Include="Pages\EditEstimatePage.xaml.cs">
<DependentUpon>EditEstimatePage.xaml</DependentUpon> <DependentUpon>EditEstimatePage.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Pages\HomePage.xaml.cs">
<DependentUpon>HomePage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\PinPage.cs" /> <Compile Include="Pages\PinPage.cs" />
<Compile Include="ViewModels\BookQueriesViewModel.cs" /> <Compile Include="ViewModels\BookQueriesViewModel.cs" />
<Compile Include="ViewModels\BookQueryViewModel.cs" /> <Compile Include="ViewModels\BookQueryViewModel.cs" />
<Compile Include="ViewModels\SettingsViewModel.cs" /> <Compile Include="ViewModels\BillingLineViewModel.cs" />
<Compile Include="ViewModels\DashboardViewModel.cs" />
<Compile Include="ViewModels\EstimateViewModel.cs" />
<Compile Include="ViewModels\UserLoginViewModel.cs" />
<Compile Include="ViewModels\ViewModelBase.cs" /> <Compile Include="ViewModels\ViewModelBase.cs" />
<Compile Include="Views\CommandLineEditor.xaml.cs"> <Compile Include="Views\CommandLineEditor.xaml.cs">
<DependentUpon>CommandLineEditor.xaml</DependentUpon> <DependentUpon>CommandLineEditor.xaml</DependentUpon>
@ -123,8 +136,8 @@
<Compile Include="Pages\SearchPage.xaml.cs"> <Compile Include="Pages\SearchPage.xaml.cs">
<DependentUpon>SearchPage.xaml</DependentUpon> <DependentUpon>SearchPage.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Pages\SettingsPage.xaml.cs"> <Compile Include="Pages\AccountChooserPage.xaml.cs">
<DependentUpon>SettingsPage.xaml</DependentUpon> <DependentUpon>AccountChooserPage.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Model\Tag.cs" /> <Compile Include="Model\Tag.cs" />
</ItemGroup> </ItemGroup>
@ -137,7 +150,9 @@
<ItemGroup> <ItemGroup>
<None Include="app.config" /> <None Include="app.config" />
<None Include="GettingStarted.Xamarin" /> <None Include="GettingStarted.Xamarin" />
<None Include="packages.config" /> <None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Pages\EventDetail.xaml"> <EmbeddedResource Include="Pages\EventDetail.xaml">
@ -148,7 +163,7 @@
<Generator>MSBuild:UpdateDesignTimeXaml</Generator> <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Pages\SettingsPage.xaml"> <EmbeddedResource Include="Pages\AccountChooserPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator> <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
@ -186,19 +201,23 @@
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.2.3.2.127\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Core.dll</HintPath> <HintPath>..\..\packages\Xamarin.Forms.2.3.0.34-pre1\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Core.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Xamarin.Forms.Maps, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Xamarin.Forms.Maps, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.Maps.2.3.2.127\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Maps.dll</HintPath> <HintPath>..\..\packages\Xamarin.Forms.Maps.2.3.0.34-pre1\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Maps.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Xamarin.Forms.Platform, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Xamarin.Forms.Platform, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.2.3.2.127\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Platform.dll</HintPath> <HintPath>..\..\packages\Xamarin.Forms.2.3.0.34-pre1\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Platform.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.2.3.2.127\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Xaml.dll</HintPath> <HintPath>..\..\packages\Xamarin.Forms.2.3.0.34-pre1\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Xaml.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="XLabs.Caching, Version=2.2.0.38182, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\XLabs.Caching.2.2.0-pre05\lib\portable-net45+netcore45+wpa81+wp8+monoandroid+monotouch+xamarinios10+xamarinmac\XLabs.Caching.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="XLabs.Core, Version=2.2.0.38178, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="XLabs.Core, Version=2.2.0.38178, Culture=neutral, processorArchitecture=MSIL">
@ -221,6 +240,10 @@
<HintPath>..\..\packages\XLabs.Serialization.2.2.0-pre05\lib\portable-net45+netcore45+wpa81+wp8+monoandroid+monotouch+xamarinios10+xamarinmac\XLabs.Serialization.dll</HintPath> <HintPath>..\..\packages\XLabs.Serialization.2.2.0-pre05\lib\portable-net45+netcore45+wpa81+wp8+monoandroid+monotouch+xamarinios10+xamarinmac\XLabs.Serialization.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="XLabs.Serialization.Json.NET, Version=2.2.0.38187, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\XLabs.Serialization.JSON.2.2.0-pre05\lib\portable-net45+netcore45+wpa81+wp8+monoandroid+monotouch+xamarinios10+xamarinmac\XLabs.Serialization.Json.NET.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Pages\BookQueryPage.xaml"> <EmbeddedResource Include="Pages\BookQueryPage.xaml">
@ -246,9 +269,6 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
<ItemGroup>
<EmbeddedResource Include="icon-anon.png" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Views\CommandLineEditor.xaml"> <EmbeddedResource Include="Views\CommandLineEditor.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
@ -256,18 +276,38 @@
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Pages\CommandLineEditorPage.xaml"> <EmbeddedResource Include="Pages\EditBillingLinePage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Pages\DashboardPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Images\icon_add_user.png" />
<EmbeddedResource Include="Images\icon_anon_user.png" />
<EmbeddedResource Include="Images\icon_block_user.png" />
<EmbeddedResource Include="Images\icon_remove_user.png" />
<EmbeddedResource Include="Images\icon_user.png" />
<EmbeddedResource Include="Images\icon_user_settings.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Pages\HomePage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator> <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="..\..\packages\Xamarin.Forms.2.3.2.127\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.2.3.2.127\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" /> <Import Project="..\..\packages\Xamarin.Forms.2.3.0.34-pre1\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.2.3.0.34-pre1\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup> <PropertyGroup>
<ErrorText>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}.</ErrorText> <ErrorText>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}.</ErrorText>
</PropertyGroup> </PropertyGroup>
<Error Condition="!Exists('..\..\packages\Xamarin.Forms.2.3.2.127\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.2.3.2.127\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets'))" /> <Error Condition="!Exists('..\..\packages\Xamarin.Forms.2.3.0.34-pre1\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.2.3.0.34-pre1\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets'))" />
</Target> </Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View file

@ -21,31 +21,5 @@ namespace BookAStar
#endregion #endregion
#region Colors & sizes
[Obsolete]
public static readonly Thickness PagePadding =
new Thickness(5, Device.OnPlatform(20, 20, 20), 5, 5);
[Obsolete]
public static readonly Thickness DefaultPadding =
new Thickness(5, Device.OnPlatform(20, 20, 20), 3, 3);
[Obsolete]
public static readonly Font TitleFont =
Font.SystemFontOfSize(Device.OnPlatform(50, 50, 50), FontAttributes.Bold);
[Obsolete]
public static readonly Color OddBackgroundColor =
Device.OnPlatform(Color.Aqua, Color.Aqua, Color.Aqua);
[Obsolete]
public static readonly Color ForegroundColor =
Device.OnPlatform(Color.White, Color.White, Color.White);
[Obsolete]
public static readonly Color BackgroundColor =
Device.OnPlatform(Color.Black, Color.White, Color.White);
#endregion
} }
} }

View file

@ -1,30 +0,0 @@
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 MyExtension : IMarkupExtension
{
public string Source { get; set; }
public object ProvideValue(IServiceProvider serviceProvider)
{
// Do your translation lookup here, using whatever method you require
if (Source != null)
{
if (Source.StartsWith("res://"))
return ImageSource.FromResource(Source.Substring(6));
return ImageSource.FromUri(new Uri(Source));
}
return ImageSource.FromResource("BookAStar.icon-anon.png");
}
}
}

View file

@ -17,12 +17,12 @@ namespace BookAStar.Helpers
public RemoteEntity<Estimate, long> Estimates { get; set; } public RemoteEntity<Estimate, long> Estimates { get; set; }
public RemoteEntity<Blog, long> Blogspot { get; set; } public RemoteEntity<Blog, long> Blogspot { get; set; }
public LocalEntity<ClientProviderInfo,string> Contacts { get; set; } public LocalEntity<ClientProviderInfo,string> Contacts { get; set; }
protected static DataManager current = new DataManager();
public static DataManager Current public static DataManager Current
{ {
get get
{ {
return App.CurrentApp.DataManager; return current;
} }
} }

View file

@ -31,9 +31,10 @@ namespace BookAStar
private const string userNameKey = "user_id"; private const string userNameKey = "user_id";
private const string PushNotificationsKey = "pushNotifs"; private const string PushNotificationsKey = "pushNotifs";
private const string AllowGPSUsageKey = "allowGPSUsage";
private const string UserListsKey = "userList"; private const string UserListsKey = "userList";
private const string GoogleRegIdKey = "googleRedId"; private const string GoogleRegIdKey = "googleRedId";
private const string AllowProBookingOnlyKey = "allowProBookingOnly";
private static readonly string UserIdDefault = private static readonly string UserIdDefault =
@ -149,7 +150,7 @@ namespace BookAStar
App.CurrentApp.PostDeviceInfo(); App.CurrentApp.PostDeviceInfo();
} }
} }
// TODO else Unregister the device // TODO else Unregister this device
} }
} }
@ -175,13 +176,45 @@ namespace BookAStar
PushNotificationsDefault); PushNotificationsDefault);
} }
set { set {
// TODO Stop Broadcast receiver
AppSettings.AddOrUpdateValue<bool> ( AppSettings.AddOrUpdateValue<bool> (
PushNotificationsKey, PushNotificationsKey,
value); value);
} }
} }
public static void SetMusical (string key, double value) public static bool AllowGPSUsage
{
get
{
return AppSettings.GetValueOrDefault<bool>(
AllowGPSUsageKey,
PushNotificationsDefault);
}
set
{
AppSettings.AddOrUpdateValue<bool>(
AllowGPSUsageKey,
value);
}
}
// TODO make it a server side user's parameter
public static bool AllowProBookingOnly
{
get
{
return AppSettings.GetValueOrDefault<bool>(
AllowProBookingOnlyKey,
PushNotificationsDefault);
}
set
{
AppSettings.AddOrUpdateValue<bool>(
AllowProBookingOnlyKey,
value);
}
}
public static void SetMusical (string key, double value)
{ {
AppSettings.AddOrUpdateValue <double> (MusicalKey + key, value); AppSettings.AddOrUpdateValue <double> (MusicalKey + key, value);
} }

View file

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace BookAStar.Helpers
{
public static class PageHelpers
{
public static async Task<bool> Confirm(this Page page, string title, string procedure)
{
string yes = "Oui", no = "Non";
var answer = await page.DisplayAlert(title,
procedure, yes, no);
return answer;
}
}
}

View file

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace BookAStar.Helpers
{
public static class UserHelpers
{
public static ImageSource Avatar(string avatarPath)
{
/*foreach (var r in App.Current.Resources)
{
Debug.WriteLine($"#R# {r.Key} : {r.GetType().Name}");
}*/
var result = avatarPath == null ?
ImageSource.FromResource(/* "BookAStar.icon_user.png" */ "BookAStar.Images.icon_user.png") :
avatarPath.StartsWith("res://") ?
ImageSource.FromResource(avatarPath.Substring(6)) :
ImageSource.FromUri(new Uri(avatarPath));
var test = ImageSource.FromResource("none.resource.png");
return result;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

View file

@ -0,0 +1,12 @@
using System;
namespace BookAStar.Interfaces
{
public interface IBillingLine
{
int Count { get; set; }
string Description { get; set; }
TimeSpan Duration { get; set; }
decimal UnitaryCost { get; set; }
}
}

View file

@ -0,0 +1,15 @@
using System;
using BookAStar.Model.Social;
using BookAStar.Model;
namespace BookAStar.Interfaces
{
public interface IBookQueryData
{
ClientProviderInfo Client { get; set; }
DateTime EventDate { get; set; }
long Id { get; set; }
Location Location { get; set; }
decimal? Previsionnal { get; set; }
}
}

View file

@ -0,0 +1,20 @@
using BookAStar.Model.Workflow;
using System.Collections.Generic;
namespace BookAStar.Model.Interfaces
{
public interface IEstimate
{
List<string> AttachedFiles { get; set; }
List<string> AttachedGraphicList { get; }
List<BillingLine> Bill { get; set; }
string ClientId { get; set; }
long? CommandId { get; set; }
string CommandType { get; set; }
string Description { get; set; }
long Id { get; set; }
string OwnerId { get; set; }
int? Status { get; set; }
string Title { get; set; }
}
}

View file

@ -1,11 +1,12 @@
using System; using BookAStar.Helpers;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel; using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xamarin.Forms;
namespace BookAStar.Model.Auth.Account namespace BookAStar.Model.Auth.Account
{ {
@ -79,6 +80,13 @@ namespace BookAStar.Model.Auth.Account
OnPropertyChanged("Avatar"); OnPropertyChanged("Avatar");
} }
} }
public ImageSource AvatarSource
{
get
{
return UserHelpers.Avatar(avatar);
}
}
private Tokens yavscTokens; private Tokens yavscTokens;
public Tokens YavscTokens public Tokens YavscTokens
{ {

View file

@ -1,9 +1,10 @@
using BookAStar.Model.Social; using BookAStar.Interfaces;
using BookAStar.Model.Social;
using System; using System;
namespace BookAStar.Model namespace BookAStar.Model
{ {
public class BookQueryData public class BookQueryData : IBookQueryData
{ {
public ClientProviderInfo Client { get; set; } public ClientProviderInfo Client { get; set; }
public Location Location { get; set; } public Location Location { get; set; }

View file

@ -1,4 +1,5 @@
using BookAStar.Model.Social; using BookAStar.Helpers;
using BookAStar.Model.Social;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -13,18 +14,18 @@ namespace BookAStar.Model
public string UserName { get; set; } public string UserName { get; set; }
public string Avatar { 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 string UserId { get; set; }
public int Rate { get; set; } public int Rate { get; set; }
public string EMail { get; set; } public string EMail { get; set; }
public string Phone { get; set; } public string Phone { get; set; }
public Location BillingAddress { get; set; } public Location BillingAddress { get; set; }
// TODO Get User Professional status existence as a boolean
// And hack the avatar with
public ImageSource AvatarOrNot public ImageSource AvatarOrNot
{ {
get get
{ {
return Avatar ?? ImageSource.FromResource("BookAStar.icon-anon.png"); return UserHelpers.Avatar(Avatar);
} }
} }
} }

View file

@ -1,13 +1,14 @@
 
using BookAStar.Interfaces;
using System; using System;
namespace BookAStar.Model.Workflow namespace BookAStar.Model.Workflow
{ {
public class CommandLine public class BillingLine : IBillingLine
{ {
public string Description { get; set; } public string Description { get; set; }
public TimeSpan Duration { get; set; } public TimeSpan Duration { get; set; }
public int Count { get; set; } public int Count { get; set; } = 1;
public decimal UnitaryCost { get; set; } public decimal UnitaryCost { get; set; }
} }
} }

View file

@ -1,4 +1,5 @@
using BookAStar.Helpers; using BookAStar.Helpers;
using BookAStar.Model.Interfaces;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -7,7 +8,7 @@ using Xamarin.Forms;
namespace BookAStar.Model.Workflow namespace BookAStar.Model.Workflow
{ {
public partial class Estimate public partial class Estimate : IEstimate
{ {
public long Id { get; set; } public long Id { get; set; }
public long? CommandId { get; set; } public long? CommandId { get; set; }
@ -16,7 +17,7 @@ namespace BookAStar.Model.Workflow
public string Description { get; set; } public string Description { get; set; }
public int? Status { get; set; } public int? Status { get; set; }
public string Title { get; set; } public string Title { get; set; }
public List<CommandLine> Bill { get; set; } public List<BillingLine> Bill { get; set; }
/// <summary> /// <summary>
/// List of attached graphic files /// List of attached graphic files
/// to this estimate, as relative pathes to /// to this estimate, as relative pathes to

View file

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:local="clr-namespace:BookAStar;assembly=BookAStar"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="BookAStar.Pages.AccountChooserPage"
Title="Paramètres Booking star" Style="{StaticResource PageStyle}"
xmlns:lc="clr-namespace:XLabs.Forms.Controls;assembly=XLabs.Forms"
xmlns:lb="clr-namespace:XLabs.Forms.Behaviors;assembly=XLabs.Forms">
<StackLayout>
<Label Text="Compte utilisateur" StyleClass="Header"/>
<ListView x:Name="AccountListView"
SeparatorVisibility="Default"
VerticalOptions="FillAndExpand"
>
<ListView.Header>
<StackLayout Orientation="Horizontal">
<Button x:Name="AddAccountBtn" Text="Connection, ou création d'un compte" />
</StackLayout>
</ListView.Header>
<ListView.ItemTemplate HeightRequest="60" VerticalOptions="StartAndExpand">
<DataTemplate>
<ViewCell>
<lc:GesturesContentView>
<Grid Padding="5"
ColumnSpacing="10"
RowSpacing="2" >
<Image Source="{Binding AvatarSource}" HeightRequest="80"
x:Name="avatarImage"/>
<Label Grid.Column="0" Text="{Binding UserName}" >
</Label>
</Grid>
<lb:Gestures.Interests>
<lb:GestureCollection>
<lb:GestureInterest GestureType="Swipe" Direction="Left" GestureCommand="{Binding DumpParam}" GestureParameter="{Binding UserName}"/>
</lb:GestureCollection>
</lb:Gestures.Interests>
</lc:GesturesContentView>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.Footer>
<StackLayout></StackLayout>
</ListView.Footer>
</ListView>
</StackLayout>
</ContentPage>

View file

@ -6,17 +6,19 @@ using System.Windows.Input;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using BookAStar.Helpers;
using XLabs.Forms.Behaviors;
using System.Diagnostics;
using XLabs.Forms.Controls;
namespace BookAStar namespace BookAStar.Pages
{ {
public partial class SettingsPage : ContentPage public partial class AccountChooserPage : ContentPage
{ {
public ICommand RemoteSettingsRefreshCommand { get; private set; } public ICommand RemoteSettingsRefreshCommand { get; private set; }
public SettingsPage () public AccountChooserPage ()
{ {
InitializeComponent (); InitializeComponent ();
@ -28,19 +30,20 @@ namespace BookAStar
AddAccountBtn.Clicked += AddAccountBtn_Clicked; AddAccountBtn.Clicked += AddAccountBtn_Clicked;
RemoveAccountBouton.Clicked += RemoveAccountBouton_Clicked; // avatarImage.
//RemoveAccountBouton.Clicked += RemoveAccountBouton_Clicked;
AccountListView.ItemSelected += Accounts_ItemSelected; AccountListView.ItemSelected += Accounts_ItemSelected;
DumpParam = new RelayGesture((g, x) =>
pushstatus.Toggled += Pushstatus_Toggled; {
if (g.GestureType == GestureType.Swipe && g.Direction == Directionality.Left)
} {
RemoveAccount();
protected void Pushstatus_Toggled(object sender, ToggledEventArgs e) }
{ });
MainSettings.PushNotifications = pushstatus.IsToggled;
} }
public RelayGesture DumpParam { get; set; }
public ObservableCollection<User> Accounts { get; private set; } public ObservableCollection<User> Accounts { get; private set; }
public Dictionary<string, double> Musical { get; private set; } public Dictionary<string, double> Musical { get; private set; }
public Dictionary<string, double> Environ { get; private set; } public Dictionary<string, double> Environ { get; private set; }
@ -49,31 +52,25 @@ namespace BookAStar
{ {
var user = e.SelectedItem as User; var user = e.SelectedItem as User;
// should later invoke IdentificationChanged // should later invoke IdentificationChanged
// FIXME don't do it when it's not from the user action
MainSettings.CurrentUser = user; MainSettings.CurrentUser = user;
} }
private async void RemoveAccountBouton_Clicked(object sender, EventArgs e) private async void RemoveAccount()
{ {
User user = AccountListView.SelectedItem as User; User user = AccountListView.SelectedItem as User;
var doIt = await Confirm("Suppression de l'identification", var doIt = await this.Confirm("Suppression de l'identification",
$"Vous êtes sur le point de supprimer votre identification pour ce compte : {user.UserName}\nContinuer ?"); $"Vous êtes sur le point de supprimer votre identification pour ce compte : {user.UserName}\nContinuer ?");
if (doIt) if (doIt)
App.PlatformSpecificInstance.RevokeAccount(user.UserName); App.PlatformSpecificInstance.RevokeAccount(user.UserName);
} }
async Task<bool> Confirm(string title, string procedure)
{
string yes = "Oui", no = "Non";
var answer = await DisplayAlert(title,
procedure, yes, no);
return answer;
}
protected override void OnAppearing() protected override void OnAppearing()
{ {
base.OnAppearing(); base.OnAppearing();
AccountListView.SelectedItem = MainSettings.CurrentUser; AccountListView.SelectedItem = MainSettings.CurrentUser;
pushstatus.IsToggled = MainSettings.PushNotifications;
} }
private void AddAccountBtn_Clicked(object sender, EventArgs e) private void AddAccountBtn_Clicked(object sender, EventArgs e)

View file

@ -3,8 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:BookAStar;assembly=BookAStar" xmlns:local="clr-namespace:BookAStar;assembly=BookAStar"
x:Class="BookAStar.Pages.BookQueriesPage" x:Class="BookAStar.Pages.BookQueriesPage"
Padding="{x:Static local:Constants.PagePadding}" Style="{StaticResource PageStyle}"
BackgroundColor="{x:Static local:Constants.BackgroundColor}"
> >
<ContentPage.Resources> <ContentPage.Resources>
<ResourceDictionary> <ResourceDictionary>
@ -17,7 +16,12 @@
<Setter Property="LineBreakMode" Value="WordWrap" /> <Setter Property="LineBreakMode" Value="WordWrap" />
</Style> </Style>
<Style TargetType="Label">
<Setter Property="Style" Value="{StaticResource ContentLabelStyle}" />
</Style>
<Style TargetType="Button">
<Setter Property="Style" Value="{StaticResource ButtonStyle}" />
</Style>
</ResourceDictionary> </ResourceDictionary>
</ContentPage.Resources> </ContentPage.Resources>
@ -29,7 +33,7 @@
<ViewCell> <ViewCell>
<ViewCell.View> <ViewCell.View>
<StackLayout Orientation="Horizontal" Padding="10,10,10,10" VerticalOptions="StartAndExpand"> <StackLayout Orientation="Horizontal" Padding="10,10,10,10" VerticalOptions="StartAndExpand">
<StackLayout Orientation="Vertical" BackgroundColor="{x:Static local:Constants.OddBackgroundColor}" <StackLayout Orientation="Vertical"
HeightRequest="80" VerticalOptions="StartAndExpand"> HeightRequest="80" VerticalOptions="StartAndExpand">
<StackLayout Orientation="Vertical" > <StackLayout Orientation="Vertical" >

View file

@ -8,6 +8,8 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input; using System.Windows.Input;
using Xamarin.Forms; using Xamarin.Forms;
using XLabs.Ioc;
using XLabs.Platform.Services;
namespace BookAStar.Pages namespace BookAStar.Pages
{ {
@ -42,7 +44,7 @@ namespace BookAStar.Pages
private void OnViewDetail(object sender, ItemTappedEventArgs e) private void OnViewDetail(object sender, ItemTappedEventArgs e)
{ {
BookQueryData data = e.Item as BookQueryData; BookQueryData data = e.Item as BookQueryData;
App.CurrentApp.ShowBookQuery(data); Resolver.Resolve<INavigationService>().NavigateTo<BookQueryPage>(true,data);
} }
} }
} }

View file

@ -4,8 +4,7 @@
xmlns:local="clr-namespace:BookAStar;assembly=BookAStar" xmlns:local="clr-namespace:BookAStar;assembly=BookAStar"
xmlns:maps="clr-namespace:Xamarin.Forms.Maps;assembly=Xamarin.Forms.Maps.dll" xmlns:maps="clr-namespace:Xamarin.Forms.Maps;assembly=Xamarin.Forms.Maps.dll"
x:Class="BookAStar.Pages.BookQueryPage" x:Class="BookAStar.Pages.BookQueryPage"
BackgroundColor="{x:Static local:Constants.BackgroundColor}" Style ="{StaticResource PageStyle}"
Padding="{x:Static local:Constants.PagePadding}"
> >
<ContentPage.Resources> <ContentPage.Resources>
<ResourceDictionary> <ResourceDictionary>

View file

@ -10,6 +10,9 @@ namespace BookAStar.Pages
using Model; using Model;
using Model.Workflow; using Model.Workflow;
using System.Threading.Tasks; using System.Threading.Tasks;
using XLabs.Forms.Mvvm;
using XLabs.Ioc;
using XLabs.Platform.Services;
public partial class BookQueryPage : ContentPage public partial class BookQueryPage : ContentPage
{ {
@ -70,7 +73,7 @@ namespace BookAStar.Pages
Id = 0, Id = 0,
Description = "# **Hello Estimate!**" Description = "# **Hello Estimate!**"
}; };
App.CurrentApp.EditEstimate(e); Resolver.Resolve<INavigationService>().NavigateTo<EditEstimatePage>(true, e);
} }
} }

View file

@ -0,0 +1,53 @@
<?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.DashboardPage"
xmlns:lc="clr-namespace:XLabs.Forms.Controls;assembly=XLabs.Forms"
xmlns:lb="clr-namespace:XLabs.Forms.Behaviors;assembly=XLabs.Forms"
Style="{StaticResource PageStyle}">
<ContentPage.Resources>
<ResourceDictionary>
<Style TargetType="Label">
<Setter Property="Style" Value="{StaticResource ContentLabelStyle}" />
</Style>
<Style TargetType="Button">
<Setter Property="Style" Value="{StaticResource ButtonStyle}" />
</Style>
</ResourceDictionary>
</ContentPage.Resources>
<ScrollView>
<StackLayout Orientation="Vertical" >
<lc:GesturesContentView>
<Frame>
<Label Text="Compte utilisateur" StyleClass="Header">
</Label>
<lb:Gestures.Interests>
<lb:GestureCollection>
<lb:GestureInterest GestureType="LongPress" GestureCommand="{Binding UserNameGesture}" GestureParameter="LongPress" />
</lb:GestureCollection>
</lb:Gestures.Interests>
<Image Source="{Binding Avatar}" Aspect="AspectFit" VisualElement.HeightRequest="{StaticResource BigUserAvatarSize}" />
</Frame>
</lc:GesturesContentView>
<Label Text="{Binding UserName}" Style="{StaticResource LabelPageHeadingStyle}"
HorizontalTextAlignment="Center"
LineBreakMode="WordWrap" XAlign="Center"
></Label>
<Button Text="{Binding PerformerStatus}" Clicked="OnViewPerformerStatus" />
<Button Text="{Binding UserQueries}" Clicked="OnViewUserQueries" />
<StackLayout Orientation="Horizontal" >
<Label Text="Recevoir les notifications push" StyleClass="Header" />
<Switch IsToggled="{Binding ReceivePushNotifications, Mode=TwoWay}"
HorizontalOptions="End" />
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label Text="Utiliser ma position" StyleClass="Header" />
<Switch HorizontalOptions="End" IsToggled="{Binding AllowUseMyPosition, Mode=TwoWay}"/>
</StackLayout>
<StackLayout Orientation="Horizontal" VerticalOptions="Start">
<Label Text="Ne recevoir de demande de devis que de la part de professionnels uniquement" StyleClass="Header"/>
<Switch HorizontalOptions="End" IsToggled="{Binding AllowProBookingOnly, Mode=TwoWay}"/>
</StackLayout>
</StackLayout>
</ScrollView>
</ContentPage>

View file

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using XLabs.Forms.Behaviors;
using XLabs.Forms.Controls;
using XLabs.Forms.Mvvm;
using XLabs.Ioc;
using XLabs.Platform.Services;
namespace BookAStar.Pages
{
public partial class DashboardPage : ContentPage
{
public RelayGesture UserNameGesture { get; set; }
public DashboardPage()
{
InitializeComponent();
UserNameGesture = new RelayGesture((g, x) =>
{
if (g.GestureType == GestureType.LongPress)
{
Resolver.Resolve<INavigationService>().NavigateTo<AccountChooserPage>(true);
}
});
}
public void OnViewPerformerStatus(object sender, EventArgs e)
{
App.CurrentApp.ShowAccounts();
}
public void OnViewUserQueries(object sender, EventArgs e)
{
App.CurrentApp.ShowQueries();
}
}
}

View file

@ -3,8 +3,18 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:BookAStar;assembly=BookAStar" xmlns:local="clr-namespace:BookAStar;assembly=BookAStar"
xmlns:views="clr-namespace:BookAStar.Views;assembly=BookAStar" xmlns:views="clr-namespace:BookAStar.Views;assembly=BookAStar"
x:Class="BookAStar.Pages.CommandLineEditorPage" x:Class="BookAStar.Pages.EditBillingLinePage"
Style="{StaticResource PageStyle}"> Style="{StaticResource PageStyle}">
<ContentPage.Resources>
<ResourceDictionary>
<Style TargetType="Label">
<Setter Property="Style" Value="{StaticResource ContentLabelStyle}" />
</Style>
<Style TargetType="Button">
<Setter Property="Style" Value="{StaticResource ButtonStyle}" />
</Style>
</ResourceDictionary>
</ContentPage.Resources>
<StackLayout> <StackLayout>
<Label Text="Description de la ligne de facture" Style="{StaticResource InputLabelStyle}"></Label> <Label Text="Description de la ligne de facture" Style="{StaticResource InputLabelStyle}"></Label>
<Editor VerticalOptions="FillAndExpand"></Editor> <Editor VerticalOptions="FillAndExpand"></Editor>

View file

@ -8,12 +8,11 @@ using Xamarin.Forms;
namespace BookAStar.Pages namespace BookAStar.Pages
{ {
public partial class CommandLineEditorPage : ContentPage public partial class EditBillingLinePage : ContentPage
{ {
public CommandLineEditorPage() public EditBillingLinePage()
{ {
InitializeComponent(); InitializeComponent();
} }
} }
} }

View file

@ -3,7 +3,18 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="BookAStar.Pages.EditEstimatePage" x:Class="BookAStar.Pages.EditEstimatePage"
xmlns:views="clr-namespace:BookAStar.Views;assembly=BookAStar" xmlns:views="clr-namespace:BookAStar.Views;assembly=BookAStar"
xmlns:local="clr-namespace:BookAStar;assembly=BookAStar"> xmlns:local="clr-namespace:BookAStar;assembly=BookAStar"
Style="{StaticResource PageStyle}">
<ContentPage.Resources>
<ResourceDictionary>
<Style TargetType="Label">
<Setter Property="Style" Value="{StaticResource ContentLabelStyle}" />
</Style>
<Style TargetType="Button">
<Setter Property="Style" Value="{StaticResource ButtonStyle}" />
</Style>
</ResourceDictionary>
</ContentPage.Resources>
<StackLayout Padding="10,10,10,10" BindingContext="{Binding .}"> <StackLayout Padding="10,10,10,10" BindingContext="{Binding .}">
<StackLayout Orientation="Horizontal" Padding="10,10,10,10"> <StackLayout Orientation="Horizontal" Padding="10,10,10,10">
<Label Text="{Binding Client.UserName}" LineBreakMode="WordWrap"></Label> <Label Text="{Binding Client.UserName}" LineBreakMode="WordWrap"></Label>

View file

@ -51,7 +51,7 @@ namespace BookAStar.Pages
} }
protected void OnNewCommanLine(object sender, EventArgs e) protected void OnNewCommanLine(object sender, EventArgs e)
{ {
var com = new CommandLine(); var com = new BillingLine();
App.CurrentApp.EditCommandLine(this,com); App.CurrentApp.EditCommandLine(this,com);
} }

View file

@ -2,7 +2,17 @@
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:BookAStar;Assembly:BookAStar" xmlns:local="clr-namespace:BookAStar;Assembly:BookAStar"
x:Class="BookAStar.Pages.EventDetail"> x:Class="BookAStar.Pages.EventDetail" Style="{StaticResource PageStyle}">
<ContentPage.Resources>
<ResourceDictionary>
<Style TargetType="Label">
<Setter Property="Style" Value="{StaticResource ContentLabelStyle}" />
</Style>
<Style TargetType="Button">
<Setter Property="Style" Value="{StaticResource ButtonStyle}" />
</Style>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content> <ContentPage.Content>
<ScrollView> <ScrollView>
<StackLayout> <StackLayout>

View file

@ -0,0 +1,17 @@
<?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.HomePage"
Style="{StaticResource PageStyle}">
<ContentPage.Resources>
<ResourceDictionary>
<Style TargetType="Label">
<Setter Property="Style" Value="{StaticResource ContentLabelStyle}" />
</Style>
<Style TargetType="Button">
<Setter Property="Style" Value="{StaticResource ButtonStyle}" />
</Style>
</ResourceDictionary>
</ContentPage.Resources>
<Label Text="Blah" VerticalOptions="Center" HorizontalOptions="Center" />
</ContentPage>

View file

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace BookAStar.Pages
{
public partial class HomePage : ContentPage
{
public HomePage()
{
InitializeComponent();
}
}
}

View file

@ -3,7 +3,17 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:BookAStar;Assembly:BookAStar" xmlns:local="clr-namespace:BookAStar;Assembly:BookAStar"
x:Class="BookAStar.SearchPage" Title="Page de recherche" x:Class="BookAStar.SearchPage" Title="Page de recherche"
Padding="10,40,10,10" > Style="{StaticResource PageStyle}">
<ContentPage.Resources>
<ResourceDictionary>
<Style TargetType="Label">
<Setter Property="Style" Value="{StaticResource ContentLabelStyle}" />
</Style>
<Style TargetType="Button">
<Setter Property="Style" Value="{StaticResource ButtonStyle}" />
</Style>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content> <ContentPage.Content>
<StackLayout> <StackLayout>

View file

@ -1,63 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:local="clr-namespace:BookAStar;assembly=BookAStar"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="BookAStar.SettingsPage"
Title="Paramètres Booking star"
Style="{StaticResource PageStyle}">
<StackLayout>
<Label Text="Compte utilisateur" StyleClass="Header"/>
<ListView x:Name="AccountListView"
SeparatorVisibility="Default"
VerticalOptions="FillAndExpand"
>
<ListView.Header>
<StackLayout Orientation="Horizontal">
<Button x:Name="RemoveAccountBouton"
Text="Supprimer cette identité" />
<Button x:Name="AddAccountBtn" Text="s'inscrire ou se connecter avec un nouveau compte" />
</StackLayout>
</ListView.Header>
<ListView.ItemTemplate HeightRequest="60" VerticalOptions="StartAndExpand">
<DataTemplate>
<ViewCell>
<Grid Padding="5"
ColumnSpacing="10"
RowSpacing="2">
<Image Source="{Binding Avatar}" HeightRequest="80" />
<Label Grid.Column="0" Text="{Binding UserName}" />
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.Footer>
<StackLayout></StackLayout>
</ListView.Footer>
</ListView>
<StackLayout Orientation="Horizontal" VerticalOptions="Start">
<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"
StyleClass="Header"/>
<Switch x:Name="restrictToPro" />
</StackLayout>
</StackLayout>
</ContentPage>

View file

@ -0,0 +1,78 @@
using BookAStar.Interfaces;
using BookAStar.Model.Workflow;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XLabs.Forms.Mvvm;
namespace BookAStar.ViewModels
{
class BillingLineViewModel : ViewModel, IBillingLine
{
public BillingLineViewModel(BillingLine data)
{
if (data == null) data = new BillingLine();
count = data.Count;
description = data.Description;
unitaryCost = data.UnitaryCost;
duration = data.Duration;
}
protected int count;
public int Count
{
get
{
return count;
}
set
{
SetProperty<int>(ref count, value, "Count");
}
}
protected string description;
public string Description
{
get
{
return description;
}
set
{
SetProperty<string>(ref description, value, "Description");
}
}
protected TimeSpan duration;
public TimeSpan Duration
{
get
{
return duration;
}
set
{
SetProperty<TimeSpan>(ref duration, value, "Duration");
}
}
protected decimal unitaryCost;
public decimal UnitaryCost
{
get
{
return unitaryCost;
}
set
{
SetProperty<decimal>(ref unitaryCost, value, "UnitaryCost");
}
}
}
}

View file

@ -1,4 +1,5 @@
using BookAStar.Model; using BookAStar.Interfaces;
using BookAStar.Model;
using BookAStar.Model.Social; using BookAStar.Model.Social;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -9,7 +10,7 @@ using System.Threading.Tasks;
namespace BookAStar.ViewModels namespace BookAStar.ViewModels
{ {
class BookQueryViewModel : XLabs.Forms.Mvvm.ViewModel class BookQueryViewModel : XLabs.Forms.Mvvm.ViewModel, IBookQueryData
{ {
public BookQueryViewModel() public BookQueryViewModel()
{ {

View file

@ -0,0 +1,137 @@
using BookAStar.Helpers;
using BookAStar.Model.Auth.Account;
using System.Collections.ObjectModel;
using System.Linq;
using Xamarin.Forms;
using XLabs.Forms.Mvvm;
namespace BookAStar.ViewModels
{
internal class DashboardViewModel : ViewModel
{
public string UserId
{
get
{
return User?.Id;
}
}
public bool AllowUseMyPosition
{
get
{
return MainSettings.AllowGPSUsage;
}
set
{
MainSettings.AllowGPSUsage = value;
}
}
public bool AllowProBookingOnly
{
get
{
return MainSettings.AllowProBookingOnly;
}
set
{
MainSettings.AllowProBookingOnly = value;
}
}
private long queryCount;
private User user;
public long QueryCount
{
get
{
return queryCount;
}
}
public User User
{
get { return user; }
protected set
{
SetProperty<User>(ref user, value, "User");
if (user!=null)
{
user.PropertyChanged += User_PropertyChanged;
}
UpdateUserMeta();
}
}
private ImageSource avatar;
public ImageSource Avatar { get {
return avatar;
} }
public ObservableCollection<User> Accounts { get; protected set; }
private string performerStatus;
public string PerformerStatus
{
get
{
return performerStatus;
}
}
public string UserName
{
get
{
return User?.UserName;
}
}
private bool userIsPro = false;
public DashboardViewModel()
{
Accounts = MainSettings.AccountList;
User = MainSettings.CurrentUser;
UpdateUserMeta();
}
private void UpdateUserMeta ()
{
string newStatusString;
long newQueryCount;
bool newUserIsPro;
ImageSource newAvatar;
if (user==null)
{
newQueryCount = 0;
newUserIsPro = false;
newStatusString = null;
newAvatar = null;
}
else
{
newUserIsPro = User.Roles?.Contains("Performer") ?? false;
newQueryCount = userIsPro ? DataManager.Current.BookQueries.Count : 0;
newStatusString = userIsPro ?
$"Profile professionel renseigné,\n{newQueryCount} demandes valides en cours" :
"Profile professionel non renseigné";
newAvatar = UserHelpers.Avatar(user.Avatar);
}
SetProperty<string>(ref performerStatus, newStatusString, "PerformerStatus");
SetProperty<long>(ref queryCount, newQueryCount, "QueryCount");
SetProperty<ImageSource>(ref avatar, newAvatar, "Avatar");
}
private void User_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
UpdateUserMeta();
}
}
}

View file

@ -0,0 +1,91 @@
using BookAStar.Model.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XLabs.Forms.Mvvm;
using BookAStar.Model.Workflow;
using System.Collections.ObjectModel;
using BookAStar.Model;
namespace BookAStar.ViewModels
{
class EstimateViewModel : ViewModel
{
public EstimateViewModel(Estimate data)
{
estimate = data;
AttachedFiles = new ObservableCollection<string>(data.AttachedFiles);
AttachedGraphicList = new ObservableCollection<string>(data.AttachedGraphicList);
Bill = new ObservableCollection<BillingLine>(data.Bill);
description = data.Description;
title = data.Title;
status = data.Status;
}
Estimate estimate;
public ObservableCollection<string> AttachedFiles
{
get; protected set;
}
public ObservableCollection<string> AttachedGraphicList
{
get; protected set;
}
public ObservableCollection<BillingLine> Bill
{
get; protected set;
}
private string description;
public string Description
{
get
{
return description;
}
set
{
SetProperty<string>(ref description, value, "Description");
}
}
private int? status;
public int? Status
{
get
{
return status;
}
set
{
SetProperty<int?>(ref status, value, "Status");
}
}
private string title;
public string Title
{
get
{
return title;
}
set
{
SetProperty<string>(ref title, value, "Title");
}
}
public ClientProviderInfo Client { get { return estimate.Client; } }
public BookQueryData Query { get { return estimate.Query; } }
}
}

View file

@ -1,11 +0,0 @@
using System;
using XLabs.Forms.Mvvm;
using XLabs.Platform.Services;
namespace BookAStar.ViewModels
{
internal class SettingsViewModel : XLabs.Forms.Mvvm.ViewModel
{
}
}

View file

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XLabs.Forms.Mvvm;
namespace BookAStar.ViewModels
{
class UserLoginViewModel : ViewModel
{
}
}

View file

@ -11,6 +11,7 @@ using System.Threading.Tasks;
namespace BookAStar.ViewModels namespace BookAStar.ViewModels
{ {
[Obsolete("Use legacy XLabs ViewModel")]
public class ViewModelBase : IModelViewModel public class ViewModelBase : IModelViewModel
{ {
public string Title { get; set; } public string Title { get; set; }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

View file

@ -7,11 +7,13 @@
<package id="SQLite.Net.Core-PCL" version="3.1.1" targetFramework="portable45-net45+win8+wpa81" /> <package id="SQLite.Net.Core-PCL" version="3.1.1" targetFramework="portable45-net45+win8+wpa81" />
<package id="SQLite.Net-PCL" version="3.1.1" targetFramework="portable45-net45+win8+wpa81" /> <package id="SQLite.Net-PCL" version="3.1.1" targetFramework="portable45-net45+win8+wpa81" />
<package id="Xam.Plugins.Settings" version="2.5.1.0" targetFramework="portable45-net45+win8+wpa81" /> <package id="Xam.Plugins.Settings" version="2.5.1.0" targetFramework="portable45-net45+win8+wpa81" />
<package id="Xamarin.Forms" version="2.3.2.127" targetFramework="portable45-net45+win8+wpa81" /> <package id="Xamarin.Forms" version="2.3.0.34-pre1" targetFramework="portable45-net45+win8+wpa81" />
<package id="Xamarin.Forms.Maps" version="2.3.2.127" targetFramework="portable45-net45+win8+wpa81" /> <package id="Xamarin.Forms.Maps" version="2.3.0.34-pre1" targetFramework="portable45-net45+win8+wpa81" />
<package id="XLabs.Caching" version="2.2.0-pre05" targetFramework="portable45-net45+win8+wpa81" />
<package id="XLabs.Core" version="2.2.0-pre05" targetFramework="portable45-net45+win8+wpa81" /> <package id="XLabs.Core" version="2.2.0-pre05" targetFramework="portable45-net45+win8+wpa81" />
<package id="XLabs.Forms" version="2.2.0-pre05" targetFramework="portable45-net45+win8+wpa81" /> <package id="XLabs.Forms" version="2.2.0-pre05" targetFramework="portable45-net45+win8+wpa81" />
<package id="XLabs.IoC" version="2.2.0-pre05" targetFramework="portable45-net45+win8+wpa81" /> <package id="XLabs.IoC" version="2.2.0-pre05" targetFramework="portable45-net45+win8+wpa81" />
<package id="XLabs.Platform" version="2.2.0-pre05" targetFramework="portable45-net45+win8+wpa81" /> <package id="XLabs.Platform" version="2.2.0-pre05" targetFramework="portable45-net45+win8+wpa81" />
<package id="XLabs.Serialization" version="2.2.0-pre05" targetFramework="portable45-net45+win8+wpa81" /> <package id="XLabs.Serialization" version="2.2.0-pre05" targetFramework="portable45-net45+win8+wpa81" />
<package id="XLabs.Serialization.JSON" version="2.2.0-pre05" targetFramework="portable45-net45+win8+wpa81" />
</packages> </packages>