Import inital de l'application mobile Xamarin

This commit is contained in:
Paul Schneider 2016-07-20 12:33:16 +02:00
commit 0d8d159285
157 changed files with 13250 additions and 0 deletions

View file

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8" ?>
<Application xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="BookAStar.App" >
<Application.Resources>
<ResourceDictionary>
<OnPlatform x:TypeArguments="Font" Android="Large" iOS="Large" WinPhone="Large" x:Key="HeaderFont" />
<OnPlatform x:TypeArguments="Color" Android="White" iOS="White" WinPhone="White" x:Key="PrimaryTextColor" />
<OnPlatform x:TypeArguments="Font" Android="40" iOS="60" WinPhone="60" x:Key="LargeFontSize" />
<OnPlatform x:TypeArguments="Font" Android="30" iOS="60" WinPhone="60" x:Key="MediumFontSize" />
<Color x:key="backgroundColor">#30FAFAFA</Color>
<Color x:key="textColor">#FF103010</Color>
<Color x:key="labelColor">#FF303010</Color>
<Style x:Key="labelStyle" TargetType="Label">
<Setter Property="TextColor" Value="{DynamicResource labelColor}" />
<Setter Property="FontAttributes" Value="Bold" />
<Setter Property="FontSize" Value="Large" />
<Setter Property="VerticalOptions" Value="Start" />
<Setter Property="XAlign" Value="Center" />
</Style>
<Style x:Key="entryStyle" TargetType="Entry">
<Setter Property="HorizontalOptions" Value="FillAndExpand"/>
</Style>
<Style x:key="backbroundStyle" TargetType="VisualElement">
<Setter Property="BackgoundColor" Value="{DynamicResource backgroundColor}" />
</Style>
<Style x:Key="buttonStyle" TargetType="Button">
<Setter Property="HorizontalOptions" Value="Center" />
<Setter Property="VerticalOptions" Value="CenterAndExpand" />
<Setter Property="BorderColor" Value="Lime" />
<Setter Property="BorderRadius" Value="5" />
<Setter Property="BorderWidth" Value="5" />
<Setter Property="WidthRequest" Value="200" />
<Setter Property="TextColor" Value="Teal" />
</Style>
<Style TargetType="Label">
<Setter Property="FontSize" Value="Large" />
<Setter Property="FontAttributes" Value="Bold" />
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>

View file

@ -0,0 +1,116 @@
using BookAStar.Model.Auth.Account;
using System;
using System.Diagnostics;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
/*
Glyphish icons from
http://www.glyphish.com/
under
http://creativecommons.org/licenses/by/3.0/us/
support them by buying the full set / Retina versions
*/
namespace BookAStar
{
public partial class App : Application // superclass new in 1.3
{
SearchPage searchPage;
NavigationPage mp;
SettingsPage settingsPage;
PinPage pinPage;
ContentPage deviceInfoPage;
public static IPlatform PlateformSpecificInstance { get; set; }
public static string AppName { get; set; }
public static App CurrentApp { get { return Current as App; } }
public App (IPlatform instance)
{
deviceInfoPage = new DeviceInfoPage(instance.GetDeviceInfo());
PlateformSpecificInstance = instance;
searchPage = new SearchPage { Title = "Trouvez votre artiste"
, Icon = "glyphish_07_map_marker.png"
};
mp = new NavigationPage (searchPage);
settingsPage = new SettingsPage { Title = "Settings"
, Icon = "ic_corp_icon.png"
};
var r = this.Resources;
//var hasLabelStyle = r.ContainsKey("labelStyle");
// var stid = this.StyleId;
// null var appsstyle = settingsPage.Style;
// appsstyle.CanCascade = true;
MainPage = mp;
ToolbarItem tiSetts = new ToolbarItem () { Text = "Settings"
, Icon = "ic_corp_icon.png"
};
mp.ToolbarItems.Add (tiSetts);
tiSetts.Clicked += (object sender, EventArgs e) => {
if (settingsPage.Parent==null)
mp.Navigation.PushAsync(settingsPage);
else {
settingsPage.Focus();
}
};
ToolbarItem tiMap = new ToolbarItem { Text = "Carte",
Icon = "glyphish_07_map_marker.png"
};
mp.ToolbarItems.Add (tiMap);
pinPage = new PinPage { Title = "Carte",
Icon = "glyphish_07_map_marker.png"
};
tiMap.Clicked += (object sender, EventArgs e) => {
if (pinPage.Parent == null)
mp.Navigation.PushAsync(pinPage);
else pinPage.Focus();
};
}
public void ShowDeviceInfo()
{
if (deviceInfoPage.Parent == null)
mp.Navigation.PushAsync(deviceInfoPage);
else deviceInfoPage.Focus();
}
public async void RegisterThisDevice()
{
HttpClient client = new HttpClient();
// var request = new HttpRequestMessage(HttpMethod.Post, MainSettings.MobileRegistrationUrl);
// request.Headers.Authorization
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", MainSettings.CurrentUser.YavscTokens.AccessToken);
/* client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")
);*/
var info =PlateformSpecificInstance.GetDeviceInfo();
/* var serSettings = new JsonSerializerSettings(); serSettings.Formatting = Formatting.None; serSettings.StringEscapeHandling = StringEscapeHandling.EscapeNonAscii;*/
client.MaxResponseContentBufferSize = 256000;
using ( client)
{
var json = Newtonsoft.Json.JsonConvert.SerializeObject(info);
/*
var dataString = JsonConvert.SerializeObject(info,serSettings); */
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync(MainSettings.MobileRegistrationUrl, content);
if (response.IsSuccessStatusCode)
Debug.WriteLine(@"Device info successfully saved.");
}
}
}
}

View file

@ -0,0 +1,180 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A0815650-0A0A-47B0-8826-771F0E1AD137}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BookAStar</RootNamespace>
<AssemblyName>BookAStar</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile>Profile111</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="DeviceInfoPage.cs" />
<Compile Include="EventDetail.xaml.cs">
<DependentUpon>EventDetail.xaml</DependentUpon>
</Compile>
<Compile Include="Helpers\MainSettings.cs" />
<Compile Include="IdentificationChangedEventArgs.cs" />
<Compile Include="IPlatform.cs" />
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Model\Auth\MobileAppDeclaration.cs" />
<Compile Include="Model\Auth\passwrecovery.cs" />
<Compile Include="Model\Auth\Tokens.cs" />
<Compile Include="Model\Auth\User.cs" />
<Compile Include="Model\Blog\Blog.cs" />
<Compile Include="Model\Blog\BlogTag.cs" />
<Compile Include="Model\Manager.cs" />
<Compile Include="Model\Social\Calendar\OpenDay.cs" />
<Compile Include="Model\Social\Calendar\Period.cs" />
<Compile Include="Model\Social\Calendar\Periodicity.cs" />
<Compile Include="Model\Social\Calendar\RendezVous.cs" />
<Compile Include="Model\Social\Calendar\Schedule.cs" />
<Compile Include="Model\Social\Calendar\WeekDay.cs" />
<Compile Include="Model\Social\Circle.cs" />
<Compile Include="Model\Social\CircleEvent.cs" />
<Compile Include="Model\Social\CircleMember.cs" />
<Compile Include="Model\Social\CompanyInfo.cs" />
<Compile Include="Model\Social\Contact.cs" />
<Compile Include="Model\Social\Location.cs" />
<Compile Include="Model\Social\Marketing\Activity.cs" />
<Compile Include="Model\Social\Marketing\BaseProduct.cs" />
<Compile Include="Model\Social\Marketing\Catalog.cs" />
<Compile Include="Model\Social\Marketing\PerformerProfile.cs" />
<Compile Include="Model\Social\Marketing\Product.cs" />
<Compile Include="Model\Social\Marketing\ProviderPublicInfo.cs" />
<Compile Include="Model\Social\Marketing\Service.cs" />
<Compile Include="Model\Social\Marketing\Skill.cs" />
<Compile Include="Model\Social\Marketing\UserSkills.cs" />
<Compile Include="Model\Social\Messaging\BaseEvent.cs" />
<Compile Include="Model\Social\Messaging\BookQuery.cs" />
<Compile Include="Model\Social\Messaging\BookQueryEvent.cs" />
<Compile Include="Model\Social\Messaging\Notification.cs" />
<Compile Include="Model\Social\Messaging\PositionAndKeyphrase.cs" />
<Compile Include="Model\Social\Messaging\SearchQuery.cs" />
<Compile Include="Model\Social\Messaging\YaEvent.cs" />
<Compile Include="PinPage.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SearchPage.xaml.cs">
<DependentUpon>SearchPage.xaml</DependentUpon>
</Compile>
<Compile Include="SettingsPage.xaml.cs">
<DependentUpon>SettingsPage.xaml</DependentUpon>
</Compile>
<Compile Include="Model\Tag.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="MainPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Include="App.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="GettingStarted.Xamarin" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="EventDetail.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="SearchPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="SettingsPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="Model\Workflow\" />
</ItemGroup>
<ItemGroup>
<Reference Include="Json.NET.Web, Version=1.0.49.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Json.NET.Web.1.0.49\lib\portable45-net45+win8+wpa81\Json.NET.Web.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Mono.Android">
<HintPath>..\..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v6.0\Mono.Android.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.9.0.1\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Plugin.Settings, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xam.Plugins.Settings.2.1.0\lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10+UAP10\Plugin.Settings.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Plugin.Settings.Abstractions, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xam.Plugins.Settings.2.1.0\lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10+UAP10\Plugin.Settings.Abstractions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.2.3.0.107\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xamarin.Forms.Maps, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.Maps.2.3.0.107\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Maps.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xamarin.Forms.Platform, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.2.3.0.107\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Platform.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.2.3.0.107\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Xaml.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="..\..\packages\Xamarin.Forms.2.3.0.107\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.2.3.0.107\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<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>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Xamarin.Forms.2.3.0.107\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.107\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets'))" />
</Target>
<!-- 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.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View file

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BookAStar
{
public static class Constants
{
public const string ApplicationName = "Booking Star";
public const string UserInfoUrl = "http://dev.pschneider.fr/api/me";
}
}

View file

@ -0,0 +1,29 @@
using BookAStar.Model.Auth.Account;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xamarin.Forms;
namespace BookAStar
{
public class DeviceInfoPage : ContentPage
{
public DeviceInfoPage(GoogleCloudMobileDeclaration infos)
{
Content = new StackLayout
{
Padding = 50,
VerticalOptions = LayoutOptions.Center,
Children = {
new Label{ Text = "Id: " + infos.DeviceId},
new Label{ Text = "Model: " + infos.Model},
new Label{ Text = "Platform: " + infos.Platform},
new Label{ Text = "Version: " + infos.Version},
}
};
}
}
}

View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:BookAStar;Assembly:BookAStar"
x:Class="BookAStar.EventDetail">
<ContentPage.Content>
<ScrollView>
<StackLayout>
<Label HorizontalOptions="Center" Text="{Binding EventType}" FontAttributes="Italic" FontSize="10"/>
<Image Source="{Binding ImgLocator}"/>
<Label Text="{Binding Title}" FontSize="20"/>
<Label FontSize="16" Text="{Binding Description}"/>
<StackLayout Orientation="Horizontal">
<Label FontAttributes="Italic" FontSize="10" Text="Lieu:" />
<Label Text="{Binding Location.Name}" />
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label FontAttributes="Italic" FontSize="10" Text="Date:" />
<Label Text="{Binding StartDate, StringFormat='{0:dddd dd MMMM yyyy}'}" /> <Label Text="{Binding StartDate, StringFormat='{0:H:mm}'}" />
</StackLayout>
<StackLayout Orientation="Horizontal" IsVisible="{Binding Promotted}">
<Label FontAttributes="Italic" FontSize="10" Text="Code promotion:"/>
<Label FontSize="15" TextColor="Yellow" BackgroundColor="#102030" Text="{Binding PromotionCode}"/>
</StackLayout>
<Button Text="{Binding EventWebPage, StringFormat='Sur le web:{0}'}" x:Name="btn_webpage" />
</StackLayout>
</ScrollView>
</ContentPage.Content>
</ContentPage>

View file

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using Xamarin.Forms;
using BookAStar;
using System.Collections.ObjectModel;
using BookAStar.Model.Workflow.Messaging;
namespace BookAStar
{
public partial class EventDetail : ContentPage
{
public ObservableCollection<YaEvent> Events
{ get; private set; }
public EventDetail (YaEvent ev)
{
InitializeComponent();
BindingContext = ev;
btn_webpage.Clicked += (object sender, EventArgs e) => {
App.PlateformSpecificInstance.OpenWeb(ev.EventWebPage);
};
}
///protected override void OnDisappearing ()
// { Navigation.PopAsync (); }
//private async void Close() {
//await Navigation.PopAsync ();
//}
}
}

View file

@ -0,0 +1,44 @@
using System;
using Xamarin.Forms;
using Xamarin.Forms.Maps;
namespace NightFlash
{
public class GeocoderPage : ContentPage
{
Geocoder geoCoder;
Label l = new Label ();
public GeocoderPage ()
{
geoCoder = new Geocoder ();
var b1 = new Button { Text = "Reverse geocode '37.808, -122.432'" };
b1.Clicked += async (sender, e) => {
var fortMasonPosition = new Position (37.8044866, -122.4324132);
var possibleAddresses = await geoCoder.GetAddressesForPositionAsync (fortMasonPosition);
foreach (var a in possibleAddresses){
l.Text += a + "\n";
}
};
var b2 = new Button { Text = "Geocode '394 Pacific Ave'" };
b2.Clicked += async (sender, e) => {
var xamarinAddress = "394 Pacific Ave, San Francisco, California";
var approximateLocation = await geoCoder.GetPositionsForAddressAsync (xamarinAddress);
foreach (var p in approximateLocation) {
l.Text += p.Latitude + ", " + p.Longitude + "\n";
}
};
Content = new StackLayout {
Padding = new Thickness (0, 20, 0, 0),
Children = {
b2,
b1,
l
}
};
}
}
}

View file

@ -0,0 +1,24 @@
Connectivity Readme
Find the most up to date information at: https://github.com/jamesmontemagno/Xamarin.Plugins
**IMPORTANT**
Android:
You must request ACCESS_COARSE_LOCATION & ACCESS_FINE_LOCATION permission
iOS:
In iOS 8 you now have to call either RequestWhenInUseAuthorization or RequestAlwaysAuthorization on the location manager. Additionally you need to add either the concisely named NSLocationWhenInUseUsageDescription or NSLocationAlwaysUsageDescription to your Info.plist.
See: http://motzcod.es/post/97662738237/scanning-for-ibeacons-in-ios-8
Windows Phone:
You must set the ID_CAP_LOCATION permission.
Getting Started:
var locator = CrossGeolocator.Current;
locator.DesiredAccuracy = 50;
var position = await locator.GetPositionAsync (timeout: 10000);
Console.WriteLine ("Position Status: {0}", position.Timestamp);
Console.WriteLine ("Position Latitude: {0}", position.Latitude);
Console.WriteLine ("Position Longitude: {0}", position.Longitude);

View file

@ -0,0 +1,4 @@
<GettingStarted>
<LocalContent>GS\XF\CS\App\GettingStarted.html</LocalContent>
<EmbeddedNavigation>false</EmbeddedNavigation>
</GettingStarted>

View file

@ -0,0 +1,192 @@
// Helpers/Settings.cs
using BookAStar.Model.Auth.Account;
using Newtonsoft.Json;
using Plugin.Settings;
using Plugin.Settings.Abstractions;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Xamarin.Forms;
namespace BookAStar
{
/// <summary>
/// This is the Settings static class that can be used in your Core solution or in any
/// of your client applications. All settings are laid out the same exact way with getters
/// and setters.
/// </summary>
public static class MainSettings
{
private static ISettings AppSettings {
get {
return CrossSettings.Current;
}
}
#region Setting Constants
private const string userNameKey = "user_id";
private const string PushNotificationsKey = "pushNotifs";
private const string UserListsKey = "userList";
private const string GoogleRegIdKey = "googleRedId";
private static readonly string UserIdDefault =
string.Empty;
private static readonly bool PushNotificationsDefault = false;
public static readonly string GoogleSenderId = "325408689282";
private const string MusicalKey = "musical_prefs";
private const string EnvironKey = "environ_prefs";
private static readonly Dictionary<string,double> MusicalDefault =
new Dictionary<string, double> {
{ "Pop", 0.5 }, { "Hip Hop" , 0.5 }, { "Rock" , 0.5 }, { "Funk", 0.5 },
{ "R&B", 0.5 }, { "Jazz", 0.5 }
};
private static readonly Dictionary<string, double> musical = new Dictionary<string, double>();
private static readonly Dictionary<string,double> EnvironDefault =
new Dictionary<string, double> {
{ "Discothèque", 0.5 }, { "Salles de concert", 0.5 },
{ "Piano bar", 0.5 }, { "Bar", 0.5 }, { "Cinema", 0.5 },
{ "Théatre", 0.5 }, { "Salles des fêtes", 0.5 },
{ "Espace publique", 0.5 }
};
private static readonly Dictionary<string, double> environ = new Dictionary<string, double>();
public static readonly string YavscApiUrl = "dev.pschneider.fr";
#endregion
public static string UserName
{
get {
return AppSettings.GetValueOrDefault<string>(userNameKey, null);
}
}
public static string GoogleRegId
{
set {
var oldregid = GoogleRegId;
AppSettings.AddOrUpdateValue<string>(GoogleRegIdKey, value);
// TODO If it changed, and there's an identified user,
// Inform the server of it.
if (oldregid != value) App.CurrentApp.RegisterThisDevice();
}
get { return AppSettings.GetValueOrDefault<string>(GoogleRegIdKey); }
}
private static ObservableCollection<User> accountList=null;
public static ObservableCollection<User> AccountList
{
get
{
if (accountList == null)
{
accountList = new ObservableCollection<User>();
var json = AppSettings.GetValueOrDefault<string>
(UserListsKey, null);
if (json != null)
{
var users = JsonConvert.DeserializeObject<User[]>(json);
if (users != null)
foreach (User user in users)
{
accountList.Add(user);
}
}
}
return accountList;
}
}
private static User currentUser = null;
public static User CurrentUser { get
{
var uname = UserName;
if (uname == null) return null;
return AccountList.Where(
u => u.UserName == uname
).FirstOrDefault();
}
set
{
var olduserid = currentUser?.Id;
currentUser = value;
AppSettings.AddOrUpdateValue<string>(userNameKey, value?.UserName);
// TODO if it changes, for a valid
// ident, and we've got a GoogleRedId, inform the server
// of it.
if (value != null)
{
if (olduserid != value.Id)
{
App.CurrentApp.RegisterThisDevice();
}
}
}
}
public static void SaveUser(User user)
{
var existent = AccountList.FirstOrDefault(u => u.UserName == user.UserName);
if (existent != null)
AccountList.Remove(existent);
AccountList.Add(user);
var json = JsonConvert.SerializeObject(AccountList.ToArray());
AppSettings.AddOrUpdateValue(UserListsKey, json);
}
public static User GetUser(string username)
{
return AccountList.FirstOrDefault(a=>a.UserName == username);
}
public static bool PushNotifications {
get {
return AppSettings.GetValueOrDefault<bool>(
PushNotificationsKey,
PushNotificationsDefault);
}
set {
AppSettings.AddOrUpdateValue<bool> (
PushNotificationsKey,
value);
}
}
public static void SetMusical (string key, double value)
{
AppSettings.AddOrUpdateValue <double> (MusicalKey + key, value);
}
public static double GetMusical (string key)
{
return AppSettings.GetValueOrDefault <double> (MusicalKey + key, MusicalDefault [key]);
}
public static Dictionary<string,double> Musical {
get {
return musical;
}
}
public static Dictionary<string, double> Environ
{
get
{
return environ;
}
}
public const string MobileRegistrationUrl = "http://dev.pschneider.fr/api/gcm/register";
public const string ApplicationName = "BookAStar";
public static readonly string UserInfoUrl = "http://dev.pschneider.fr/api/me";
}
}

View file

@ -0,0 +1,25 @@
using BookAStar.Model.Auth.Account;
namespace BookAStar
{
public interface IPlatform
{
void OpenWeb (string Uri);
// TODO Better
string GCMStatusMessage { get; }
bool EnablePushNotifications (bool enable);
void AddAccount();
void RevokeAccount(string userName);
GoogleCloudMobileDeclaration GetDeviceInfo();
// void RegisterThisDevice();
}
}

View file

@ -0,0 +1,14 @@
using BookAStar.Model.Auth.Account;
using System;
namespace BookAStar
{
public class IdentificationChangedEventArgs : EventArgs
{
public User NewIdentification { get; private set; }
public IdentificationChangedEventArgs(User newId)
{
NewIdentification = newId;
}
}
}

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:App2"
x:Class="App2.MainPage">
<Label Text="Welcome to Xamarin Forms!"
VerticalOptions="Center"
HorizontalOptions="Center" />
</ContentPage>

View file

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

View file

@ -0,0 +1,64 @@
using System;
using Xamarin.Forms;
namespace NightFlash
{
public class MapAppPage : ContentPage
{
// WARNING: when adding latitude/longitude values be careful of localization.
// European (and other countries) use a comma as the separator, which will break the request
public MapAppPage ()
{
var l = new Label {
Text = "These buttons leave the current app and open the built-in Maps app for the platform"
};
var openLocation = new Button {
Text = "Open location using built-in Maps app"
};
openLocation.Clicked += (sender, e) => {
if (Device.OS == TargetPlatform.iOS) {
//https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html
Device.OpenUri(new Uri("http://maps.apple.com/?q=394+Pacific+Ave+San+Francisco+CA"));
} else if (Device.OS == TargetPlatform.Android) {
// opens the Maps app directly
Device.OpenUri(new Uri("geo:0,0?q=394+Pacific+Ave+San+Francisco+CA"));
} else if (Device.OS == TargetPlatform.WinPhone) {
DisplayAlert("To Do", "Not yet implemented", "OK");
}
};
var openDirections = new Button {
Text = "Get directions using built-in Maps app"
};
openDirections.Clicked += (sender, e) => {
if (Device.OS == TargetPlatform.iOS) {
//https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html
Device.OpenUri(new Uri("http://maps.apple.com/?daddr=San+Francisco,+CA&saddr=cupertino"));
} else if (Device.OS == TargetPlatform.Android) {
// opens the 'task chooser' so the user can pick Maps, Chrome or other mapping app
Device.OpenUri(new Uri("http://maps.google.com/?daddr=San+Francisco,+CA&saddr=Mountain+View"));
} else if (Device.OS == TargetPlatform.WinPhone) {
DisplayAlert("To Do", "Not yet implemented", "OK");
}
};
Content = new StackLayout{
Padding = new Thickness (5, 20, 5, 0),
HorizontalOptions = LayoutOptions.Fill,
Children = {
l,
openLocation,
openDirections
}
};
}
}
}

View file

@ -0,0 +1,113 @@
using System;
using Xamarin.Forms;
using Xamarin.Forms.Maps;
using System.Diagnostics;
namespace NightFlash
{
public class MapPage : ContentPage
{
Map map;
public MapPage ()
{
map = new Map {
IsShowingUser = true,
HeightRequest = 100,
WidthRequest = 960,
VerticalOptions = LayoutOptions.FillAndExpand
};
// You can use MapSpan.FromCenterAndRadius
// map.MoveToRegion (MapSpan.FromCenterAndRadius (
// new Position (37, -122), Distance.FromMiles (0.3)));
// or create a new MapSpan object directly
map.MoveToRegion (new MapSpan (new Position (0,0), 360, 360) );
// add the slider
var slider = new Slider (1, 18, 1);
slider.ValueChanged += (sender, e) => {
var zoomLevel = e.NewValue; // between 1 and 18
var latlongdegrees = 360 / (Math.Pow(2, zoomLevel));
Debug.WriteLine(zoomLevel + " -> " + latlongdegrees);
if (map.VisibleRegion != null)
map.MoveToRegion(new MapSpan (map.VisibleRegion.Center, latlongdegrees, latlongdegrees));
};
// create map style buttons
var street = new Button { Text = "Street" };
var hybrid = new Button { Text = "Hybrid" };
var satellite = new Button { Text = "Satellite" };
street.Clicked += HandleClicked;
hybrid.Clicked += HandleClicked;
satellite.Clicked += HandleClicked;
var segments = new StackLayout { Spacing = 30,
HorizontalOptions = LayoutOptions.CenterAndExpand,
Orientation = StackOrientation.Horizontal,
Children = {street, hybrid, satellite}
};
// put the page together
var stack = new StackLayout { Spacing = 0 };
stack.Children.Add(map);
stack.Children.Add (slider);
stack.Children.Add (segments);
Content = stack;
// for debugging output only
map.PropertyChanged += (sender, e) => {
Debug.WriteLine(e.PropertyName + " just changed!");
if (e.PropertyName == "VisibleRegion" && map.VisibleRegion != null)
CalculateBoundingCoordinates (map.VisibleRegion);
};
}
void HandleClicked (object sender, EventArgs e)
{
var b = sender as Button;
switch (b.Text) {
case "Street":
map.MapType = MapType.Street;
break;
case "Hybrid":
map.MapType = MapType.Hybrid;
break;
case "Satellite":
map.MapType = MapType.Satellite;
break;
}
}
/// <summary>
/// In response to this forum question http://forums.xamarin.com/discussion/22493/maps-visibleregion-bounds
/// Useful if you need to send the bounds to a web service or otherwise calculate what
/// pins might need to be drawn inside the currently visible viewport.
/// </summary>
static void CalculateBoundingCoordinates (MapSpan region)
{
// WARNING: I haven't tested the correctness of this exhaustively!
var center = region.Center;
var halfheightDegrees = region.LatitudeDegrees / 2;
var halfwidthDegrees = region.LongitudeDegrees / 2;
var left = center.Longitude - halfwidthDegrees;
var right = center.Longitude + halfwidthDegrees;
var top = center.Latitude + halfheightDegrees;
var bottom = center.Latitude - halfheightDegrees;
// Adjust for Internation Date Line (+/- 180 degrees longitude)
if (left < -180) left = 180 + (180 + left);
if (right > 180) right = (right - 180) - 180;
// I don't wrap around north or south; I don't think the map control allows this anyway
Debug.WriteLine ("Bounding box:");
Debug.WriteLine (" " + top);
Debug.WriteLine (" " + left + " " + right);
Debug.WriteLine (" " + bottom);
}
}
}

View file

@ -0,0 +1,12 @@
namespace BookAStar.Model.Auth.Account
{
public class GoogleCloudMobileDeclaration
{
public string GCMRegistrationId { get; set; }
public string DeviceId { get; set; }
public string Model { get; set; }
public string Platform { get; set; }
public string Version { get; set; }
}
}

View file

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BookAStar.Model.Auth.Account
{
public class Tokens
{
public string AccessToken { get; set; }
public string RefreshToken { get; set; }
public int ExpiresIn { set; get; }
public DateTime Received { get; set; }
public string TokenType { get; set; }
}
}

View file

@ -0,0 +1,107 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BookAStar.Model.Auth.Account
{
public class User : INotifyPropertyChanged
{
private string id;
public string Id {
get {
return id;
}
set
{
id = value;
OnPropertyChanged("Id");
}
}
private string userName;
public string UserName {
get
{
return userName;
}
set
{
userName = value;
OnPropertyChanged("UserName");
}
}
private IEnumerable<string> eMails;
public IEnumerable<string> EMails
{
get { return eMails; }
set
{
eMails = value;
OnPropertyChanged("EMails");
}
}
private IEnumerable<string> roles;
public IEnumerable<string> Roles
{
get
{
return roles;
}
set
{
roles = value;
OnPropertyChanged("Roles");
}
}
private string avatar;
public string Avatar
{
get
{
return avatar;
}
set
{
avatar = value;
OnPropertyChanged("Avatar");
}
}
private Tokens yavscTokens;
public Tokens YavscTokens
{
get
{
return yavscTokens;
}
set
{
yavscTokens = value;
OnPropertyChanged("YavscTokens");
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string propertyName)
{
if (PropertyChanged == null)
return;
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}

View file

@ -0,0 +1,11 @@
using System;
namespace BookAStar.Model.Auth.Account
{
public partial class passwrecovery
{
public string pkid { get; set; }
public DateTime creation { get; set; }
public string one_time_pass { get; set; }
}
}

View file

@ -0,0 +1,26 @@
using System;
namespace BookAStar.Model.Blog
{
public partial class Blog
{
public long Id { get; set; }
public string bcontent { get; set; }
public DateTime modified { get; set; }
public string photo { get; set; }
public DateTime posted { get; set; }
public int rate { get; set; }
public string title { get; set; }
public string AuthorId { get; set; }
public bool visible { get; set; }
}
}

View file

@ -0,0 +1,11 @@
namespace BookAStar.Model.Blog
{
public partial class BlogTag
{
public long postid { get; set; }
public long TagId { get; set; }
}
}

View file

@ -0,0 +1,60 @@
using BookAStar.Model.Social;
using System.Collections.ObjectModel;
namespace BookAStar
{
public static class Manager
{
static Manager ()
{
}
// TODO WIP TEST rop this
private static Location[] _places = new Location[] {
new Location(48.8626458, 2.2065559, "2 bd Aristide Briand - Suresnes" ),
new Location(48.8632757, 2.2023099, "Théatre Jean Villard - Suresnes" ),
new Location(48.8647120, 2.2054588, "Place de la Paix - Suresnes" ),
new Location(48.8640133, 2.2056573, "Restaurant" ),
new Location(48.8634839, 2.2064137, "Square" ),
new Location(48.8653649, 2.2014945, "Stade de foot" ),
};
// TODO WIP TEST rop this
private static ObservableCollection<LocalizedEvent> _your_events = new ObservableCollection<LocalizedEvent> {
new LocalizedEvent {
Title = "Yavsc Party",
Description = "Lancement en fanfare de la version 1.0 de BookAStar, l'appli des fétards",
ProviderId = "paul",
ProviderName = "Yavsc Fondation",
EventWebPage = "http://lua.pschneider.fr/",
Location = _places[0]
},
new LocalizedEvent {
Title = "Evenement de test",
Description = "Blah bli lo qui est errare, ma no. Blou test allo 3!",
ProviderId = "provid3",
ProviderName = "Prov Entreprise 3",
EventWebPage = "http://lua.pschneider.fr/events/test3",
Location = _places[1]
},
new LocalizedEvent {
Title = "DjFx feat XamCoder, en Concert gratuit",
Description = "Hip Hop à Suresnes",
ProviderId = "brahim",
ProviderName = "Totem Production",
EventWebPage = "http://lua.pschneider.fr/events/totem",
Location = _places[2]
}
};
// TODO WIP TEST rop this
public static ObservableCollection<LocalizedEvent> Events {
get {
return _your_events;
}
}
}
}

View file

@ -0,0 +1,56 @@
//
// OpenDay.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
namespace BookAStar.Model.Workflow.Calendar
{
/// <summary>
/// Open day.
/// </summary>
public class OpenDay {
/// <summary>
/// The day.
/// </summary>
public WeekDay Day;
/// <summary>
/// Gets or sets the s.
/// </summary>
/// <value>The s.</value>
public TimeSpan S { get; set; }
// ASSERT Start <= End
/// <summary>
/// Gets or sets the start hour.
/// </summary>
/// <value>The start.</value>
public TimeSpan Start { get; set; }
/// <summary>
/// Gets or sets the end hour
/// (from the next day if lower than the Start).
/// </summary>
/// <value>The end.</value>
public TimeSpan End { get; set; }
}
}

View file

@ -0,0 +1,42 @@
//
// Period.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
namespace BookAStar.Model.Workflow.Calendar
{
/// <summary>
/// Hollydays.
/// </summary>
public class Period {
/// <summary>
/// Gets or sets the start.
/// </summary>
/// <value>The start.</value>
public DateTime Start { get; set; }
/// <summary>
/// Gets or sets the end.
/// </summary>
/// <value>The end.</value>
public DateTime End { get; set; }
}
}

View file

@ -0,0 +1,54 @@
//
// Periodicity.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace BookAStar.Model.Workflow.Calendar
{
/// <summary>
/// Periodicity.
/// </summary>
public enum Periodicity {
/// <summary>
/// The daily.
/// </summary>
Daily,
/// <summary>
/// The weekly.
/// </summary>
Weekly,
/// <summary>
/// The monthly.
/// </summary>
Monthly,
/// <summary>
/// The three m.
/// </summary>
ThreeM,
/// <summary>
/// The six m.
/// </summary>
SixM,
/// <summary>
/// The yearly.
/// </summary>
Yearly
}
}

View file

@ -0,0 +1,34 @@
using BookAStar.Model.Social;
using BookAStar.Model.Workflow.Marketing;
using System;
namespace BookAStar.Model.Workflow.Calendar
{
/// <summary>
/// A date, between two persons
/// </summary>
public class RendezVous: Service {
// Haut les mains.
/// <summary>
/// Event date
/// </summary>
/// <returns></returns>
public DateTime EventDate { get; set; }
/// <summary>
/// Location identifier
/// </summary>
/// <returns></returns>
public long LocationId { get; set; }
/// <summary>
/// A Location for this event
/// </summary>
/// <returns></returns>
public Location Location { get; set; }
}
}

View file

@ -0,0 +1,48 @@
//
// Schedule.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace BookAStar.Model.Workflow.Calendar
{
/// <summary>
/// Schedule.
/// </summary>
public class Schedule {
/// <summary>
/// Gets or sets the period.
/// </summary>
/// <value>The period.</value>
public Periodicity Period { get; set; }
/// <summary>
/// Gets or sets the schedule of an open week.
/// One item by bay in the week,
/// </summary>
/// <value>The weekly workdays.</value>
public OpenDay [] WeekDays { get; set; }
/// <summary>
/// Gets or sets the hollydays.
/// </summary>
/// <value>The hollydays.</value>
public Period [] Validity { get; set; }
}
}

View file

@ -0,0 +1,58 @@
//
// WeekDay.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace BookAStar.Model.Workflow.Calendar
{
/// <summary>
/// Week day.
/// </summary>
public enum WeekDay:int {
/// <summary>
/// The monday (0).
/// </summary>
Monday=0,
/// <summary>
/// The tuesday.
/// </summary>
Tuesday,
/// <summary>
/// The wednesday.
/// </summary>
Wednesday,
/// <summary>
/// The thursday.
/// </summary>
Thursday,
/// <summary>
/// The friday.
/// </summary>
Friday,
/// <summary>
/// The saturday.
/// </summary>
Saturday,
/// <summary>
/// The sunday.
/// </summary>
Sunday
}
}

View file

@ -0,0 +1,14 @@
using System.Collections.Generic;
namespace BookAStar.Model.Social
{
public partial class Circle {
public long Id { get; set; }
public string Name { get; set; }
public string OwnerId { get; set; }
}
}

View file

@ -0,0 +1,41 @@
//
// EventPub.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using BookAStar.Model.Workflow.Messaging;
using System.Collections.Generic;
namespace BookAStar.Model.Social
{
/// <summary>
/// Event pub.
/// </summary>
public class CircleEvent: YaEvent
{
/// <summary>
/// Gets or sets the circles.
/// </summary>
/// <value>The circles.</value>
public virtual List<Circle> Circles{ get; set; }
}
}

View file

@ -0,0 +1,8 @@
namespace BookAStar.Model.Social
{
public partial class CircleMember
{
public long Id { get; set; }
}
}

View file

@ -0,0 +1,108 @@
namespace BookAStar.Model.Social
{
public class CompanyInfoMessage
{
public bool success { get; set; }
public string errorType { get; set; }
public string errorCode { get; set; }
public string errorMessage { get; set; }
public CompanyInfo result { get; set; }
}
public class CompanyInfo
{
public string registration_number { get; set; }
public string vat_number { get; set; }
public string name { get; set; }
public string commercial_name { get; set; }
public string business_name { get; set; }
public string ape_code { get; set; }
public string ape_label { get; set; }
public string rcs_name { get; set; }
public string greffe_name { get; set; }
public string legal_person_type { get; set; }
public string legal_state { get; set; }
public string legal_type { get; set; }
public string legal_status { get; set; }
public string activity { get; set; }
public string street { get; set; }
public string postal_code { get; set; }
public string country_code { get; set; }
public decimal lng { get; set; }
public decimal lat { get; set; }
public string phone_number { get; set; }
public string capital { get; set; }
public Employee[] contacts { get; set; }
public string[] emails { get; set; }
public Stat[] stats { get; set; }
public MarkDetail[] marks_details { get; set; }
public Bodacc last_bodacc { get; set; }
}
public class MarkDetail
{
public MarkClass[] classes { get; set; }
public Mark[] marks { get; set; }
}
public class MarkClass
{
public string number { get; set; }
public string description { get; set; }
}
public class Mark
{
public string name { get; set; }
public long application_date { get; set; }
}
public class Stat
{
public string type { get; set; }
public int year { get; set; }
public string value { get; set; }
}
public class Bodacc
{
public string type { get; set; }
public string bodacc_type { get; set; }
public long parution_date { get; set; }
public string number { get; set; }
public string rcs_name { get; set; }
public string legal_name { get; set; }
public string legal_status { get; set; }
public string capital { get; set; }
public string administration { get; set; }
public string address { get; set; }
public string description { get; set; }
}
public class Employee
{
public string name { get; set; }
public string role { get; set; }
}
}

View file

@ -0,0 +1,11 @@
namespace BookAStar.Model.Social
{
public class Contact
{
public string UserId { get; set; }
public string OwnerId { get; set; }
}
}

View file

@ -0,0 +1,47 @@
using BookAStar.Model.Workflow.Messaging;
namespace BookAStar.Model.Social
{
/// <summary>
/// Position.
/// </summary>
public class Position
{
/// <summary>
/// The longitude.
/// </summary>
public double Longitude { get; set; }
/// <summary>
///
/// The latitude.
/// </summary>
public double Latitude { get; set; }
}
public class Location : Position {
public long Id { get; set; }
public string Address { get; set; }
public Location(double latitude, double longitude, string address)
{
this.Latitude = latitude;
this.Longitude = longitude;
this.Address = address;
}
}
public class LocalizedEvent : YaEvent
{
public Location Location { get; set; }
}
}

View file

@ -0,0 +1,32 @@
namespace BookAStar.Model.Workflow.Marketing
{
public class Activity
{
public string Code {get; set;}
/// <summary>
///
/// </summary>
/// <returns></returns>
public string Name {get; set;}
public string Description {get; set;}
/// <summary>
/// Name to associate to a performer in this activity domain
/// </summary>
/// <returns></returns>
public string ActorDenomination {get; set;}
public string Photo {get; set;}
/// <summary>
/// Moderation settings
/// </summary>
/// <returns></returns>
string ModeratorGroupName { get; set; }
}
}

View file

@ -0,0 +1,28 @@
namespace BookAStar.Model.Workflow.Marketing
{
public partial class BaseProduct
{
/// <summary>
/// An unique product identifier.
/// </summary>
/// <returns></returns>
public long Id { get; set; }
public string Name { get; set; }
/// <summary>
/// A contractual description for this product.
/// </summary>
/// <returns></returns>
public string Description { get; set; }
/// <summary>
/// Controls wether this product or service
/// may be offered to clients, or simply
/// are internal workflow entry point.
/// </summary>
/// <returns>true when this product belongs to the public catalog.</returns>
public bool Public { get; set; }
}
}

View file

@ -0,0 +1,11 @@
using System.Collections.Generic;
namespace BookAStar.Model.Workflow.Marketing
{
public class Catalog {
public List<Product> Products { get; set; }
public List<Service> Services { get; set; }
}
}

View file

@ -0,0 +1,39 @@
using BookAStar.Model.Social;
namespace BookAStar.Model.Workflow.Marketing
{
public class PerformerProfile {
public string PerfomerId { get; set; }
public string ActivityCode { get; set; }
public Service Offer { get; set; }
public string SIREN { get; set; }
public long OrganisationAddressId { get; set; }
public virtual Location OrganisationAddress { get; set; }
public virtual Activity Activity { get; set; }
public bool AcceptNotifications { get; set; }
public bool AcceptPublicContact { get; set; }
public bool AcceptGeoLocalisation { get; set; }
public string WebSite { get; set; }
public bool Active { get; set; }
public int? MaxDailyCost { get; set; }
public int? MinDailyCost { get; set; }
public int Rate { get; set; }
}
}

View file

@ -0,0 +1,30 @@
namespace BookAStar.Model.Workflow.Marketing
{
public partial class Product : BaseProduct
{
/// <summary>
/// Weight in gram
/// </summary>
/// <returns></returns>
public decimal Weight { get; set; }
/// <summary>
/// Height in meter
/// </summary>
/// <returns></returns>
public decimal Height { get; set; }
/// <summary>
/// Width in meter
/// </summary>
/// <returns></returns>
public decimal Width { get; set; }
public decimal Depth { get; set; }
/// <summary>
/// In euro
/// </summary>
/// <returns></returns>
public decimal? Price { get; set; }
}
}

View file

@ -0,0 +1,67 @@
//
// ProviderPublicInfo.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace BookAStar.Model.Workflow.Marketing
{
using Social;
using System;
using Yavsc; /// <summary>
/// Provider public info.
/// </summary>
public class ProviderPublicInfo {
/// <summary>
/// Gets or sets the display name.
/// </summary>
/// <value>The display name.</value>
public string DisplayName { get; set; }
/// <summary>
/// Gets or sets the type of the location.
/// </summary>
/// <value>The type of the location.</value>
public string LocationType { get; set; }
/// <summary>
/// Gets or sets the location.
/// </summary>
/// <value>The location.</value>
public Location Location { get; set; }
/// <summary>
/// Gets or sets the logo image locator.
/// </summary>
/// <value>The logo image locator.</value>
public string LogoImgLocator { get; set; }
/// <summary>
/// Gets or sets the description.
/// </summary>
/// <value>The description.</value>
public string Description { get; set;}
/// <summary>
/// Gets or sets the web page.
/// </summary>
/// <value>The web page.</value>
public string WebPage { get; set; }
}
}

View file

@ -0,0 +1,26 @@
namespace BookAStar.Model.Workflow.Marketing
{
public enum BillingMode { 
Unitary,
SetPrice,
ByExecutionTime
}
public partial class Service : BaseProduct
{
public string ContextId { get; set; }
public virtual Activity Context { get; set; }
public BillingMode? Billing { get; set; }
// TODO public ServiceSpecification Specification { get; set; }
/// <summary>
/// In euro, either by hour or by release
/// </summary>
/// <returns></returns>
public decimal? Pricing { get; set; }
}
}

View file

@ -0,0 +1,21 @@
namespace BookAStar.Model.Workflow.Marketing
{
public class Skill {
public string Name { get; set; }
public long Id { get; set; }
/// <summary>
/// indice de recherche de cette capacité
/// rendu par le système.
/// Valide entre 0 et 100,
/// Il démarre à 0.
/// </summary>
public int Rate { get; set; }
}
}

View file

@ -0,0 +1,16 @@
namespace BookAStar.Model.Workflow.Marketing
{
public partial class UserSkills
{
public long Id { get; set; }
public string UserId { get; set; }
public long SkillId { get; set; }
public string Comment { get; set; }
public int Rate { get; set; }
}
}

View file

@ -0,0 +1,43 @@
//
// BaseEvent.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace BookAStar.Model.Workflow.Messaging
{
/// <summary>
/// Base event.
/// </summary>
public class BaseEvent
{
/// <summary>
/// The title.
/// </summary>
public string Title { get; set; }
/// <summary>
/// The description.
/// </summary>
public string Description { get; set; }
}
}

View file

@ -0,0 +1,30 @@
using BookAStar.Model.Social;
using System;
namespace BookAStar.Model.Workflow.Messaging
{
/// <summary>
/// Query, for a date, with a given perfomer, at this given place.
/// </summary>
public class BookQuery {
/// <summary>
/// The command identifier
/// </summary>
public long Id {get; set; }
public DateTime EventDate{get; set; }
public Location Location { get; set; }
public BookQuery()
{
}
public BookQuery(Location eventLocation, DateTime eventDate)
{
Location = eventLocation;
EventDate = eventDate;
}
}
}

View file

@ -0,0 +1,46 @@
using BookAStar.Model.Social;
using System;
namespace BookAStar.Model.Workflow.Messaging
{
//
// BookQueryEvent.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
public class BookQueryEvent: YaEvent
{
/// <summary>
/// The location.
/// </summary>
public Location Location { get; set; }
/// <summary>
/// The start date.
/// </summary>
public DateTime StartDate { get; set; }
/// <summary>
/// Gets or sets the end date.
/// </summary>
/// <value>The end date.</value>
public DateTime EndDate { get; set; }
}
}

View file

@ -0,0 +1,41 @@
namespace BookAStar.Model.Workflow.Messaging
{
/// <summary>
/// A Notification, that mocks the one sent to Google,
/// since it fits my needs
/// </summary>
public class Notification
{
public long Id { get; set; }
/// <summary>
/// The title.
/// </summary>
public string title { get; set; }
/// <summary>
/// The body.
/// </summary>
public string body { get; set; }
/// <summary>
/// The icon.
/// </summary>
public string icon { get; set; }
/// <summary>
/// The sound.
/// </summary>
public string sound { get; set; }
/// <summary>
/// The tag.
/// </summary>
public string tag { get; set; }
/// <summary>
/// The color.
/// </summary>
public string color { get; set; }
/// <summary>
/// The click action.
/// </summary>
public string click_action { get; set; }
}
}

View file

@ -0,0 +1,42 @@
//
// PositionAndKeyphrase.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using BookAStar.Model.Social;
namespace BookAStar.Model.Workflow.Messaging
{
/// <summary>
/// Position and keyphrase.
/// </summary>
public class PositionAndKeyphrase {
/// <summary>
/// The phrase.
/// </summary>
public string phrase;
/// <summary>
/// The position.
/// </summary>
public Position pos;
}
}

View file

@ -0,0 +1,15 @@
using System;
namespace BookAStar
{
public class SearchQuery
{
public SearchQuery ()
{
}
public string Position { get; set; }
public string QueryString { get; set; }
}
}

View file

@ -0,0 +1,50 @@
//
// NFEvent.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace BookAStar.Model.Workflow.Messaging
{
/// <summary>
/// NF event.
/// </summary>
public class YaEvent : BaseEvent
{
/// <summary>
/// The name of the NF provider.
/// </summary>
public string ProviderName { get; set; }
/// <summary>
/// The NF provider identifier.
/// </summary>
public string ProviderId { get; set; }
/// <summary>
/// The promotion code.
/// </summary>
public string Comment { get; set; }
/// <summary>
/// The event web page.
/// </summary>
public string EventWebPage { get; set; }
/// <summary>
/// The image locator.
/// </summary>
public string Photo { get; set; }
}
}

View file

@ -0,0 +1,9 @@
namespace Yavsc.Models
{
public partial class Tag
{
public long Id { get; set; }
public string Name { get; set; }
}
}

View file

@ -0,0 +1,127 @@
using BookAStar.Model.Social;
using System;
using Xamarin.Forms;
using Xamarin.Forms.Maps;
using Yavsc;
namespace BookAStar
{
public class PinPage : ContentPage
{
Map map;
/*
protected async Task<Geolocator.Plugin.Abstractions.Position> GetPos() {
var locator = CrossGeolocator.Current;
locator.DesiredAccuracy = 50;
return await locator.GetPositionAsync (timeout: 10000);
}
private Position _pos;
public Position MyPosition {
get {
return _pos;
}
}
public async Task UpdateMyPos()
{
var pos = await GetPos();
_pos = new Position(pos.Latitude,pos.Longitude);
}
*/
protected override void OnAppearing ()
{
base.OnAppearing ();
}
public PinPage ()
{
map = new Map {
IsShowingUser = true,
HeightRequest = 100,
WidthRequest = 960,
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand
};
double lat=0;
double lon=0;
int pc = 0;
foreach (LocalizedEvent ev in Manager.Events) {
var pin = new Pin {
Type = PinType.SearchResult,
Position = new Xamarin.Forms.Maps.Position(
ev.Location.Latitude, ev.Location.Longitude),
Label = ev.Title,
Address = ev.Location.Address
};
pin.BindingContext = ev;
map.Pins.Add (pin);
// TODO find a true solution
lat = (lat * pc + ev.Location.Latitude) / (pc + 1);
lon = (lon * pc + ev.Location.Longitude) / (pc + 1);
pc++;
}
// TODO build a MapSpan covering events
map.MoveToRegion(MapSpan.FromCenterAndRadius (
new Xamarin.Forms.Maps.Position(lat,lon), Distance.FromMeters(100)));
/*
// A "relocate" button : useless, since it yet exists
var reLocate = new Button { Text = "Re-centrer" };
reLocate.Clicked += async delegate {
await UpdateMyPos();
Debug.WriteLine("Position: {0} {1}",MyPosition.Longitude,MyPosition.Latitude);
map.MoveToRegion (MapSpan.FromCenterAndRadius (
MyPosition, Distance.FromMeters (100)));
};
var buttons = new StackLayout {
Orientation = StackOrientation.Horizontal,
Children = {
reLocate
}
};
*/
// create map style buttons
var street = new Button { Text = "Street" };
var hybrid = new Button { Text = "Hybrid" };
var satellite = new Button { Text = "Satellite" };
street.Clicked += HandleMapStyleClicked;
hybrid.Clicked += HandleMapStyleClicked;
satellite.Clicked += HandleMapStyleClicked;
var segments = new StackLayout { Spacing = 30,
HorizontalOptions = LayoutOptions.CenterAndExpand,
Orientation = StackOrientation.Horizontal,
Children = {street, hybrid, satellite}
};
// put the page together
Content = new StackLayout {
Spacing = 0,
Children = {
map,
segments
}};
}
void HandleMapStyleClicked (object sender, EventArgs e)
{
var b = sender as Button;
switch (b.Text) {
case "Street":
map.MapType = MapType.Street;
break;
case "Hybrid":
map.MapType = MapType.Hybrid;
break;
case "Satellite":
map.MapType = MapType.Satellite;
break;
}
}
}
}

View file

@ -0,0 +1,30 @@
using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("BookAStar")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BookAStar")]
[assembly: AssemblyCopyright("Copyright © Paul Albert Schneider 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View file

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:BookAStar;Assembly:BookAStar"
x:Class="BookAStar.SearchPage" Title="Page de recherche"
Padding="10,40,10,10" >
<ContentPage.Content>
<StackLayout>
<StackLayout Orientation="Horizontal">
<Label Text="Utiliser ma position" />
<Switch x:Name="use_my_pos" HorizontalOptions="End" />
</StackLayout>
<StackLayout Orientation="Horizontal">
<Editor x:Name="search_phrase" HorizontalOptions="FillAndExpand"/>
<Button x:Name="btn_update" HorizontalOptions="End" />
</StackLayout>
<DatePicker x:Name="search_date" />
<ListView x:Name="list" ItemsSource="{x:Static local:Manager.Events}"
HasUnevenRows="true">
s
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout Orientation="Horizontal">
<Image Source="{Binding ImgLocator}" HeightRequest="80" />
<StackLayout Orientation="Vertical">
<Label Text="{Binding Title}"/>
<StackLayout Orientation="Horizontal">
<StackLayout><Label Text="Heure:" FontAttributes="Italic" FontSize="9" />
<Label Text="{Binding StartDate, StringFormat='{0:H:mm}'}" VerticalOptions="End"/>
</StackLayout>
<StackLayout><Label Text="Lieu:" FontAttributes="Italic" FontSize="9" VerticalOptions="End"/>
<Label Text="{Binding Location.Name}"/></StackLayout>
<Label Text="{Binding Promotion}" FontSize="20" TextColor="Yellow" BackgroundColor="#102030"/>
</StackLayout>
</StackLayout>
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage.Content>
</ContentPage>

View file

@ -0,0 +1,30 @@
using System;
using Xamarin.Forms;
using System.Collections.ObjectModel;
using BookAStar.Model.Social;
using BookAStar.Model.Workflow.Messaging;
namespace BookAStar
{
public partial class SearchPage : ContentPage
{
public ObservableCollection<LocalizedEvent> Events { get; private set; }
public SearchPage ()
{
InitializeComponent ();
BindingContext = this;
Events = Manager.Events;
list.ItemTapped += async (object sender, ItemTappedEventArgs e) => {
await Navigation.PushAsync(new EventDetail( (YaEvent) e.Item) { Title = "Détail de la soirée" } );
};
search_date.Date = DateTime.Now;
search_date.MinimumDate = DateTime.Now;
search_phrase.Text = "Suresnes";
btn_update.Clicked += (object sender, EventArgs e) => {
//
};
}
}
}

View file

@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:local="clr-namespace:BookAStar.Views;assembly=BookAStar"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="BookAStar.SettingsPage"
Title="Paramètres Booking star">
<ContentPage.Resources>
<ResourceDictionary>
<Style TargetType="Label">
<Setter Property="FontSize" Value="Large"/>
</Style>
</ResourceDictionary>
</ContentPage.Resources>
<StackLayout>
<Label Text="Compte utilisateur" />
<Label x:Name="UserNameLabel" Text="{Binding ActiveUserName}" />
<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="0"
ColumnSpacing="10"
RowSpacing="0">
<Label Grid.Column="0" Text="{Binding UserName}" />
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.Footer><StackLayout></StackLayout></ListView.Footer>
</ListView>
<StackLayout Orientation="Horizontal">
<Label Text="Status" VerticalOptions="Start"
XAlign="Center" IsVisible="true"
FontSize="Large" FontAttributes="Bold" TextColor="Yellow" />
<Label Text="Recevoir les notifications push"/>
<Switch x:Name="pushstatus" />
</StackLayout>
<Label Text="Genres Musicaux"/>
<ListView VerticalOptions="Start" x:Name="MusicalListView"
ItemsSource="{Binding Musical}"
>
<ListView.Header><StackLayout></StackLayout></ListView.Header>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout Orientation="Horizontal">
<Label Text="{Binding Key}" TextColor="Silver" FontAttributes="Italic"></Label>
<Slider Value="{Binding Value}" HorizontalOptions="FillAndExpand" ></Slider>
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.Footer><StackLayout></StackLayout></ListView.Footer>
</ListView>
<Label Text="Lieux de prédileciton" />
<ListView x:Name="EnvironListView"
ItemsSource="{Binding Environ}" >
<ListView.Header>
<StackLayout></StackLayout>
</ListView.Header>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout Orientation="Horizontal">
<Label Text="{Binding Key}" TextColor="Silver" FontAttributes="Italic"></Label>
<Slider Value="{Binding Value}" HorizontalOptions="FillAndExpand" ></Slider>
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.Footer>
<StackLayout></StackLayout>
</ListView.Footer>
</ListView>
<Button x:Name="BtnViewDeviceInfo" Text="Device info"></Button>
</StackLayout>
</ContentPage>

View file

@ -0,0 +1,97 @@
using BookAStar.Model.Auth.Account;
using System;
using System.Threading.Tasks;
using Xamarin.Forms;
using System.Windows.Input;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.ComponentModel;
namespace BookAStar
{
public partial class SettingsPage : ContentPage
{
public ICommand RemoteSettingsRefreshCommand { get; private set; }
public SettingsPage ()
{
InitializeComponent ();
AccountListView.ItemsSource = MainSettings.AccountList;
this.Musical = MainSettings.Musical;
this.Environ = MainSettings.Environ;
AddAccountBtn.Clicked += AddAccountBtn_Clicked;
RemoveAccountBouton.Clicked += RemoveAccountBouton_Clicked;
AccountListView.ItemSelected += Accounts_ItemSelected;
pushstatus.Toggled += Pushstatus_Toggled;
BtnViewDeviceInfo.Clicked += BtnDeviceInfo_Clicked;
}
private void BtnDeviceInfo_Clicked(object sender, EventArgs e)
{
((BookAStar.App) App.Current).ShowDeviceInfo();
}
protected void Pushstatus_Toggled(object sender, ToggledEventArgs e)
{
MainSettings.PushNotifications = pushstatus.IsToggled;
}
public ObservableCollection<User> Accounts { get; private set; }
public Dictionary<string, double> Musical { get; private set; }
public Dictionary<string, double> Environ { get; private set; }
private void PlateformSpecificInstance_IdentificationChanged(object sender, IdentificationChangedEventArgs e)
{
// Assert AccountListView.SelectedItem == e.NewIdentification;
}
private void Accounts_ItemSelected(object sender, SelectedItemChangedEventArgs e)
{
var user = e.SelectedItem as User;
// should later invoke IdentificationChanged
MainSettings.CurrentUser = user;
}
private async void RemoveAccountBouton_Clicked(object sender, EventArgs e)
{
User user = AccountListView.SelectedItem as User;
var doIt = await Confirm("Suppression de l'identification",
$"Vous êtes sur le point de supprimer votre identification pour ce compte : {user.UserName}\nContinuer ?");
if (doIt)
App.PlateformSpecificInstance.RevokeAccount(user.UserName);
}
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()
{
base.OnAppearing();
AccountListView.SelectedItem = MainSettings.CurrentUser;
pushstatus.IsToggled = MainSettings.PushNotifications;
}
private void AddAccountBtn_Clicked(object sender, EventArgs e)
{
App.PlateformSpecificInstance.AddAccount();
}
}
}

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Json.NET.Web" version="1.0.49" targetFramework="portable45-net45+win8+wpa81" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="portable45-net45+win8+wpa81" />
<package id="Xam.Plugins.Settings" version="2.1.0" targetFramework="portable45-net45+win8+wpa81" />
<package id="Xamarin.Forms" version="2.3.0.107" targetFramework="portable45-net45+win8+wpa81" />
<package id="Xamarin.Forms.Maps" version="2.3.0.107" targetFramework="portable45-net45+win8+wpa81" />
</packages>