Version 3.0.381

This commit is contained in:
Anja 2024-04-09 12:53:23 +02:00
parent f963c0a219
commit 3a363acf3a
1525 changed files with 60589 additions and 125098 deletions

View file

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8" ?>
<Application xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:themes="clr-namespace:ShareeBike.Themes;assembly=SharedBusinessLogic"
xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
x:Class="ShareeBike.App"
xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
ios:Application.EnableAccessibilityScalingForNamedFontSizes="false">
<Application.Resources>
<ResourceDictionary>
<xct:InvertedBoolConverter x:Key="InvertedBoolConverter" />
<x:String x:Key="IconMap">&#xf5a0;</x:String>
<x:String x:Key="IconSelectBike">&#xf002;</x:String>
<x:String x:Key="IconMyBikes">&#xf206;</x:String>
<x:String x:Key="IconAccount">&#xf007;</x:String>
<x:String x:Key="IconLogin">&#xf2f6;</x:String>
<x:String x:Key="IconSettings">&#xf013;</x:String>
<x:String x:Key="IconHelp">&#xf128;</x:String>
<x:String x:Key="IconContact">&#xf0e0;</x:String>
<x:String x:Key="IconInfo">&#xf05a;</x:String>
<x:String x:Key="IconClose">&#xf00d;</x:String>
<x:String x:Key="IconLegalInfo">&#xf129;</x:String>
<!--TogglePasswortEntry-->
<x:String x:Key="EyeOpen">&#xf06e;</x:String>
<x:String x:Key="EyeClose">&#xf070;</x:String>
<!--Arrow down from line-->
<x:String x:Key="ArrowDown">&#xf063;</x:String>
<!--Info in Circle-->
<x:String x:Key="InfoCircle">&#xf05a;</x:String>
<!--AaAbRideType-->
<x:String x:Key="LocationPin">&#xf3c5;</x:String>
<x:String x:Key="ArrowReturnBack">&#xf0e2;</x:String>
<!-- Add more resources here -->
<ResourceDictionary.MergedDictionaries>
<!-- Add more resource dictionaries here -->
<themes:LastenradBayern/>
<!-- Add more resource dictionaries here -->
</ResourceDictionary.MergedDictionaries>
<!-- Add more resources here -->
</ResourceDictionary>
</Application.Resources>
</Application>

View file

@ -0,0 +1,347 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MonkeyCache.FileStore;
using Plugin.Connectivity;
using Serilog;
using Serilog.Core;
using Serilog.Events;
using ShareeBike.Model;
using ShareeBike.Model.Connector;
using ShareeBike.Model.Device;
using ShareeBike.Model.Logging;
using ShareeBike.Model.Settings;
using ShareeBike.Model.User.Account;
using ShareeBike.Services;
using ShareeBike.Services.BluetoothLock.Crypto;
using ShareeBike.Services.Geolocation;
using ShareeBike.Services.Permissions;
using ShareeBike.View;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
// Required for support of binding package, see https://github.com/nuitsjp/Xamarin.Forms.GoogleMaps.Bindings.
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
// Add ExportFont attribute
[assembly: ExportFont("Font Awesome 5 Free-Solid-900.otf", Alias = "FA-S")]
[assembly: ExportFont("Font Awesome 5 Brands-Regular-400.otf", Alias = "FA-B")]
[assembly: ExportFont("Font Awesome 5 Free-Regular-400.otf", Alias = "FA-R")]
[assembly: ExportFont("Roboto-Regular.ttf", Alias = "RobotoRegular")]
[assembly: ExportFont("Roboto-Bold.ttf", Alias = "RobotoBold")]
[assembly: ExportFont("Roboto-Italic.ttf", Alias = "RobotoItalic")]
namespace ShareeBike
{
public partial class App : Application
{
/// <summary>Title of the attachment file.</summary>
private const string ATTACHMENTTITLE = "Diagnostics.txt";
/// <summary> Model root. </summary>
private static ShareeBikeApp m_oModelRoot;
/// <summary>
/// Gets the model root.
/// </summary>
public static ShareeBikeApp ModelRoot
{
get
{
if (m_oModelRoot != null)
{
// Root model already exists, nothing to do.
return m_oModelRoot;
}
// Get folder where to read settings from
var specialFolders = DependencyService.Get<ISpecialFolder>();
var internalPersonalDir = specialFolders.GetInternalPersonalDir();
// Delete attachment from previous session.
DeleteAttachment(internalPersonalDir);
// Setup logger using default settings.
ShareeBikeApp.SetupLogging(
new LoggingLevelSwitch(Model.Settings.Settings.DEFAULTLOGGINLEVEL),
internalPersonalDir);
// Subscribe to any unhandled/ unobserved exceptions.
AppDomain.CurrentDomain.UnhandledException += (sender, unobservedTaskExceptionEventArgs) => { Log.Fatal("Unobserved task exception: {Exception}", unobservedTaskExceptionEventArgs.ExceptionObject); };
TaskScheduler.UnobservedTaskException += (sender, unhandledExceptionEventArgs) => { Log.Fatal("Unhandled exception: {Exception}", unhandledExceptionEventArgs.Exception); };
// Restore last model state from json- file.
Dictionary<string, string> settingsJSON = new Dictionary<string, string>();
try
{
settingsJSON = JsonSettingsDictionary.Deserialize(internalPersonalDir);
}
catch (Exception exception)
{
Log.Error("Reading application settings from file failed.", exception);
}
Model.Settings.Settings settings;
try
{
settings = new Model.Settings.Settings(
null, // Turn off filtering for LastenradBayern- context
null, // Turn off filtering for LastenradBayern- context
JsonSettingsDictionary.GetStartupSettings(settingsJSON) ?? new StartupSettings(),
JsonSettingsDictionary.GetCopriHostUri(settingsJSON),
JsonSettingsDictionary.GetPollingParameters(settingsJSON),
JsonSettingsDictionary.GetMinimumLoggingLevel(settingsJSON),
JsonSettingsDictionary.GetIsReportLevelVerbose(settingsJSON),
JsonSettingsDictionary.GetExpiresAfter(settingsJSON),
JsonSettingsDictionary.GetActiveLockService(settingsJSON),
JsonSettingsDictionary.GetConnectTimeout(settingsJSON),
JsonSettingsDictionary.GetActiveGeolocationService(settingsJSON),
JsonSettingsDictionary.GetCenterMapToCurrentLocation(settingsJSON),
Xamarin.Forms.GoogleMaps.MapSpan.FromCenterAndRadius(new Xamarin.Forms.GoogleMaps.Position(48.945396, 11.395330), Xamarin.Forms.GoogleMaps.Distance.FromKilometers(2.9)),
JsonSettingsDictionary.GetLogToExternalFolder(settingsJSON),
JsonSettingsDictionary.GetIsSiteCachingOn(settingsJSON),
JsonSettingsDictionary.GetActiveTheme(settingsJSON) ?? typeof(Themes.LastenradBayern).Name);
}
catch (Exception exception)
{
Log.Error("Deserializing application settings from dictionary failed.", exception);
settings = new Model.Settings.Settings();
}
if (settings.MinimumLogEventLevel != Model.Settings.Settings.DEFAULTLOGGINLEVEL
|| settings.LogToExternalFolder)
{
// Either
// - logging is not set to default value or
// - logging is performed to external folder.
// Need to reconfigure.
Log.CloseAndFlush(); // Close before modifying logger configuration. Otherwise a sharing violation occurs.
ShareeBikeApp.SetupLogging(
new LoggingLevelSwitch(settings.MinimumLogEventLevel),
!settings.LogToExternalFolder
? internalPersonalDir
: specialFolders.GetExternalFilesDir());
}
// Get auth cookie
Log.Debug("Get auth cookie.");
IStore store = null;
// Version of last version used or null for initial installation.
// Used for updating purposes.
var lastVersion = JsonSettingsDictionary.GetAppVersion(settingsJSON);
if (new Version(3, 0, 290) <= lastVersion)
{
// App versions newer than 3.0.173 stored geolocation service in configuration.
// Version 3.0.290: Geolocation service "GeolocationService" is no more supported.
// For this reasons a switch of geolocation service is forced when loading configurations from ealier versions.
LocationServicesContainer.SetActive(settings.ActiveGeolocationService);
}
store = new Store();
Barrel.ApplicationId = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
// Get main thread synchronization context to be able to update gui elements from worker threads.
var context = SynchronizationContext.Current;
var appInfoService = DependencyService.Get<IAppInfo>();
var smartDevice = DependencyService.Get<ISmartDevice>();
const string MERCHANTID = "0000000000";
// Create new app instance.
Log.Debug("Constructing main model...");
m_oModelRoot = new ShareeBikeApp(
settings,
store, // Manages user account
isConnectedFunc: () => CrossConnectivity.Current.IsConnected,
connectorFactory: (isConnected, activeUri, sessionCookie, mail, expiresAfter) => ConnectorFactory.Create(
isConnected,
activeUri,
new Repository.AppContextInfo(MERCHANTID, AppFlavor.LastenradBayern.GetDisplayName().Replace(" ", ""), appInfoService.Version),
CultureInfo.CurrentUICulture.TwoLetterISOLanguageName,
sessionCookie,
mail,
smartDevice,
expiresAfter),
merchantId: MERCHANTID,
bluetoothService: BluetoothService, /* locksService */
locationPermissionsService: PermissionsService,
locationServicesContainer: LocationServicesContainer,
locksService: null,
device: smartDevice,
specialFolder: specialFolders,
cipher: new Cipher(),
new ShareeBike.Services.ThemeNS.Theme(Application.Current.Resources.MergedDictionaries),
postAction: (d, obj) => context.Post(d, obj),
currentVersion: appInfoService.Version,
lastVersion: lastVersion,
whatsNewShownInVersion: JsonSettingsDictionary.GetWhatsNew(settingsJSON) ?? settingsJSON.GetAppVersion(),
flavor: AppFlavor.LastenradBayern);
Log.Debug("Main model successfully constructed.");
return m_oModelRoot;
}
}
/// <summary>
/// Entry point of application.
/// </summary>
public App()
{
InitializeComponent();
// Check which page to show first.
var mainPage = new View.RootShell.AppShell();
var currentItem = Activator.CreateInstance(ModelRoot.StartupSettings.StartupPage.GetViewType()) as ContentPage;
if (currentItem != null && ModelRoot.ActiveUser.IsLoggedIn)
{
mainPage.CurrentItem = currentItem;
}
MainPage = ModelRoot.WhatsNew.IsShowRequired
? new View.WhatsNew.WhatsNewPage(() => MainPage = mainPage) // Show whats new info.
: (Page)mainPage; // Just start sharee- app
}
/// <summary> Concatenates all log files to a single one. </summary>
/// <returns>Full file name of attachment.</returns>
public static string CreateAttachment()
{
var sessionLogFiles = Log.Logger.GetLogFiles().ToArray();
if (sessionLogFiles.Length < 1)
{
// Either
// - there is no logging file
// - an error occurred getting list of log files.
return string.Empty;
}
var fullLogFileName = System.IO.Path.Combine(ModelRoot.LogFileParentFolder, ATTACHMENTTITLE);
// Stop logging to avoid file access exception.
Log.CloseAndFlush();
System.IO.File.WriteAllLines(
fullLogFileName,
sessionLogFiles.SelectMany(name =>
(new List<string> { $"{{\"SessionFileName\":\"{name}\"}}" })
.Concat(System.IO.File.ReadLines(name).ToArray())));
// Resume logging
ShareeBikeApp.SetupLogging(
ModelRoot.Level,
ModelRoot.LogFileParentFolder);
return fullLogFileName;
}
/// <summary>Deletes an attachment if there is one.</summary>
/// <param name="folder">Folder to delete, is null folder is queried from model.</param>
private static void DeleteAttachment(string folder = null)
{
var attachment = System.IO.Path.Combine(folder ?? ModelRoot.LogFileParentFolder, ATTACHMENTTITLE);
if (!System.IO.File.Exists(attachment))
{
// No attachment found.
return;
}
System.IO.File.Delete(attachment);
}
protected override void OnSleep()
{
// Handle when your app sleeps
Log.CloseAndFlush();
}
protected override void OnResume()
{
DeleteAttachment();
ShareeBikeApp.SetupLogging(
ModelRoot.Level,
ModelRoot.LogFileParentFolder);
}
/// <param name="uri">The URI for the request.</param>
/// <summary>Overriden to respond when the user initiates an app link request.</summary>
protected override void OnAppLinkRequestReceived(Uri uri)
{
base.OnAppLinkRequestReceived(uri);
if (uri.Host.ToLower() == "sharee.bike")
{
// Input e.g. sharee.bike/sharee?lat=49.921&long=32.51
Array segments = Array.ConvertAll(uri.Segments, segment => segment.Replace("/", "")).Skip(1).ToArray();
if (uri.Query.Length > 0)
{
Dictionary<string, string> queryDict = uri.Query
.Substring(1)
.Split("&")
.Select(query => query.Split('='))
.ToDictionary(query => query.FirstOrDefault(), query => query.Skip(1).FirstOrDefault());
}
// segments == ["sharee"]
// queryDict == [{["lat", "49.921"]}], {["long", "32.51"]}]
// => Navigate and pass params depending on linkinput
// If no custom navigation is configured, the app just opens as if the user opened it
}
}
/// <summary> Gets the current logging level.</summary>
/// <returns></returns>
private static LogEventLevel GetCurrentLogEventLevel()
{
foreach (LogEventLevel level in Enum.GetValues(typeof(LogEventLevel)))
{
if (Log.IsEnabled(level))
return level;
}
return LogEventLevel.Error;
}
/// <summary>
/// Holds the permission service instance.
/// </summary>
private static ILocationPermission _PermissionsService = null;
/// <summary>
/// Service to manage permissions (location) of the app.
/// </summary>
public static ILocationPermission PermissionsService
{
get
{
if (_PermissionsService != null)
return _PermissionsService;
_PermissionsService = new ShareeBike.Services.Permissions.Essentials.LocationPermissions();
return _PermissionsService;
}
}
/// <summary> Service to manage bluetooth stack.</summary>
public static Plugin.BLE.Abstractions.Contracts.IBluetoothLE BluetoothService => Plugin.BLE.CrossBluetoothLE.Current;
/// <summary>
/// Service container to manage geolocation services.
/// </summary>
public static IServicesContainer<IGeolocationService> LocationServicesContainer { get; }
= new ServicesContainerMutableT<IGeolocationService>(
new HashSet<IGeolocationService> {
new LastKnownGeolocationService(DependencyService.Get<IGeolodationDependent>()),
new SimulatedGeolocationService(DependencyService.Get<IGeolodationDependent>()),
new GeolocationAccuracyMediumService(DependencyService.Get<IGeolodationDependent>()),
new GeolocationAccuracyHighService(DependencyService.Get<IGeolodationDependent>()),
new GeolocationAccuracyBestService(DependencyService.Get<IGeolodationDependent>())},
Model.Settings.Settings.DefaultLocationService.FullName);
}
}

View file

@ -0,0 +1,33 @@
using System.Linq;
using ShareeBike.View.Map;
using ShareeBike.ViewModel.Map;
using Xamarin.Forms;
namespace ShareeBike
{
public static class BackdoorMethodHelpers
{
public static void DoTapPage(string stationId)
{
Serilog.Log.Information($"Request via backdoor to tap station {stationId}.");
var currentPage = GetCurrentPage();
var mapPageViewModel = (currentPage as MapPage)?.BindingContext as MapPageViewModel;
if (mapPageViewModel == null)
{
Serilog.Log.Error($"Request via backdoor to tap station {stationId} aborted because current page is not of expected type {typeof(MapPage).Name}. Type detected is {currentPage.GetType().Name}.");
return;
}
Serilog.Log.Information($"Invoking member to tap.");
mapPageViewModel?.OnStationClicked(stationId);
}
/// <summary> Gets the current page assumed that app is master detail page.</summary>
/// <returns></returns>
static Page GetCurrentPage()
{
return Shell.Current.CurrentPage;
}
}
}

View file

@ -0,0 +1,669 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="de" xml:lang="de">
<head>
<title>ShareeBike-App</title>
<meta name="viewport" content="width=device-width,target-densitydpi=device-dpi,initial-scale=1,user-scalable=yes" />
<link rel="manifest" href="" />
<link rel="stylesheet" type="text/css" href="https://www2.tink-konstanz.de/css/local_style.css" media="screen" />
<link rel="stylesheet" type="text/css" href="https://www2.tink-konstanz.de/bootstrap-3.3.6-dist/css/bootstrap.css" media="screen" />
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Roboto+Condensed" media="screen" />
<link rel="stylesheet" type="text/css" href="https://www2.tink-konstanz.de/jquery-ui/jquery-ui.min.css" media="screen" />
<style type="text/css">
@import url("https://www2.tink-konstanz.de/css/local_style.css");
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<div class='container' id='Contenttxt'>
<div class="content_title1" style="">
<b>ACTIVE_APPNAME</b>
</div>
<div class="content_title2" style="">
Version: CURRENT_VERSION_ShareeBikeAPP
</div>
<br />
<div class="content_title2" style="">
Verwendete Bibliotheken:<br />
<table>
<tr><th>Paket </th><th>Lizenz </th></tr>
<tr><td>Newtonsoft Json.NET von James Newton-King </td><td><a href="#MITLicense2007">MIT Lizenz 2007</a> </td></tr>
<tr><td>PCLCrypto von AArnott </td><td><a href="#MSPL_Long">Microsoft Public License(Ms-PL)</a> </td></tr>
<tr><td>PCLStorage von Daniel Plaisted </td><td><a href="#MSPL_Long">Microsoft Public License (Ms-PL)</a> </td></tr>
<tr><td>Pinvoke von AArnott </td><td><a href="#MITLicenseAArnott">MIT- Lizenz für Pinvoke</a> </td></tr>
<tr><td>Plugin.BLE Adrian Seceleanu, Sven-Michael Stübe </td><td><a href="#ApacheLicense2.0_2004">Apache License 2.0</a> </td></tr>
<tr><td>Plugin.Permissions von James Montemagno </td><td><a href="#MITLicenseMontemagno2016">MIT Lizenz 2016</a> </td></tr>
<tr><td>Polly von Michael Wolfenden, App vNext </td><td><a href="#NewBSDLicense">New BSD License</a> </td></tr>
<tr><td>Serilog von Serilog Contributors </td><td><a href="#ApacheLicense2.0_2004">Apache License 2.0</a> </td></tr>
<tr><td>Serilog.Sinks.Debug von Serilog Contributors </td><td><a href="#ApacheLicense2.0_2004">Apache License 2.0</a> </td></tr>
<tr><td>Serilog.Sinks.File von Serilog Contributors </td><td><a href="#ApacheLicense2.0_2004">Apache License 2.0</a> </td></tr>
<tr><td>Serilog.Sinks.Xaramri von Serilog Contributors </td><td><a href="#ApacheLicense2.0_2004">Apache License 2.0</a> </td></tr>
<tr><td>Validation von AArnott </td><td><a href="#MSPL_Short">Microsoft Public License (MS-PL)</a> </td></tr>
<tr><td>Xam.Plugins.Messaging von Carel Lotz </td><td><a href="#MITLicense2014">MIT Lizenz 2014</a> </td></tr>
<tr><td>MonkeyCache von James Montemagno </td><td><a href="#MITLicense2018">MIT Lizenz 2018</a> </td></tr>
<tr><td>Xam.Plugin.Connectivity von James Montemagno </td><td><a href="#MITLicenseMontemagnoLCC2016">MIT Lizenz 2016</a> </td></tr>
<tr><td>Xamarin.Forms.GoogleMaps von amay077 </td><td><a href="#MITLicense2016_2017">MIT Lizenz 2016- 2017</a> </td></tr>
<tr><td>Xamarin.Essentials von Microsoft </td><td><a href="#MITLicenseMicrosoft">MIT Lizenz</a> </td></tr>
</table>
</div>
<br />
<div class="content_title2" style="">
Lizenzen:
<article id="ApacheLicense2.0_2004">
<div class="content2">
<span class='content1'>Apache License</span><br />
<p>Version 2.0, January 2004</p>
<p>www.apache.org</p>
<p>TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION</p>
<p>
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and
distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright
owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities
that control, are controlled by, or are under common control with that entity.
For the purposes of this definition, "control" means (i) the power, direct or
indirect, to cause the direction or management of such entity, whether by
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising
permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including
but not limited to software source code, documentation source, and configuration
files.
"Object" form shall mean any form resulting from mechanical transformation or
translation of a Source form, including but not limited to compiled object code,
generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made
available under the License, as indicated by a copyright notice that is included
in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that
is based on (or derived from) the Work and for which the editorial revisions,
annotations, elaborations, or other modifications represent, as a whole, an
original work of authorship. For the purposes of this License, Derivative Works
shall not include works that remain separable from, or merely link (or bind by
name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version
of the Work and any modifications or additions to that Work or Derivative Works
thereof, that is intentionally submitted to Licensor for inclusion in the Work
by the copyright owner or by an individual or Legal Entity authorized to submit
on behalf of the copyright owner. For the purposes of this definition,
"submitted" means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems, and
issue tracking systems that are managed by, or on behalf of, the Licensor for
the purpose of discussing and improving the Work, but excluding communication
that is conspicuously marked or otherwise designated in writing by the copyright
owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
of whom a Contribution has been received by Licensor and subsequently
incorporated within the Work.
</p>
<p>
2. Grant of Copyright License.
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the Work and such
Derivative Works in Source or Object form.
</p>
<p>
3. Grant of Patent License.
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable (except as stated in this section) patent license to make, have
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
such license applies only to those patent claims licensable by such Contributor
that are necessarily infringed by their Contribution(s) alone or by combination
of their Contribution(s) with the Work to which such Contribution(s) was
submitted. If You institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
Contribution incorporated within the Work constitutes direct or contributory
patent infringement, then any patent licenses granted to You under this License
for that Work shall terminate as of the date such litigation is filed.
</p>
<p>
4. Redistribution.
You may reproduce and distribute copies of the Work or Derivative Works thereof
in any medium, with or without modifications, and in Source or Object form,
provided that You meet the following conditions:
You must give any other recipients of the Work or Derivative Works a copy of
this License; and
You must cause any modified files to carry prominent notices stating that You
changed the files; and
You must retain, in the Source form of any Derivative Works that You distribute,
all copyright, patent, trademark, and attribution notices from the Source form
of the Work, excluding those notices that do not pertain to any part of the
Derivative Works; and
If the Work includes a "NOTICE" text file as part of its distribution, then any
Derivative Works that You distribute must include a readable copy of the
attribution notices contained within such NOTICE file, excluding those notices
that do not pertain to any part of the Derivative Works, in at least one of the
following places: within a NOTICE text file distributed as part of the
Derivative Works; within the Source form or documentation, if provided along
with the Derivative Works; or, within a display generated by the Derivative
Works, if and wherever such third-party notices normally appear. The contents of
the NOTICE file are for informational purposes only and do not modify the
License. You may add Your own attribution notices within Derivative Works that
You distribute, alongside or as an addendum to the NOTICE text from the Work,
provided that such additional attribution notices cannot be construed as
modifying the License.
You may add Your own copyright statement to Your modifications and may provide
additional or different license terms and conditions for use, reproduction, or
distribution of Your modifications, or for any such Derivative Works as a whole,
provided Your use, reproduction, and distribution of the Work otherwise complies
with the conditions stated in this License.
</p>
<p>
5. Submission of Contributions.
Unless You explicitly state otherwise, any Contribution intentionally submitted
for inclusion in the Work by You to the Licensor shall be under the terms and
conditions of this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify the terms of
any separate license agreement you may have executed with Licensor regarding
such Contributions.
</p>
<p>
6. Trademarks.
This License does not grant permission to use the trade names, trademarks,
service marks, or product names of the Licensor, except as required for
reasonable and customary use in describing the origin of the Work and
reproducing the content of the NOTICE file.
</p>
<p>
7. Disclaimer of Warranty.
Unless required by applicable law or agreed to in writing, Licensor provides the
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
including, without limitation, any warranties or conditions of TITLE,
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
solely responsible for determining the appropriateness of using or
redistributing the Work and assume any risks associated with Your exercise of
permissions under this License.
</p>
<p>
8. Limitation of Liability.
In no event and under no legal theory, whether in tort (including negligence),
contract, or otherwise, unless required by applicable law (such as deliberate
and grossly negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special, incidental,
or consequential damages of any character arising as a result of this License or
out of the use or inability to use the Work (including but not limited to
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
any and all other commercial damages or losses), even if such Contributor has
been advised of the possibility of such damages.
</p>
<p>
9. Accepting Warranty or Additional Liability.
While redistributing the Work or Derivative Works thereof, You may choose to
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
other liability obligations and/or rights consistent with this License. However,
in accepting such obligations, You may act only on Your own behalf and on Your
sole responsibility, not on behalf of any other Contributor, and only if You
agree to indemnify, defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason of your
accepting any such warranty or additional liability.
</p>
<p>
END OF TERMS AND CONDITIONS
</p>
<p>
APPENDIX: How to apply the Apache License to your work
To apply the Apache License to your work, attach the following boilerplate
notice, with the fields enclosed by brackets "[]" replaced with your own
identifying information. (Don't include the brackets!) The text should be
enclosed in the appropriate comment syntax for the file format. We also
recommend that a file or class name and description of purpose be included on
the same "printed page" as the copyright notice for easier identification within
third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
</p>
</div>
</article>
<article id="MSPL_Long">
<div class="content2">
<span class='content1'>Microsoft Public License (Ms-PL)</span><br />
<p>
This license governs use of the accompanying software. If you use the software,
you accept this license. If you do not accept the license, do not use the
software.
</p>
<p>1. Definitions</p>
<p>
The terms "reproduce," "reproduction," "derivative works," and "distribution"
have the same meaning here as under U.S. copyright law.
</p>
<p>
A "contribution" is the original software, or any additions or changes to the
software.
</p>
<p>
A "contributor" is any person that distributes its contribution under this
license.
</p>
<p>
"Licensed patents" are a contributor's patent claims that read directly on its
contribution.
</p>
<p>2. Grant of Rights</p>
<p>
(A) Copyright Grant- Subject to the terms of this license, including the license
conditions and limitations in section 3, each contributor grants you a
non-exclusive, worldwide, royalty-free copyright license to reproduce its
contribution, prepare derivative works of its contribution, and distribute its
contribution or any derivative works that you create.
</p>
<p>
(B) Patent Grant- Subject to the terms of this license, including the license
conditions and limitations in section 3, each contributor grants you a
non-exclusive, worldwide, royalty-free license under its licensed patents to
make, have made, use, sell, offer for sale, import, and/or otherwise dispose of
its contribution in the software or derivative works of the contribution in the
software.
</p>
<p>3. Conditions and Limitations</p>
<p>
(A) No Trademark License- This license does not grant you rights to use any
contributors' name, logo, or trademarks.
</p>
<p>
(B) If you bring a patent claim against any contributor over patents that you
claim are infringed by the software, your patent license from such contributor
to the software ends automatically.
</p>
<p>
(C) If you distribute any portion of the software, you must retain all
copyright, patent, trademark, and attribution notices that are present in the
software.
</p>
<p>
(D) If you distribute any portion of the software in source code form, you may
do so only under this license by including a complete copy of this license with
your distribution. If you distribute any portion of the software in compiled or
object code form, you may only do so under a license that complies with this
license.
</p>
<p>
(E) The software is licensed "as-is." You bear the risk of using it. The
contributors give no express warranties, guarantees or conditions. You may have
additional consumer rights under your local laws which this license cannot
change. To the extent permitted under your local laws, the contributors exclude
the implied warranties of merchantability, fitness for a particular purpose and
non-infringement.
</p>
</div>
</article>
<article id="MSPL_Short">
<div class="content2">
<span class='content1'>Microsoft Public License (MS-PL)</span><br />
<p>
This license governs use of the accompanying software. If you use the software, you
accept this license. If you do not accept the license, do not use the software.
</p>
<p>1. Definitions</p>
<p>
The terms "reproduce," "reproduction," "derivative works," and "distribution" have the
same meaning here as under U.S. copyright law.
A "contribution" is the original software, or any additions or changes to the software.
A "contributor" is any person that distributes its contribution under this license.
"Licensed patents" are a contributor's patent claims that read directly on its contribution.
</p>
<p>2. Grant of Rights</p>
<p>
(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
</p>
<p>
(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
</p>
<p>3. Conditions and Limitations</p>
<p>
(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
</p>
<p>
(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
</p>
<p>
(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
</p>
<p>
(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
</p>
<p>
(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
</p>
</div>
</article>
<article id="MITLicenseAArnott">
<div class="content2">
<span class='content1'>MIT- Lizenz für Pinvoke von AArnott</span><br />
<p>
The following license applies to all files in this project unless specified otherwise
within individual files.
See also the COPYRIGHT.md file.
</p>
<p>The MIT License (MIT)</p>
<p>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
</p>
<p>
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
</p>
<p>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
</p>
</div>
</article>
<article id="MITLicense2007">
<div class="content2">
<span class='content1'>The MIT License (MIT)</span><br />
<p>Copyright (c) 2007 James Newton-King</p>
<p>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the /"Software/"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
</p>
<p>
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
</p>
<p>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
</p>
</div>
</article>
<article id="MITLicense2014">
<div class="content2">
<span class='content1'>The MIT License (MIT)</span><br />
<p>Copyright (c) 2014 Carel Lotz</p>
<p>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
</p>
<p>
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
</p>
<p>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
</p>
</div>
</article>
<article id="MITLicense2016_2017">
<div class="content2">
<span class='content1'>The MIT License (MIT)</span><br />
<p>Copyright (c) amay077 2016 - 2017</p>
<p>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
</p>
<p>
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
</p>
<p>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
</p>
</div>
</article>
<article id="MITLicense2018">
<div class="content2">
<span class='content1'>MIT License</span><br />
<p>Copyright (c) 2018 James Montemagno</p>
<p>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
</p>
<p>
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
</p>
<p>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
</p>
</div>
</article>
<article id="MITLicenseMontemagnoLCC2016">
<div class="content2">
<span class='content1'>The MIT License (MIT)</span><br />
<p>
Copyright (c) 2016 James Montemagno / Refractored LLC
</p>
<p>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
</p>
<p>
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
</p>
<p>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
</p>
</div>
</article>
<article id="NewBSDLicense">
<div class="content2">
<span class='content1'>New BSD License</span><br />
<p>
Copyright (c) 2015-2020, App vNext<br />
All rights reserved.
</p>
<p>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
<ul>
<li /> Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
<li /> Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
<li /> Neither the name of App vNext nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
</ul>
</p>
<p>
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</p>
</div>
</article>
<article id="MITLicenseMicrosoft">
<div class="content2">
<p>Xamarin.Essentials</p>
<span class='content1'>The MIT License (MIT)</span><br />
<p>Copyright (c) Microsoft Corporation</p>
<p>All rights reserved.</p>
<p>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
</p>
<p>
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
</p>
<p>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
</p>
</div>
</article>
<article id="MITLicenseMontemagno2016">
<div class="content2">
<span class='content1'>The MIT License (MIT)</span><br />
<p>
Copyright (c) 2016 James Montemagno
</p>
<p>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
</p>
<p>
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
</p>
<p>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
</p>
</div>
</article>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,297 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<HasSharedItems>true</HasSharedItems>
<SharedGUID>5297504f-603f-4e1a-98aa-57c4a0d9d833</SharedGUID>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<Import_RootNamespace>ShareeBike</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)BackdoorMethodHelpers.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\RootShell\AppShellViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)View\Account\AccountPage.xaml.cs">
<SubType>Code</SubType>
<DependentUpon>AccountPage.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)View\Bike\BCBike.xaml.cs">
<DependentUpon>BCBike.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)View\Bike\BikeViewCellTemplateSelector.cs" />
<Compile Include="$(MSBuildThisFileDirectory)View\Bike\ILockItBike.xaml.cs">
<DependentUpon>ILockItBike.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)View\Contact\SelectStationPage.xaml.cs">
<DependentUpon>SelectStationPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)View\FeedbackPopup.xaml.cs">
<DependentUpon>FeedbackPopup.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)View\SelectBike\SelectBikePage.xaml.cs">
<DependentUpon>SelectBikePage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)View\MiniSurvey\MiniSurveyPage.xaml.cs">
<DependentUpon>MiniSurveyPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)View\MiniSurvey\Question\CheckOneViewCell.xaml.cs">
<DependentUpon>CheckOneViewCell.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)View\MiniSurvey\Question\FreeTextViewCell.xaml.cs">
<DependentUpon>FreeTextViewCell.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)View\MiniSurvey\Question\QuestionViewCellTemplateSelector.cs" />
<Compile Include="$(MSBuildThisFileDirectory)View\RootShell\FlyoutHeader.xaml.cs">
<DependentUpon>FlyoutHeader.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)View\RootShell\AppShell.xaml.cs">
<DependentUpon>AppShell.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)View\ViewTypesTypeProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Model\Device\SpecialFolder.cs" />
<Compile Include="$(MSBuildThisFileDirectory)View\Help\HelpPage.xaml.cs">
<DependentUpon>HelpPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)View\CopriWebView\ManageAccountPage.xaml.cs">
<DependentUpon>ManageAccountPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)View\CopriWebView\RegisterPage.xaml.cs">
<DependentUpon>RegisterPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)View\CopriWebView\PasswordForgottenPage.xaml.cs">
<DependentUpon>PasswordForgottenPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)View\WhatsNew\Gtc\GtcPage.xaml.cs">
<DependentUpon>GtcPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)View\WhatsNew\WhatsNewPage.xaml.cs">
<DependentUpon>WhatsNewPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\ViewModelResourceHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)View\BikesAtStation\BikesAtStationPage.xaml.cs">
<DependentUpon>BikesAtStationPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)View\Contact\ContactPage.xaml.cs">
<DependentUpon>ContactPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)View\LegalInformation\LegalInformationPage.xaml.cs">
<DependentUpon>LegalInformationPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)View\Login\LoginPage.xaml.cs">
<DependentUpon>LoginPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)View\Map\MapPage.xaml.cs">
<DependentUpon>MapPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)View\MyBikes\MyBikesPage.xaml.cs">
<DependentUpon>MyBikesPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)View\Settings\SettingsPage.xaml.cs">
<DependentUpon>SettingsPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)App.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)HtmlResouces\V02\InfoLicenses.html" />
<EmbeddedResource Include="$(MSBuildThisFileDirectory)View\Account\AccountPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)View\Login\LoginPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)View\BikesAtStation\BikesAtStationPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)View\Contact\ContactPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)View\Map\MapPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)View\MyBikes\MyBikesPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="$(MSBuildThisFileDirectory)View\BikesAtStation\" />
<Folder Include="$(MSBuildThisFileDirectory)View\Help\" />
<Folder Include="$(MSBuildThisFileDirectory)View\Login\" />
<Folder Include="$(MSBuildThisFileDirectory)View\Map\" />
<Folder Include="$(MSBuildThisFileDirectory)View\MyBikes\" />
<Folder Include="$(MSBuildThisFileDirectory)HtmlResouces\V02\" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)View\Settings\SettingsPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)View\LegalInformation\LegalInformationPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)View\Help\HelpPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)View\WhatsNew\WhatsNewPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)View\WhatsNew\Gtc\GtcPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)View\CopriWebView\RegisterPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)View\CopriWebView\ManageAccountPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)View\CopriWebView\PasswordForgottenPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)View\Bike\BCBike.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)View\Bike\ILockItBike.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)View\RootShell\AppShell.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)View\RootShell\FlyoutHeader.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)View\FeedbackPopup.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)View\SelectBike\SelectBikePage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)View\Contact\SelectStationPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)View\MiniSurvey\MiniSurveyPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)View\MiniSurvey\Question\CheckOneViewCell.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)View\MiniSurvey\Question\FreeTextViewCell.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Resources\Fonts\Font Awesome 5 Free-Solid-900.otf">
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Resources\Fonts\Font Awesome 5 Brands-Regular-400.otf">
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Resources\Fonts\Font Awesome 5 Free-Regular-400.otf">
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Resources\Fonts\Roboto-Bold.ttf">
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Resources\Fonts\Roboto-Italic.ttf">
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Resources\Fonts\Roboto-Regular.ttf">
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
</ItemGroup>
</Project>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>{8D4F2CDD-32C6-4AA1-A9E1-7B27BDCEB3A5}</ProjectGuid>
<ReleaseVersion>3.0</ReleaseVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
<PropertyGroup />
<Import Project="LastenradBayern.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
</Project>

View file

@ -0,0 +1,24 @@
using ShareeBike.Model.Device;
using Xamarin.Forms;
namespace ShareeBike.Model.Device
{
public class SpecialFolder : ISpecialFolder
{
/// <summary>
/// Get the folder name of external folder to write to.
/// </summary>
/// <returns></returns>
public string GetExternalFilesDir()
{
return DependencyService.Get<ISpecialFolder>().GetExternalFilesDir();
}
/// <summary> Gets the folder name of the personal data folder dir on internal storage. </summary>
/// <returns>Directory name.</returns>
public string GetInternalPersonalDir()
{
return DependencyService.Get<ISpecialFolder>().GetInternalPersonalDir();
}
}
}

View file

@ -0,0 +1,80 @@
<?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:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:resources="clr-namespace:ShareeBike.MultilingualResources;assembly=SharedBusinessLogic"
xmlns:sharedGui="clr-namespace:SharedGui.View"
xmlns:conv="clr-namespace:ShareeBike.View;assembly=SharedBusinessLogic"
mc:Ignorable="d"
x:Class="ShareeBike.View.Account.AccountPage"
BackgroundColor="{DynamicResource background-color}">
<Shell.TitleView>
<Grid ColumnDefinitions="Auto, 1*">
<Label Style="{StaticResource Label-Navbar}"
Text="{x:Static resources:AppResources.MarkingAccount}"/>
</Grid>
</Shell.TitleView>
<ContentPage.Resources>
<conv:BoolInverterConverter x:Key="BoolInverterConverter"/>
</ContentPage.Resources>
<ContentPage.Content>
<!--Grid for content and Running process in same row-->
<Grid>
<ScrollView
Grid.Row="0">
<StackLayout>
<Frame
Padding="10"
Margin="0,10,0,5"
HorizontalOptions="FillAndExpand"
BackgroundColor="White">
<StackLayout
Padding="10">
<Label
Text="{Binding LoggedInInfo}" />
<Label
IsVisible="{Binding IsBookingStateInfoVisible}"
Text="{Binding BookingStateInfo}" />
<Button
Text="{x:Static resources:AppResources.MarkingAccountPageManagePersonalData}"
Command="{Binding OnManageAccount}"
IsEnabled="{Binding IsLogoutPossible}">
</Button>
<Button
Style="{StaticResource SecondaryButton}"
Text="{x:Static resources:AppResources.MarkingAccountPageManageLogout}"
Command="{Binding OnLogoutRequest}"
IsEnabled="{Binding IsLogoutPossible}">
</Button>
</StackLayout>
</Frame>
</StackLayout>
</ScrollView>
<!--While process is running-->
<sharedGui:RunningProcessView
IsVisible="{Binding IsIdle, Converter={StaticResource BoolInverterConverter}}"
Grid.Row="0"/>
</Grid>
</ContentPage.Content>
</ContentPage>

View file

@ -0,0 +1,126 @@
using ShareeBike.ViewModel;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using System.Threading.Tasks;
using System;
using ShareeBike.Model.Device;
using ShareeBike.ViewModel.Account;
using ShareeBike.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS;
namespace ShareeBike.View.Account
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class AccountPage : ContentPage, IViewService
{
/// <summary> Refernce to view model. </summary>
AccountPageViewModel m_oViewModel = null;
/// <summary> Constructs a account page. </summary>
public AccountPage()
{
InitializeComponent();
var l_oModel = App.ModelRoot;
m_oViewModel = new AccountPageViewModel(
l_oModel,
(url) => DependencyService.Get<IExternalBrowserService>().OpenUrl(url),
this);
BindingContext = m_oViewModel;
}
/// <summary> Displays alert message. </summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="cancel">Type of buttons.</param>
public new async Task DisplayAlert(string title, string message, string cancel)
=> await App.Current.MainPage.DisplayAlert(title, message, cancel);
/// <summary> Displays alert message.</summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="details">Detailed error description.</param>
/// <param name="cancel">Type of buttons.</param>
public async Task DisplayAdvancedAlert(
string title,
string message,
string details,
string cancel)
=> await App.Current.MainPage.DisplayAlert(title, $"{message}\r\nDetails:\r\n{details}", cancel);
/// <summary> Displays alert message.</summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="accept">Text of accept button.</param>
/// <param name="cancel">Text of button.</param>
/// <returns>True if user pressed accept.</returns>
public new async Task<bool> DisplayAlert(string title, string message, string accept, string cancel)
=> await App.Current.MainPage.DisplayAlert(title, message, accept, cancel);
/// <summary> Displays detailed alert message.</summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="details">Detailed error description.</param>
/// <param name="accept">Text of accept button.</param>
/// <param name="cancel">Text of cancel button.</param>
/// <returns>True if user pressed accept.</returns>
public async Task<bool> DisplayAdvancedAlert(string title, string message, string details, string accept, string cancel)
=> await App.Current.MainPage.DisplayAlert(title, !string.IsNullOrEmpty(details) ? $"{message}\r\nDetails:\r\n{details}" : $"{message}", accept, cancel);
/// <summary>
/// Displays an action sheet.
/// </summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="cancel">Text of button.</param>
/// <param name="destruction"></param>
/// <param name="p_oButtons">Buttons holding options to select.</param>
/// <returns>Text selected</returns>
public new async Task<string> DisplayActionSheet(String title, String cancel, String destruction, params String[] p_oButtons)
=> await base.DisplayActionSheet(title, cancel, destruction, p_oButtons);
/// <summary> Shows a page.</summary>
/// <param name="route">Route of the page to show.</param>
public async Task ShowPage(string route) => await Shell.Current.GoToAsync(route);
/// <summary> Pushes a page onto the modal stack. </summary>
/// <param name="p_oTypeOfPage">Page to display.</param>
public Task PushModalAsync(ViewTypes typeOfPage)
=> Navigation.PushModalAsync((Page)Activator.CreateInstance(typeOfPage.GetViewType()));
/// <summary> Pops a page from the modal stack. </summary>
public Task PopModalAsync()
=> throw new NotSupportedException();
/// <summary>
/// Invoked when page is shown.
/// Starts update process.
/// </summary>
protected async override void OnAppearing()
=> await m_oViewModel.OnAppearing();
/// <summary>
/// Invoked when pages is closed/ hidden.
/// Stops update process.
/// </summary>
protected async override void OnDisappearing()
{
if (m_oViewModel == null)
{
// View model might be null.
return;
}
await m_oViewModel.OnDisappearing();
}
/// <summary> Pushes a page onto the stack. </summary>
/// <param name="p_oTypeOfPage">Page to display.</param>
public async Task PushAsync(ViewTypes p_oTypeOfPage)
=> await Navigation.PushAsync((Page)Activator.CreateInstance(p_oTypeOfPage.GetViewType()));
#if USCSHARP9
public Task<IViewService.IUserFeedback> DisplayUserFeedbackPopup() => throw new NotSupportedException();
#else
public async Task<IUserFeedback> DisplayUserFeedbackPopup(IBatteryMutable battery = null) => throw new NotSupportedException();
#endif
}
}

View file

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<ViewCell xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:conv="clr-namespace:ShareeBike.View;assembly=SharedBusinessLogic"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:resources="clr-namespace:ShareeBike.MultilingualResources;assembly=SharedBusinessLogic"
mc:Ignorable="d"
x:Class="ShareeBike.View.Bike.BCBike">
<ContentView>
<ContentView.Resources>
<conv:StringNotNullOrEmptyToVisibleConverter x:Key="Label_Converter"/>
</ContentView.Resources>
<StackLayout
Padding="10">
<Label
FontAttributes="Bold"
Text="{Binding Name}"/>
<Label
Text="{Binding StateText}"
TextColor="{Binding StateColor}"/>
<Label
Text="{Binding ErrorText}"
IsVisible="{Binding ErrorText, Converter={StaticResource Label_Converter}}"
TextColor="Red"/>
<Button
Text="{Binding ButtonText}"
IsVisible="{Binding IsButtonVisible}"
IsEnabled="{Binding IsIdle}"
Command="{Binding OnButtonClicked}"/>
<Grid
IsVisible="{Binding TariffDescription.Header, Converter={StaticResource Label_Converter}}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label
Text=
"{Binding TariffDescription.Header}"
Grid.ColumnSpan="3"
FontAttributes="Bold"/>
<Label
Text="{x:Static resources:AppResources.MessageBikesManagementTariffDescriptionFreeTimePerSession}"
IsVisible="{Binding TariffDescription.FreeTimePerSession, Converter={StaticResource Label_Converter}}"
Grid.Row="1"/>
<Label
Text="{Binding TariffDescription.FreeTimePerSession}"
IsVisible="{Binding TariffDescription.FreeTimePerSession, Converter={StaticResource Label_Converter}}"
Grid.Row="1"
Grid.Column="1"/>
<Label
Text="{x:Static resources:AppResources.MessageBikesManagementTariffDescriptionFeeEuroPerHour}"
IsVisible="{Binding TariffDescription.FeeEuroPerHour, Converter={StaticResource Label_Converter}}"
Grid.Row="2"/>
<Label
Text="{Binding TariffDescription.FeeEuroPerHour}"
IsVisible="{Binding TariffDescription.FeeEuroPerHour, Converter={StaticResource Label_Converter}}"
Grid.Row="2"
Grid.Column="1"/>
<Label
Text="{x:Static resources:AppResources.MessageBikesManagementTariffDescriptionMaxFeeEuroPerDay}"
IsVisible="{Binding TariffDescription.MaxFeeEuroPerDay, Converter={StaticResource Label_Converter}}"
Grid.Row="3"/>
<Label
Text="{Binding TariffDescription.MaxFeeEuroPerDay}"
IsVisible="{Binding TariffDescription.MaxFeeEuroPerDay, Converter={StaticResource Label_Converter}}"
Grid.Row="3"
Grid.Column="1"/>
<Label
Text="{x:Static resources:AppResources.MessageBikesManagementTariffDescriptionAboEuroPerMonth}"
IsVisible="{Binding TariffDescription.AboEuroPerMonth, Converter={StaticResource Label_Converter}}"
Grid.Row="4"/>
<Label
Text="{Binding TariffDescription.AboEuroPerMonth}"
IsVisible="{Binding TariffDescription.AboEuroPerMonth, Converter={StaticResource Label_Converter}}"
Grid.Row="4"
Grid.Column="1"/>
<Label
TextType="Html"
Text="{Binding TariffDescription.OperatorAgb}"
IsVisible="{Binding TariffDescription.OperatorAgb, Converter={StaticResource Label_Converter}}"
Grid.Row="5"
Grid.ColumnSpan="3"/>
</Grid>
</StackLayout>
</ContentView>
</ViewCell>

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;
using Xamarin.Forms.Xaml;
namespace ShareeBike.View.Bike
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class BCBike : ViewCell
{
public BCBike()
{
InitializeComponent();
}
}
}

View file

@ -0,0 +1,25 @@
using Xamarin.Forms;
namespace ShareeBike.View.Bike
{
/// <summary>
/// Selects different templates for different bike types (BordComputer bikes, iLockIt bikes).
/// </summary>
public class BikeViewCellTemplateSelector : DataTemplateSelector
{
DataTemplate bCBike;
DataTemplate iLockIBike;
public BikeViewCellTemplateSelector()
{
bCBike = new DataTemplate(typeof(BCBike));
iLockIBike = new DataTemplate(typeof(ILockItBike));
}
protected override DataTemplate OnSelectTemplate(object item, BindableObject container)
=> item is ShareeBike.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel ||
item is ShareeBike.ViewModel.Bikes.Bike.CopriLock.BikeViewModel
? iLockIBike
: bCBike;
}
}

View file

@ -0,0 +1,368 @@
<?xml version="1.0" encoding="UTF-8"?>
<ViewCell xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:conv="clr-namespace:ShareeBike.View;assembly=SharedBusinessLogic"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:resources="clr-namespace:ShareeBike.MultilingualResources;assembly=SharedBusinessLogic"
xmlns:sharedGui="clr-namespace:SharedGui.View"
mc:Ignorable="d"
x:Class="ShareeBike.View.Bike.ILockItBike">
<ContentView>
<ContentView.Resources>
<conv:StringNotNullOrEmptyToVisibleConverter x:Key="Label_Converter"/>
</ContentView.Resources>
<Frame
Padding="10"
Margin="0,10,0,0"
HasShadow="False"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
BackgroundColor="White">
<StackLayout
Orientation="Vertical"
Padding="10">
<!-- Icons, Name, ID, ... -->
<Grid
Padding="0"
RowSpacing="15"
ColumnSpacing="5"
ColumnDefinitions="Auto,*,Auto"
RowDefinitions="Auto,Auto,Auto">
<!-- Bike image -->
<Image
Grid.Column="0"
Grid.Row="0"
Grid.RowSpan="2"
VerticalOptions="End"
HorizontalOptions="Start"
Source="{Binding DisplayedBikeImageSourceString}"
HeightRequest="60"
Aspect="AspectFit"/>
<!-- Battery level image -->
<sharedGui:BarLevelView
Grid.Column="1"
Grid.Row="0"
Grid.RowSpan="2"
VerticalOptions="End"
HorizontalOptions="Start"
Current="{Binding CurrentChargeBars}"
Maximum="{Binding MaxChargeBars}"
IsVisible="{Binding IsBatteryChargeVisible}"/>
<!-- Rental state and error -->
<StackLayout
Grid.Column="0"
Grid.ColumnSpan="2"
Grid.Row="2"
Spacing="0"
Orientation="Vertical"
HorizontalOptions="Start"
VerticalOptions="End">
<!-- Rental state -->
<Label
Text="{Binding StateText}"
FontSize="Small"
LineBreakMode="WordWrap"
TextColor="{Binding StateColor}"/>
<!-- Rental state error info -->
<Label
Text="{Binding ErrorText}"
FontSize="Small"
LineBreakMode="WordWrap"
IsVisible="{Binding ErrorText, Converter={StaticResource Label_Converter}}"
TextColor="Red"/>
</StackLayout>
<!-- Name and Id of the bike -->
<StackLayout
Grid.Column="1"
Grid.ColumnSpan="2"
Grid.Row="0"
Orientation="Vertical"
VerticalOptions="Start"
HorizontalOptions="End"
Spacing="0">
<!-- Name -->
<Label
FontAttributes="Bold"
FontSize="Large"
TextColor="Black"
HorizontalTextAlignment="Right"
Text="{Binding Name}"/>
<!-- Id -->
<Label
TextColor="DimGray"
FontAttributes="Bold"
HorizontalTextAlignment="Right"
IsVisible="{Binding DisplayId, Converter={StaticResource Label_Converter}}"
Text="{Binding DisplayId}"/>
</StackLayout>
<!-- AaAbRideType -->
<StackLayout
Grid.Column="2"
Grid.Row="1"
Grid.RowSpan="2"
Spacing="0"
HorizontalOptions="End"
VerticalOptions="End"
IsVisible="{Binding AaRideType}">
<StackLayout
Orientation="Horizontal"
HorizontalOptions="End">
<Image>
<Image.Source>
<FontImageSource
Glyph="{StaticResource LocationPin}"
Color="Black"
FontFamily="FA-S"
Size="20"/>
</Image.Source>
</Image>
<Image>
<Image.Source>
<FontImageSource
Glyph="{StaticResource ArrowReturnBack}"
Color="Black"
FontFamily="FA-S"
Size="20"/>
</Image.Source>
</Image>
<Button
Command="{Binding ShowRideTypeInfoCommand}"
WidthRequest="24"
HeightRequest="24"
BackgroundColor="Transparent"
BorderWidth="0"
Padding="0"
Margin="5,0,0,0">
<Button.ImageSource>
<FontImageSource
Glyph="{StaticResource InfoCircle}"
Color="DimGray"
FontFamily="FA-S"
Size="20"/>
</Button.ImageSource>
</Button>
</StackLayout>
<Label
Text= "{Binding StationId}"
FontSize="Small"
HorizontalOptions="End"/>
</StackLayout>
</Grid>
<!-- Buttons -->
<Button
Text="{Binding ButtonText}"
IsVisible="{Binding IsButtonVisible}"
Command="{Binding OnButtonClicked}"/>
<Button
Style="{StaticResource SecondaryButton}"
Text="{Binding LockitButtonText}"
IsVisible="{Binding IsLockitButtonVisible}"
Command="{Binding OnLockitButtonClicked}"/>
<!-- Rental description (tariff name, options and rental info -->
<Grid
RowSpacing="0"
IsVisible="{Binding TariffDescription.Header, Converter={StaticResource Label_Converter}}">
<Grid.RowDefinitions>
<!-- start tariff entries -->
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<!-- start rental info -->
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- start tariff entries (should be a CollectionView) -->
<Label
Text= "{x:Static resources:AppResources.MessageBikesManagementTariffDescriptionTariffHeader}"
IsVisible="{Binding TariffDescription.Header, Converter={StaticResource Label_Converter}}"
Grid.Row="0"
FontAttributes="Bold"/>
<Label
Text="{Binding TariffDescription.Header}"
IsVisible="{Binding TariffDescription.Header, Converter={StaticResource Label_Converter}}"
Grid.Row="0"
Grid.Column="1"
FontAttributes="Bold"/>
<!--Tracking-->
<Grid
Grid.Row="0"
Grid.Column="1"
Grid.ColumnSpan="2"
ColumnDefinitions="*,Auto"
IsVisible="{Binding TariffDescription.TrackingInfoText, Converter={StaticResource Label_Converter}}">
<Label
Text= "Tracking"
Grid.Column="0"
HorizontalOptions="End"/>
<Button
Command="{Binding ShowTrackingInfoCommand}"
WidthRequest="24"
HeightRequest="24"
BackgroundColor="Transparent"
BorderWidth="0"
Grid.Column="1"
Padding="0"
Margin="0">
<Button.ImageSource>
<FontImageSource
Glyph="{StaticResource InfoCircle}"
Color="DimGray"
FontFamily="FA-S"
Size="20"/>
</Button.ImageSource>
</Button>
</Grid>
<Label
Text= "{Binding TariffDescription.TarifEntry1.Description}"
IsVisible="{Binding TariffDescription.TarifEntry1.Description, Converter={StaticResource Label_Converter}}"
Grid.Row="1"/>
<Label
Text="{Binding TariffDescription.TarifEntry1.Value}"
IsVisible="{Binding TariffDescription.TarifEntry1.Value, Converter={StaticResource Label_Converter}}"
Grid.Row="1"
Grid.Column="1"
Grid.ColumnSpan="2"/>
<Label
Text= "{Binding TariffDescription.TarifEntry2.Description}"
IsVisible="{Binding TariffDescription.TarifEntry2.Description, Converter={StaticResource Label_Converter}}"
Grid.Row="2"/>
<Label
Text="{Binding TariffDescription.TarifEntry2.Value}"
IsVisible="{Binding TariffDescription.TarifEntry2.Value, Converter={StaticResource Label_Converter}}"
Grid.Row="2"
Grid.Column="1"
Grid.ColumnSpan="2"/>
<Label
Text= "{Binding TariffDescription.TarifEntry3.Description}"
IsVisible="{Binding TariffDescription.TarifEntry3.Description, Converter={StaticResource Label_Converter}}"
Grid.Row="3"/>
<Label
Text="{Binding TariffDescription.TarifEntry3.Value}"
IsVisible="{Binding TariffDescription.TarifEntry3.Value, Converter={StaticResource Label_Converter}}"
Grid.Row="3"
Grid.Column="1"
Grid.ColumnSpan="2"/>
<Label
Text= "{Binding TariffDescription.TarifEntry4.Description}"
IsVisible="{Binding TariffDescription.TarifEntry4.Description, Converter={StaticResource Label_Converter}}"
Grid.Row="4"/>
<Label
Text="{Binding TariffDescription.TarifEntry4.Value}"
IsVisible="{Binding TariffDescription.TarifEntry4.Value, Converter={StaticResource Label_Converter}}"
Grid.Row="4"
Grid.Column="1"
Grid.ColumnSpan="2"/>
<Label
Text= "{Binding TariffDescription.TarifEntry5.Description}"
IsVisible="{Binding TariffDescription.TarifEntry5.Description, Converter={StaticResource Label_Converter}}"
Grid.Row="5"/>
<Label
Text="{Binding TariffDescription.TarifEntry5.Value}"
IsVisible="{Binding TariffDescription.TarifEntry5.Value, Converter={StaticResource Label_Converter}}"
Grid.Row="5"
Grid.Column="1"
Grid.ColumnSpan="2"/>
<Label
Text= "{Binding TariffDescription.TarifEntry6.Description}"
IsVisible="{Binding TariffDescription.TarifEntry6.Description, Converter={StaticResource Label_Converter}}"
Grid.Row="6"/>
<Label
Text="{Binding TariffDescription.TarifEntry6.Value}"
IsVisible="{Binding TariffDescription.TarifEntry6.Value, Converter={StaticResource Label_Converter}}"
Grid.Row="6"
Grid.Column="1"
Grid.ColumnSpan="2"/>
<Label
Text= "{Binding TariffDescription.TarifEntry7.Description}"
IsVisible="{Binding TariffDescription.TarifEntry7.Description, Converter={StaticResource Label_Converter}}"
Grid.Row="7"/>
<Label
Text="{Binding TariffDescription.TarifEntry7.Value}"
IsVisible="{Binding TariffDescription.TarifEntry7.Value, Converter={StaticResource Label_Converter}}"
Grid.Row="7"
Grid.Column="1"
Grid.ColumnSpan="2"/>
<Label
Text= "{Binding TariffDescription.TarifEntry8.Description}"
IsVisible="{Binding TariffDescription.TarifEntry8.Description, Converter={StaticResource Label_Converter}}"
Grid.Row="8"/>
<Label
Text="{Binding TariffDescription.TarifEntry8.Value}"
IsVisible="{Binding TariffDescription.TarifEntry8.Value, Converter={StaticResource Label_Converter}}"
Grid.Row="8"
Grid.Column="1"
Grid.ColumnSpan="2"/>
<Label
Text= "{Binding TariffDescription.TarifEntry9.Description}"
IsVisible="{Binding TariffDescription.TarifEntry9.Description, Converter={StaticResource Label_Converter}}"
Grid.Row="9"/>
<Label
Text="{Binding TariffDescription.TarifEntry9.Value}"
IsVisible="{Binding TariffDescription.TarifEntry9.Value, Converter={StaticResource Label_Converter}}"
Grid.Row="9"
Grid.Column="1"
Grid.ColumnSpan="2"/>
<!-- start tariff entries (should be a CollectionView) -->
<Label
Text= "{Binding TariffDescription.InfoEntry1}"
IsVisible="{Binding TariffDescription.InfoEntry1, Converter={StaticResource Label_Converter}}"
Grid.Row="10"
Grid.ColumnSpan="3"/>
<Label
Text= "{Binding TariffDescription.InfoEntry2}"
IsVisible="{Binding TariffDescription.InfoEntry2, Converter={StaticResource Label_Converter}}"
Grid.Row="11"
Grid.ColumnSpan="3"/>
<Label
Text= "{Binding TariffDescription.InfoEntry3}"
IsVisible="{Binding TariffDescription.InfoEntry3, Converter={StaticResource Label_Converter}}"
Grid.Row="12"
Grid.ColumnSpan="3"/>
<Label
Text= "{Binding TariffDescription.InfoEntry4}"
IsVisible="{Binding TariffDescription.InfoEntry4, Converter={StaticResource Label_Converter}}"
Grid.Row="13"
Grid.ColumnSpan="3"/>
</Grid>
</StackLayout>
</Frame>
</ContentView>
</ViewCell>

View file

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ShareeBike.Model.Bikes.BikeInfoNS.BluetoothLock;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace ShareeBike.View.Bike
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ILockItBike : ViewCell
{
public ILockItBike()
{
InitializeComponent();
}
protected override void OnBindingContextChanged()
{
base.OnBindingContextChanged();
if (Device.RuntimePlatform != Device.iOS)
// Update of size is only required for iOS.
return;
var viewModel = BindingContext as ShareeBike.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
if (viewModel == null)
return;
viewModel.PropertyChanged += (sender, e) =>
{
if (e.PropertyName == nameof(ShareeBike.ViewModel.Bikes.Bike.BC.RequestHandler.Base<IBikeInfoMutable>.IsButtonVisible)
|| e.PropertyName == nameof(ShareeBike.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler.Base.IsLockitButtonVisible))
{
// Force update of view cell on iOS.
// https://hausource.visualstudio.com/ShareeBike/_workitems/edit/132
ForceUpdateSize();
}
};
}
}
}

View file

@ -0,0 +1,225 @@
<?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:xct="http://xamarin.com/schemas/2020/toolkit"
xmlns:rental_process="clr-namespace:ShareeBike.ViewModel.Bikes;assembly=SharedBusinessLogic"
x:Class="ShareeBike.View.BikesAtStation.BikesAtStationPage"
xmlns:local_bike="clr-namespace:ShareeBike.View.Bike"
xmlns:sharedGui="clr-namespace:SharedGui.View"
xmlns:bikeRentalProcess="clr-namespace:SharedGui.View.Bike.RentalProcess"
BackgroundColor="{DynamicResource background-color}"
Shell.NavBarIsVisible="{Binding IsIdle}">
<Shell.TitleView>
<Grid ColumnDefinitions="Auto, 1*">
<Label Style="{StaticResource Label-Navbar}"
Text="{Binding Title}"/>
</Grid>
</Shell.TitleView>
<ContentPage.Resources>
<ResourceDictionary>
<local_bike:BikeViewCellTemplateSelector x:Key="bikeTemplateSelector"/>
<xct:MultiConverter x:Key="RentalProcessToVisibleConverter">
<xct:EnumToBoolConverter>
<xct:EnumToBoolConverter.TrueValues>
<rental_process:CurrentRentalProcess>CloseLock</rental_process:CurrentRentalProcess>
<rental_process:CurrentRentalProcess>EndRental</rental_process:CurrentRentalProcess>
</xct:EnumToBoolConverter.TrueValues>
</xct:EnumToBoolConverter>
<xct:InvertedBoolConverter />
</xct:MultiConverter>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<!--Grid for Bike(s) view and Running process in same row-->
<Grid>
<!--BikesAtStationPage Content-->
<Grid
IsVisible="{Binding RentalProcess.State, Converter={StaticResource RentalProcessToVisibleConverter}}"
Grid.Row="0"
RowSpacing="0"
RowDefinitions="1*,Auto">
<StackLayout
Grid.Row="0"
Spacing="0"
Orientation="Vertical">
<!--Station-->
<StackLayout
BackgroundColor="{DynamicResource primary-back-title-color}"
IsVisible="{Binding IsIdle}"
Padding="20,0,20,0">
<!--Line-->
<BoxView
HeightRequest="1"
WidthRequest="400"
HorizontalOptions="Center"
Color="White"/>
<Grid
ColumnDefinitions="Auto,1*"
RowDefinitions="Auto"
Padding="0,0,0,5">
<!--Station id-->
<Label
Grid.Column="0"
Grid.Row="0"
FontSize="Small"
HorizontalOptions="Start"
TextColor="White"
Text="{Binding StationDetailText}"/>
<!--Contact to operator-->
<Label
Grid.Column="1"
Grid.Row="0"
TextType="Html"
FontSize="Small"
HorizontalOptions="End"
TextColor="White"
Text="{Binding ContactSupportHintText}">
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding ContactSupportClickedCommand}"/>
</Label.GestureRecognizers>
</Label>
</Grid>
</StackLayout>
<!--If Not Connected To Internet-->
<sharedGui:NotConnectedToNetView/>
<!--Bike data-->
<Grid
RowDefinitions="Auto,1*"
RowSpacing="0">
<!--Hint for Outdated Data.-->
<sharedGui:HintForRefreshingPageView
Grid.Row="0"/>
<!--Bike(s)-->
<ListView
Grid.Row="1"
x:Name="BikesAtStationListView"
BackgroundColor="{DynamicResource background-color}"
SelectionMode="None"
SelectedItem="{Binding SelectedBike}"
IsEnabled="{Binding IsIdle}"
HasUnevenRows="True"
SeparatorVisibility="None"
ItemTemplate="{StaticResource bikeTemplateSelector}"
IsPullToRefreshEnabled="True"
RefreshCommand="{Binding RefreshCommand}"
IsRefreshing="{Binding IsRefreshing}"/>
<!--No Bikes-->
<Label
Grid.Row="1"
Margin="20"
IsVisible="{Binding IsNoBikesAtStationVisible}"
Text="{Binding NoBikesAtStationText}"/>
</Grid>
</StackLayout>
<!--Info at End of Page-->
<StackLayout
Grid.Row="1"
Orientation="Vertical"
Spacing="0"
Padding="20,0,20,0">
<!--Info text-->
<Label
Text="{Binding StatusInfoText}"
IsVisible="{Binding Path=IsProcessWithRunningProcessView, Converter={StaticResource InvertedBoolConverter}}"
FontSize="Small"
TextColor="DimGray"
Padding="5"
HorizontalOptions="CenterAndExpand">
<Label.Triggers>
<DataTrigger
TargetType="Label"
Binding="{Binding Path=StatusInfoText.Length}" Value="0">
<Setter Property="HeightRequest" Value="0" />
</DataTrigger>
<DataTrigger
TargetType="Label"
Binding="{Binding Path=StatusInfoText}" Value="Offline.">
<Setter Property="HeightRequest" Value="0" />
</DataTrigger>
</Label.Triggers>
</Label>
<!--Login-->
<StackLayout Spacing="0">
<StackLayout.Triggers>
<DataTrigger TargetType="StackLayout"
Binding="{Binding IsLoginRequiredHintVisible}"
Value="false">
<Setter Property="HeightRequest" Value="0" />
</DataTrigger>
</StackLayout.Triggers>
<!--Line-->
<BoxView
HeightRequest="1"
WidthRequest="400"
HorizontalOptions="Center"
IsVisible="{Binding IsLoginRequiredHintVisible}"
Color="DimGray" />
<!--Login required-->
<Label
IsVisible="{Binding IsLoginRequiredHintVisible}"
TextType="Html"
TextColor="DimGray"
Text="{Binding LoginRequiredHintText}">
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding LoginRequiredHintClickedCommand}"/>
</Label.GestureRecognizers>
</Label>
</StackLayout>
</StackLayout>
</Grid>
<!--While process is running-->
<sharedGui:RunningProcessView
IsVisible="{Binding IsProcessWithRunningProcessView}"
Grid.Row="0"/>
<!--RequestBike View-->
<bikeRentalProcess:RentalProcessStartReservationOrRental
Grid.Row="0"/>
<!--OpenLock View-->
<bikeRentalProcess:RentalProcessBookedClosedOpenLock
Grid.Row="0"/>
<!--CloseLock View-->
<bikeRentalProcess:RentalProcessBookedOpenCloseLock
Grid.Row="0"/>
<!--EndRental View-->
<bikeRentalProcess:RentalProcessBookedClosedEndRental
Grid.Row="0"/>
</Grid>
</ContentPage.Content>
</ContentPage>

View file

@ -0,0 +1,191 @@
using ShareeBike.Model.Bikes.BikeInfoNS.BluetoothLock;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace ShareeBike.View.BikesAtStation
{
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using ShareeBike.Model.Device;
using ShareeBike.ViewModel;
using ShareeBike.Model;
using ShareeBike.Services.BluetoothLock.Tdo;
using System.Collections.Generic;
using Serilog;
using ShareeBike.Services.BluetoothLock;
using Plugin.BLE;
using ShareeBike.ViewModel.BikesAtStation;
using ShareeBike.ViewModel.Bikes;
using Xamarin.CommunityToolkit.Extensions;
using ShareeBike.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS;
using ShareeBike.MultilingualResources;
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class BikesAtStationPage : ContentPage, IViewService
{
private BikesAtStationPageViewModel m_oViewModel;
/// <summary> Initialization status to ensure initialization logic is not called multiple times. </summary>
private bool isInitializationStarted = false;
public BikesAtStationPage()
{
}
/// <summary>
/// Invoked when page is shown.
/// Starts update process.
/// </summary>
protected async override void OnAppearing()
{
// Don't repeat the initialization if it has been completed already.
if (isInitializationStarted) return;
isInitializationStarted = true;
if (m_oViewModel != null)
{
// No need to create view model, set binding context an items source if already done.
// If done twice tap events are fired multiple times (when hiding page using home button).
await m_oViewModel.OnAppearingOrRefresh();
isInitializationStarted = false;
return;
}
try
{
var model = App.ModelRoot;
m_oViewModel = new BikesAtStationPageViewModel(
model.ActiveUser,
App.PermissionsService,
App.BluetoothService,
Device.RuntimePlatform,
model.SelectedStation,
() => model.GetIsConnected(),
(isConnected) => model.GetConnector(isConnected),
App.LocationServicesContainer.Active,
model.LocksServices.Active,
model.Polling,
(url) => DependencyService.Get<IExternalBrowserService>().OpenUrl(url),
model.PostAction,
model.SmartDevice,
this)
{
IsReportLevelVerbose = model.IsReportLevelVerbose
};
}
catch (Exception exception)
{
Log.ForContext<BikesAtStationPage>().Error("Displaying bikes at station page failed. {Exception}", exception);
await DisplayAlert(
AppResources.ErrorPageNotLoadedTitle,
$"{AppResources.ErrorPageNotLoaded}\r\n{exception.Message}",
AppResources.MessageAnswerOk);
isInitializationStarted = false;
return;
}
InitializeComponent();
BindingContext = m_oViewModel;
BikesAtStationListView.ItemsSource = m_oViewModel;
await m_oViewModel.OnAppearingOrRefresh();
isInitializationStarted = false;
}
/// <summary>
/// Invoked when pages is closed/ hidden.
/// Stops update process.
/// </summary>
protected async override void OnDisappearing()
{
if (m_oViewModel != null)
{
// View model might be null.
await m_oViewModel?.OnDisappearing();
}
}
/// <summary>
/// Handeles pressing of the Android hardware back button.
/// </summary>
/// <returns></returns>
protected override bool OnBackButtonPressed() => !m_oViewModel.IsIdle;
/// <summary> Displays alert message.</summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="cancel">Type of buttons.</param>
public new async Task DisplayAlert(string title, string message, string cancel)
=> await App.Current.MainPage.DisplayAlert(title, message, cancel);
/// <summary> Displays alert message.</summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="details">Detailed error description.</param>
/// <param name="cancel">Type of buttons.</param>
public async Task DisplayAdvancedAlert(
string title,
string message,
string details,
string cancel)
=> await App.Current.MainPage.DisplayAlert(title, $"{message}\r\nDetails:\r\n{details}", cancel);
/// <summary>
/// Displays alert message.
/// </summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="accept">Text of accept button.</param>
/// <param name="cancel">Text of button.</param>
/// <returns>True if user pressed accept.</returns>
public new async Task<bool> DisplayAlert(string title, string message, string accept, string cancel)
=> await App.Current.MainPage.DisplayAlert(title, message, accept, cancel);
/// <summary> Displays detailed alert message.</summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="details">Detailed error description.</param>
/// <param name="accept">Text of accept button.</param>
/// <param name="cancel">Text of cancel button.</param>
/// <returns>True if user pressed accept.</returns>
public async Task<bool> DisplayAdvancedAlert(string title, string message, string details, string accept, string cancel)
=> await App.Current.MainPage.DisplayAlert(title, !string.IsNullOrEmpty(details) ? $"{message}\r\nDetails:\r\n{details}" : $"{message}", accept, cancel);
/// <summary> Shows a page.</summary>
/// <param name="route">Route of the page to show.</param>
public async Task ShowPage(string route) => await Shell.Current.GoToAsync(route);
/// <summary> Pushes a page onto the modal stack. </summary>
/// <param name="typeOfPage">Page to display.</param>
public async Task PushModalAsync(ViewTypes typeOfPage)
=> await Navigation.PushModalAsync((Page)Activator.CreateInstance(typeOfPage.GetViewType()));
/// <summary> Pops a page from the modal stack. </summary>
public Task PopModalAsync()
{
throw new NotSupportedException();
}
public Task PushAsync(ViewTypes p_oTypeOfPage)
{
throw new NotImplementedException();
}
#if USCSHARP9
public async Task<IViewService.IUserFeedback> DisplayUserFeedbackPopup() => await Navigation.ShowPopupAsync<FeedbackPopup.Result>(new FeedbackPopup());
#else
/// <summary> Displays user feedback popup.</summary>
/// <returns>User feedback.</returns>
public async Task<IUserFeedback> DisplayUserFeedbackPopup(IBatteryMutable battery = null) => await Navigation.ShowPopupAsync<FeedbackPopup.Result>(new FeedbackPopup(battery));
#endif
}
}

View file

@ -0,0 +1,243 @@
<?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:resources="clr-namespace:ShareeBike.MultilingualResources;assembly=SharedBusinessLogic"
x:Class="ShareeBike.View.Contact.ContactPage"
xmlns:conv="clr-namespace:ShareeBike.View;assembly=SharedBusinessLogic"
BackgroundColor="{DynamicResource background-color}">
<Shell.TitleView>
<Grid ColumnDefinitions="Auto, 1*">
<Label Style="{StaticResource Label-Navbar}"
Text="{x:Static resources:AppResources.MarkingContact}"/>
</Grid>
</Shell.TitleView>
<ContentPage.Resources>
<conv:StringNotNullOrEmptyToVisibleConverter x:Key="StringNotNullOrEmpty_Converter"/>
<conv:BoolInverterConverter x:Key="BoolInvert_Converter"/>
</ContentPage.Resources>
<ContentPage.Content>
<!--View-->
<Grid
x:Name="ContactPageView"
RowSpacing="0"
RowDefinitions="Auto, Auto,1*,Auto">
<!--FAQ-->
<StackLayout Grid.Row="0"
BackgroundColor="{x:DynamicResource attention-color}"
Padding="5,2,5,2"
Spacing="0"
Margin="0">
<StackLayout.GestureRecognizers>
<TapGestureRecognizer Command="{Binding OnFAQClickedRequest}"/>
</StackLayout.GestureRecognizers>
<Label
TextColor="White"
Padding="5"
HorizontalTextAlignment="Center"
HorizontalOptions="CenterAndExpand"
TextType="Html"
Text="{x:Static resources:AppResources.MarkingContactFAQ}">
</Label>
</StackLayout>
<!-- Station -->
<Frame Grid.Row="1"
Padding="10,0,10,0"
HorizontalOptions="FillAndExpand"
VerticalOptions="Start"
BackgroundColor="White"
HasShadow="False">
<StackLayout
Spacing="0">
<StackLayout
Padding="10"
Spacing="5">
<!--No station selected-->
<StackLayout IsVisible="{Binding Path=IsOperatorInfoAvaliable, Converter={StaticResource BoolInvert_Converter}}">
<Label
TextType="Html"
Text="{x:Static resources:AppResources.MarkingContactNoStationInfoAvailableNoButton}"/>
<Button
Text="{x:Static resources:AppResources.ActionSelectStation}"
Command="{Binding OnSelectStationRequest}"/>
</StackLayout>
<!--contact customer support of selected station-->
<Grid IsVisible="{Binding IsOperatorInfoAvaliable}"
ColumnDefinitions="1*, Auto" RowDefinitions="Auto,Auto">
<!-- info about selected station -->
<StackLayout Grid.Row="0" Grid.Column="0"
Spacing="0">
<StackLayout
Orientation="Horizontal"
Spacing="0">
<Button
Style="{x:StaticResource NoOutlineButtonBackgroundColor}"
Command="{Binding ShowSelectStationInfoText}"
WidthRequest="24"
HeightRequest="24"
BackgroundColor="Transparent"
BorderWidth="0"
Padding="0"
Margin="5,0,5,0">
<Button.ImageSource>
<FontImageSource
Glyph="{StaticResource InfoCircle}"
Color="DimGray"
FontFamily="FA-S"
Size="20"/>
</Button.ImageSource>
</Button>
<Label
FontAttributes="Bold"
FontSize="Large"
Text="{x:Static resources:AppResources.MarkingLastSelectedStation}"/>
<Label
FontSize="Large"
Text=": "/>
<Label
FontSize="Large"
Text="{Binding SelectedStationId}"/>
</StackLayout>
<Label
FontSize="Medium"
Text="{Binding SelectedStationName}"/>
</StackLayout>
<Button Grid.Row="0" Grid.Column="1"
WidthRequest="100"
Text="{x:Static resources:AppResources.ActionSelectAnotherStation}"
Command="{Binding OnSelectStationRequest}"/>
</Grid>
</StackLayout>
<!--Line-->
<BoxView
HeightRequest="1"
WidthRequest="400"
HorizontalOptions="Center"
Color="{DynamicResource primary-back-title-color}"/>
</StackLayout>
</Frame>
<!-- Customer Support -->
<Frame Grid.Row="2"
Padding="10"
Margin="0,10,0,0"
HorizontalOptions="FillAndExpand"
VerticalOptions="Start"
BackgroundColor="White"
HasShadow="False"
IsVisible="{Binding IsOperatorInfoAvaliable}">
<StackLayout
Padding="10"
Spacing="5">
<!--Title Customer Support-->
<Label
Text="{x:Static resources:AppResources.MarkingContactCustomerSupportTitle}"
FontAttributes="Bold"
FontSize="Large"/>
<!--- Operator -->
<StackLayout
Orientation="Horizontal"
Spacing="0">
<Label
Text="{x:Static resources:AppResources.MarkingOperator}"/>
<Label
Text=": "/>
<Label
Text="{Binding ProviderNameText}"/>
</StackLayout>
<!--- Phone to operator -->
<Button
x:Name="PhoneNumberButton"
IsVisible="{Binding PhoneNumberText, Converter={StaticResource StringNotNullOrEmpty_Converter}}"
Text="{x:Static resources:AppResources.MarkingDoCall}"
Command="{Binding OnPhoneRequest}">
<Button.Triggers>
<DataTrigger TargetType="Button" Binding="{Binding IsDoPhoncallAvailable}" Value="False">
<Setter Property="BorderColor" Value="DimGray" />
<Setter Property="BackgroundColor" Value="DimGray" />
<Setter Property="TextColor" Value="LightGray" />
</DataTrigger>
</Button.Triggers>
</Button>
<!--- Mail to operator -->
<Button
Style="{StaticResource SecondaryButton}"
x:Name="MailAddressButton"
IsVisible="{Binding MailAddressText, Converter={StaticResource StringNotNullOrEmpty_Converter}}"
Text="{x:Static resources:AppResources.MarkingSendMail}"
Command="{Binding OnMailToOperatorRequest}">
<Button.Triggers>
<DataTrigger TargetType="Button" Binding="{Binding IsSendMailAvailable}" Value="False">
<Setter Property="BorderColor" Value="DimGray" />
<Setter Property="BackgroundColor" Value="LightGray" />
<Setter Property="TextColor" Value="DimGray" />
</DataTrigger>
</Button.Triggers>
</Button>
</StackLayout>
</Frame>
<!--- Contact app-developer -->
<StackLayout Grid.Row="3"
Padding="10"
Margin="0,0,0,10"
VerticalOptions="End"
Spacing="0">
<BoxView
Margin="0,0,0,10"
HeightRequest="1"
WidthRequest="400"
HorizontalOptions="Center"
Color="DimGray"/>
<Button
x:Name="DiagnosticsButton"
Style="{StaticResource NoOutlineButtonBackgroundColor}"
Text="{x:Static resources:AppResources.ActionSendDiagnosis}"
Command="{Binding OnMailAppRelatedRequest}">
<Button.Triggers>
<DataTrigger TargetType="Button" Binding="{Binding IsSendMailAvailable}" Value="False">
<Setter Property="TextColor" Value="DimGray" />
</DataTrigger>
</Button.Triggers>
</Button>
</StackLayout>
</Grid>
</ContentPage.Content>
</ContentPage>

View file

@ -0,0 +1,113 @@
using Serilog;
using System;
using System.Threading.Tasks;
using ShareeBike.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS;
using ShareeBike.Model.Device;
using ShareeBike.ViewModel.Contact;
using Xamarin.Essentials;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using ShareeBike.Model;
namespace ShareeBike.View.Contact
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ContactPage : ContentPage, IViewService
{
/// <summary> View model to notify view model if page appears. </summary>
private ContactPageViewModel ViewModel { get; set; }
public ContactPage()
{
InitializeComponent();
var model = App.ModelRoot;
ViewModel = new ContactPageViewModel(
App.ModelRoot.Flavor.GetDisplayName(),
model,
() => App.CreateAttachment(),
() => DependencyService.Get<IExternalBrowserService>().OpenUrl(DependencyService.Get<IAppInfo>().StoreUrl),
this,
() => model.GetIsConnected(),
(isConnected) => model.GetConnector(isConnected));
ContactPageView.BindingContext = ViewModel;
}
/// <summary> Invoked when page is shown. </summary>
protected async override void OnAppearing()
{
try
{
Log.ForContext<ContentPage>().Verbose("OnAppearing...");
await ViewModel.OnAppearing(App.ModelRoot.SelectedStation);
}
catch (Exception exception)
{
Log.ForContext<ContentPage>().Error("Invoking OnAppearing on view model failed. {Exception}", exception);
return;
}
}
/// <summary> Displays alert message.</summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="details">Detailed error description.</param>
/// <param name="cancel">Type of buttons.</param>
public async Task DisplayAdvancedAlert(
string title,
string message,
string details,
string cancel)
=> await App.Current.MainPage.DisplayAlert(title, $"{message}\r\nDetails:\r\n{details}", cancel);
/// <summary> Displays detailed alert message.</summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="details">Detailed error description.</param>
/// <param name="accept">Text of accept button.</param>
/// <param name="cancel">Text of cancel button.</param>
/// <returns>True if user pressed accept.</returns>
public async Task<bool> DisplayAdvancedAlert(string title, string message, string details, string accept, string cancel)
=> await App.Current.MainPage.DisplayAlert(title, !string.IsNullOrEmpty(details) ? $"{message}\r\nDetails:\r\n{details}" : $"{message}", accept, cancel);
/// <summary> Shows a page.</summary>
/// <param name="route">Route of the page to show.</param>
public async Task ShowPage(string route) => await Shell.Current.GoToAsync(route);
/// <summary> Pushes a page onto the modal stack. </summary>
/// <param name="p_oTypeOfPage">Page to display.</param>
public Task PushModalAsync(ViewTypes p_oTypeOfPage)
{
throw new NotSupportedException();
}
/// <summary> Pops a page from the modal stack. </summary>
public Task PopModalAsync()
{
throw new NotSupportedException();
}
/// <summary> Pushes a page onto the stack. </summary>
/// <param name="typeOfPage">Page to display.</param>
public async Task PushAsync(ViewTypes typeOfPage)
{
var page = Activator.CreateInstance(typeOfPage.GetViewType());
if (page == null)
{
return;
}
await Navigation.PushAsync((Page)page);
}
#if USCSHARP9
public Task<IViewService.IUserFeedback> DisplayUserFeedbackPopup() => throw new NotSupportedException();
#else
public async Task<IUserFeedback> DisplayUserFeedbackPopup(IBatteryMutable battery = null) => throw new NotSupportedException();
#endif
}
}

View file

@ -0,0 +1,150 @@
<?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:maps="clr-namespace:Xamarin.Forms.GoogleMaps;assembly=Xamarin.Forms.GoogleMaps"
xmlns:bindings="clr-namespace:Xamarin.Forms.GoogleMaps.Bindings;assembly=Xamarin.Forms.GoogleMaps.Bindings"
xmlns:resources="clr-namespace:ShareeBike.MultilingualResources;assembly=SharedBusinessLogic"
xmlns:sharedGui="clr-namespace:SharedGui.View"
x:Class="ShareeBike.View.Contact.SelectStationPage"
BackgroundColor="{DynamicResource Key=primary-back-title-color}">
<Shell.TitleView>
<Grid ColumnDefinitions="Auto, 1*">
<Label Style="{StaticResource Label-Navbar}"
Text="{x:Static resources:AppResources.MarkingSelectStationPage}"/>
</Grid>
</Shell.TitleView>
<ContentPage.Content>
<!--Grid for Map with Buttons and Running process-->
<Grid
RowDefinitions="3,46,1*,Auto"
ColumnDefinitions="1*,Auto,1*"
RowSpacing="0"
IsEnabled="{Binding IsMapPageEnabled}"
VerticalOptions="FillAndExpand">
<!--Map-->
<maps:Map
Grid.RowSpan="3"
Grid.ColumnSpan="3"
WidthRequest="320"
HeightRequest="800"
x:Name="MyMap"
MyLocationEnabled="True"
MapType="Street">
<maps:Map.Behaviors>
<bindings:BindingPinsBehavior Value="{Binding Pins}"/>
<bindings:PinClickedToCommandBehavior Command="{Binding PinClickedCommand}"/>
</maps:Map.Behaviors>
</maps:Map>
<!--Buttons for choosing bike type-->
<Frame
CornerRadius="13"
Grid.Row="1"
Grid.Column="1"
Margin="0"
Padding="0"
BackgroundColor="{DynamicResource secondary-back-title-color}">
<StackLayout
Orientation="Horizontal"
Margin="0"
Padding="0">
<Button
x:Name="CitybikeButton"
AutomationId ="FilterCitybike_button"
Text="{x:Static resources:AppResources.MarkingCityBike}"
Command="{Binding OnToggleCargoToCitybike}"
IsVisible="false"
BackgroundColor="{Binding CitybikeColor}"
BorderColor="{Binding CitybikeColor}"
BorderWidth="0"
VerticalOptions="Center"
HorizontalOptions="Center"
WidthRequest="94"
HeightRequest="40"
CornerRadius="10"
Margin="3,0,0,0"
FontSize="Small"
FontAttributes="Bold"
TextColor="{Binding NoCitybikeColor}">
</Button>
<Button
x:Name="CargoButton"
AutomationId ="FilterCargo_button"
Text="{x:Static resources:AppResources.MarkingCargoBike}"
Command="{Binding OnToggleCitybikeToCargo}"
IsVisible="false"
BackgroundColor="{Binding CargoColor}"
BorderColor="{Binding CargoColor}"
BorderWidth="0"
VerticalOptions="Center"
HorizontalOptions="Center"
WidthRequest="94"
HeightRequest="40"
CornerRadius="10"
Margin="0,0,3,0"
FontSize="Small"
FontAttributes="Bold"
TextColor="{Binding NoCargoColor}">
</Button>
</StackLayout>
</Frame>
<!--Center to currentLocation Button-->
<ImageButton
Grid.RowSpan="3"
Grid.ColumnSpan="3"
x:Name="CurrentLocation"
AutomationId ="currentLocaton_button"
Command="{Binding OnCurrentLocationButtonClicked}"
IsVisible="False"
BackgroundColor="Transparent"
BorderWidth="1"
BorderColor="LightGray"
VerticalOptions="End"
HorizontalOptions="Center"
Margin="0,0,0,12"
Source="Location_Button.png"
WidthRequest="40"
HeightRequest="40"
CornerRadius="20">
</ImageButton>
<!--Info text-->
<Label
Grid.Row="3"
Grid.ColumnSpan="3"
Text="{Binding StatusInfoText}"
IsVisible="{Binding Path=IsProcessWithRunningProcessView, Converter={StaticResource InvertedBoolConverter}}"
FontSize="Small"
Padding="5"
TextColor="DimGray"
HorizontalOptions="CenterAndExpand">
<Label.Triggers>
<DataTrigger
TargetType="Label"
Binding="{Binding Path=StatusInfoText.Length}" Value="0">
<Setter Property="HeightRequest" Value="0" />
</DataTrigger>
<DataTrigger
TargetType="Label"
Binding="{Binding Path=StatusInfoText}" Value="Offline.">
<Setter Property="HeightRequest" Value="0" />
</DataTrigger>
</Label.Triggers>
</Label>
<!--While process is running-->
<sharedGui:RunningProcessView
IsVisible="{Binding IsProcessWithRunningProcessView}"
Grid.RowSpan="4"
Grid.ColumnSpan="3"/>
</Grid>
</ContentPage.Content>
</ContentPage>

View file

@ -0,0 +1,173 @@
using System;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace ShareeBike.View.Contact
{
using Serilog;
using ShareeBike.Model;
using ShareeBike.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS;
using ShareeBike.ViewModel.Contact;
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class SelectStationPage : ContentPage, IViewService
{
/// <summary> View model to notify about whether page appears or hides. </summary>
private SelectStationPageViewModel SelectStationPageViewModel { get; set; }
public SelectStationPage()
{
InitializeComponent();
}
/// <summary>
/// Displays alert message.
/// </summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="cancel">Type of buttons.</param>
public new async Task DisplayAlert(string title, string message, string cancel)
=> await App.Current.MainPage.DisplayAlert(title, message, cancel);
/// <summary> Displays alert message.</summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="details">Detailed error description.</param>
/// <param name="cancel">Type of buttons.</param>
public async Task DisplayAdvancedAlert(
string title,
string message,
string details,
string cancel)
=> await App.Current.MainPage.DisplayAlert(title, $"{message}\r\nDetails:\r\n{details}", cancel);
/// <summary> Displays detailed alert message.</summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="details">Detailed error description.</param>
/// <param name="accept">Text of accept button.</param>
/// <param name="cancel">Text of cancel button.</param>
/// <returns>True if user pressed accept.</returns>
public async Task<bool> DisplayAdvancedAlert(string title, string message, string details, string accept, string cancel)
=> await App.Current.MainPage.DisplayAlert(title, !string.IsNullOrEmpty(details) ? $"{message}\r\nDetails:\r\n{details}" : $"{message}", accept, cancel);
/// <summary>
/// Displays alert message.
/// </summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="accept">Text of accept button.</param>
/// <param name="cancel">Text of button.</param>
/// <returns>True if user pressed accept.</returns>
public new async Task<bool> DisplayAlert(string title, string message, string accept, string cancel)
=> await App.Current.MainPage.DisplayAlert(title, message, accept, cancel);
/// <summary> Shows a page.</summary>
/// <param name="route">Route of the page to show.</param>
public async Task ShowPage(string route) => await Shell.Current.GoToAsync(route);
/// <summary> Pushes a page onto the modal stack. </summary>
/// <param name="typeOfPage">Type of page to display.</param>
public async Task PushModalAsync(ViewTypes typeOfPage)
=> await Navigation.PushModalAsync((Page)Activator.CreateInstance(typeOfPage.GetViewType()));
/// <summary> Pops a page from the modal stack. </summary>
public async Task PopModalAsync()
=> await Navigation.PopModalAsync();
/// <summary> Pushes a page onto the stack. </summary>
/// <param name="typeOfPage">Page to display.</param>
public async Task PushAsync(ViewTypes typeOfPage)
{
var page = Activator.CreateInstance(typeOfPage.GetViewType());
if (page == null)
{
return;
}
await Navigation.PushAsync((Page)page);
}
#if USCSHARP9
public Task<IViewService.IUserFeedback> DisplayUserFeedbackPopup() => throw new NotSupportedException();
#else
public async Task<IUserFeedback> DisplayUserFeedbackPopup(IBatteryMutable battery = null) => throw new NotSupportedException();
#endif
/// <summary>
/// Invoked when page is shown.
/// Starts update process.
/// </summary>
protected async override void OnAppearing()
{
// Pass reference to member Navigation to show bikes at station x dialog.
try
{
Log.ForContext<SelectStationPageViewModel>().Verbose("Constructing select station view model.");
SelectStationPageViewModel = new SelectStationPageViewModel(
App.ModelRoot,
App.PermissionsService,
App.BluetoothService,
App.LocationServicesContainer.Active,
(mapspan) => MyMap.MoveToRegion(mapspan),
this,
Navigation);
}
catch (Exception exception)
{
Log.ForContext<SelectStationPageViewModel>().Error("Constructing select station view model failed. {Exception}", exception);
return;
}
try
{
BindingContext = SelectStationPageViewModel;
}
catch (Exception exception)
{
Log.ForContext<SelectStationPageViewModel>().Error("Setting binding/ navigaton on select station failed. {Exception}", exception);
return;
}
try
{
base.OnAppearing();
}
catch (Exception exception)
{
// Continue because styling is not essential.
Log.ForContext<SelectStationPageViewModel>().Error("Invoking OnAppearing of base failed. {Exception}", exception);
return;
}
try
{
// Pre move and scanle maps to avoid initial display of map in Rome.
Log.ForContext<SelectStationPageViewModel>().Verbose("Moving and scaling map.");
SelectStationPageViewModel.MoveAndScale(
(mapSpan) => MyMap.MoveToRegion(mapSpan),
App.ModelRoot.Uris.ActiveUri);
}
catch (Exception exception)
{
// Continue because a map not beeing moved/ scaled is no reason for aborting startup.
Log.ForContext<SelectStationPageViewModel>().Error("Moving and scaling map failed. {Exception}", exception);
}
try
{
Log.ForContext<SelectStationPageViewModel>().Verbose("Invoking OnAppearing on select station view model.");
await SelectStationPageViewModel.OnAppearing();
}
catch (Exception exception)
{
Log.ForContext<SelectStationPageViewModel>().Error("Invoking OnAppearing on select station view model failed. {Exception}", exception);
return;
}
}
}
}

View file

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:resources="clr-namespace:ShareeBike.MultilingualResources;assembly=SharedBusinessLogic"
x:Class="ShareeBike.View.CopriWebView.ManageAccountPage">
<Shell.TitleView>
<Grid ColumnDefinitions="Auto, 1*">
<Label Style="{StaticResource Label-Navbar}"
Text="{x:Static resources:AppResources.MarkingAccountPageManagePersonalData}"/>
</Grid>
</Shell.TitleView>
<Shell.BackButtonBehavior>
<BackButtonBehavior IconOverride="{FontImage FontFamily=FA-S, Glyph={StaticResource IconClose}, Color=White, Size=16}" />
</Shell.BackButtonBehavior>
<ContentPage.Content>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WebView
Grid.Row="0"
x:Name="ManageAccount"
HeightRequest="1400"
WidthRequest="1000"
Source="{Binding Uri}" />
<ActivityIndicator Grid.Row="0"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>

View file

@ -0,0 +1,31 @@
using System.Globalization;
using Serilog;
using ShareeBike.Model.Device;
using ShareeBike.ViewModel.Login;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace ShareeBike.View.CopriWebView
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ManageAccountPage : ContentPage
{
public ManageAccountPage()
{
InitializeComponent();
ManageAccount.Navigating += WebViewHelper.SetBusyAndDisplayOrDownload;
ManageAccount.Navigated += (sender, eventArgs) => WebViewHelper.SetIdleAndHandleError(
sender,
eventArgs,
"<html><b>Kann persönliche Daten nicht anzeigen/ verwalten!</b><br>Verbindung mit Internet ok?</html>");
ManageAccount.BindingContext = new ManageAccountViewModel(
App.ModelRoot.ActiveUser.SessionCookie,
Model.ShareeBikeApp.MerchantId,
CultureInfo.CurrentUICulture.TwoLetterISOLanguageName,
App.ModelRoot.NextActiveUri.Host);
}
}
}

View file

@ -0,0 +1,33 @@
<?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:resources="clr-namespace:ShareeBike.MultilingualResources;assembly=SharedBusinessLogic"
x:Class="ShareeBike.View.CopriWebView.PasswordForgottenPage">
<Shell.TitleView>
<Grid ColumnDefinitions="Auto, 1*">
<Label Style="{StaticResource Label-Navbar}"
Text="{x:Static resources:AppResources.ActionLoginPasswordForgotten}"/>
</Grid>
</Shell.TitleView>
<Shell.BackButtonBehavior>
<BackButtonBehavior IconOverride="{FontImage FontFamily=FA-S, Glyph={StaticResource IconClose}, Color=White, Size=16}" />
</Shell.BackButtonBehavior>
<ContentPage.Content>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WebView x:Name="PasswordForgottenWebView"
HeightRequest="1400"
WidthRequest="1000"
Source="{Binding Uri}" />
<ActivityIndicator Grid.Row="0"
x:Name="ActivityIndicatorLoading"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>

View file

@ -0,0 +1,51 @@
using System.Globalization;
using Serilog;
using ShareeBike.ViewModel.CopriWebView;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace ShareeBike.View.CopriWebView
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class PasswordForgottenPage : ContentPage
{
public PasswordForgottenPage()
{
InitializeComponent();
PasswordForgottenWebView.Navigating += (sender, ev) =>
{
this.IsEnabled = false;
ActivityIndicatorLoading.IsVisible = true;
ActivityIndicatorLoading.IsRunning = true;
};
PasswordForgottenWebView.Navigated += (sender, ev) =>
{
if (ev.Result == WebNavigationResult.Success)
{
this.IsEnabled = true;
ActivityIndicatorLoading.IsVisible = false;
ActivityIndicatorLoading.IsRunning = false;
return;
}
Log.ForContext<PasswordForgottenPage>().Error("Navigation did not succeed. {@Event}", ev);
PasswordForgottenWebView.Source = new HtmlWebViewSource
{
Html = "<html><b>Kann Passwort vergessen Seite nicht anzeigen!</b><br>Verbindung mit Internet ok?</html>"
};
this.IsEnabled = true;
ActivityIndicatorLoading.IsVisible = false;
ActivityIndicatorLoading.IsRunning = false;
};
PasswordForgottenWebView.BindingContext = new PasswordForgottonViewModel(
Model.ShareeBikeApp.MerchantId,
CultureInfo.CurrentUICulture.TwoLetterISOLanguageName,
App.ModelRoot.NextActiveUri.Host);
}
}
}

View file

@ -0,0 +1,33 @@
<?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:resources="clr-namespace:ShareeBike.MultilingualResources;assembly=SharedBusinessLogic"
x:Class="ShareeBike.View.CopriWebView.RegisterPage">
<Shell.TitleView>
<Grid ColumnDefinitions="Auto, 1*">
<Label Style="{StaticResource Label-Navbar}"
Text="{x:Static resources:AppResources.ActionLoginRegister}"/>
</Grid>
</Shell.TitleView>
<Shell.BackButtonBehavior>
<BackButtonBehavior IconOverride="{FontImage FontFamily=FA-S, Glyph={StaticResource IconClose}, Color=White, Size=16}" />
</Shell.BackButtonBehavior>
<ContentPage.Content>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WebView x:Name="RegisterView"
HeightRequest="1400"
WidthRequest="1000"
Source="{Binding Uri}" />
<ActivityIndicator Grid.Row="0"
x:Name="ActivityIndicatorLoading"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>

View file

@ -0,0 +1,55 @@

using System.Globalization;
using Serilog;
using ShareeBike.Model.Device;
using ShareeBike.ViewModel.CopriWebView;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace ShareeBike.View.CopriWebView
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class RegisterPage : ContentPage
{
public RegisterPage()
{
DependencyService.Get<IWebView>().ClearCookies();
InitializeComponent();
RegisterView.Navigating += (sender, ev) =>
{
this.IsEnabled = false;
ActivityIndicatorLoading.IsVisible = true;
ActivityIndicatorLoading.IsRunning = true;
};
RegisterView.Navigated += (sender, ev) =>
{
if (ev.Result == WebNavigationResult.Success)
{
this.IsEnabled = true;
ActivityIndicatorLoading.IsVisible = false;
ActivityIndicatorLoading.IsRunning = false;
return;
}
Log.ForContext<RegisterPage>().Error("Navigation did not succeed. {@Event}", ev);
RegisterView.Source = new HtmlWebViewSource
{
Html = "<html><b>Kann Anmeldeseite nicht anzeigen</b>!<br>Verbindung mit Internet ok?</html>"
};
this.IsEnabled = true;
ActivityIndicatorLoading.IsVisible = false;
ActivityIndicatorLoading.IsRunning = false;
};
RegisterView.BindingContext = new RegisterPageViewModel(
Model.ShareeBikeApp.MerchantId,
CultureInfo.CurrentUICulture.TwoLetterISOLanguageName,
App.ModelRoot.NextActiveUri.Host);
}
}
}

View file

@ -0,0 +1,158 @@
<?xml version="1.0" encoding="utf-8" ?>
<xct:Popup xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
xmlns:local="clr-namespace:ShareeBike.View"
x:TypeArguments="local:FeedbackPopup+Result"
xmlns:sharedGui="clr-namespace:SharedGui.View"
xmlns:resources="clr-namespace:ShareeBike.MultilingualResources;assembly=SharedBusinessLogic"
IsLightDismissEnabled="false"
x:Class="ShareeBike.View.FeedbackPopup">
<xct:Popup.Resources>
<x:String x:Key="check_circle">&#xf058;</x:String>
<x:String x:Key="WriteFeedback">&#xf044;</x:String>
</xct:Popup.Resources>
<ScrollView
Orientation="Vertical"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand">
<StackLayout
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
Padding="0,0,0,400">
<!-- Head -->
<Grid
Padding="0,30,0,10"
ColumnDefinitions="10,Auto,1*,10"
ColumnSpacing="10"
HorizontalOptions="CenterAndExpand">
<!--icon-->
<Image
Grid.Column="1"
HorizontalOptions="End">
<Image.Source>
<FontImageSource
Glyph="{StaticResource WriteFeedback}"
FontFamily="FA-S"
Size="40"
Color="Black"/>
</Image.Source>
</Image>
<!--text-->
<Label
Grid.Column="2"
TextType="Html"
Text="{x:Static resources:AppResources.ActionGiveFeedback}"
FontSize="Large"
HorizontalOptions="StartAndExpand"
VerticalOptions="Center"
TextColor="Black"
Padding="0">
</Label>
</Grid>
<BoxView
Margin="20,0,20,10"
HeightRequest="1"
WidthRequest="400"
HorizontalOptions="Center"
Color="{DynamicResource primary-back-title-color}"/>
<!-- Content -->
<StackLayout
Margin="10"
Spacing="10">
<!-- Battery level -->
<sharedGui:BarLevelInputView
x:Name="BarLevelInputView"
HorizontalOptions="Center"/>
<!-- Is bike okay? -->
<Grid
ColumnDefinitions="*,Auto,*"
RowDefinitions="Auto,Auto"
Margin="0,20,0,0">
<Grid
Grid.Column="1"
ColumnDefinitions="1*,Auto,Auto">
<Label
Grid.Column="0"
FontAttributes="Bold"
HorizontalTextAlignment="End"
Text= "{x:Static resources:AppResources.MarkingReturnBikeBikeIsStateOkQuestion}">
</Label>
<Switch
Grid.Column="1"
VerticalOptions="Center"
HorizontalOptions="End"
x:Name="bikeIsOkSwitch"
IsToggled="True"/>
<Label
Grid.Column="2"
FontSize="Small"
VerticalOptions="Center"
HorizontalOptions="Start">
<Label.Triggers>
<DataTrigger TargetType="Label" Binding="{Binding Source={x:Reference bikeIsOkSwitch}, Path=IsToggled}" Value="False">
<Setter Property="Text" Value="{x:Static resources:AppResources.MessageAnswerNo}"/>
</DataTrigger>
<DataTrigger TargetType="Label" Binding="{Binding Source={x:Reference bikeIsOkSwitch}, Path=IsToggled}" Value="True">
<Setter Property="Text" Value="{x:Static resources:AppResources.MessageAnswerYes}"/>
</DataTrigger>
</Label.Triggers>
</Label>
</Grid>
<!-- Text input bike is not OK -->
<StackLayout Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="3"
Padding="1"
BackgroundColor="{DynamicResource primary-back-title-color}">
<StackLayout.Triggers>
<DataTrigger TargetType="StackLayout"
Binding="{Binding Source={x:Reference bikeIsOkSwitch}, Path=IsToggled}"
Value="False">
<Setter Property="IsVisible" Value="True"/>
<Setter Property="HeightRequest" Value="100"/>
</DataTrigger>
<DataTrigger TargetType="StackLayout"
Binding="{Binding Source={x:Reference bikeIsOkSwitch}, Path=IsToggled}"
Value="True">
<Setter Property="IsVisible" Value="False"/>
<Setter Property="HeightRequest" Value="0"/>
</DataTrigger>
</StackLayout.Triggers>
<Editor
x:Name="feedbackMessage"
HeightRequest="100"
Placeholder="{x:Static resources:AppResources.MarkingReturnBikeErrorDescriptionInputPlaceholder}"
Text=""
BackgroundColor="White">
</Editor>
</StackLayout>
</Grid>
<!-- Buttons -->
<Button
WidthRequest="100"
Clicked="OnOkClicked"
Text="{x:Static resources:AppResources.MessageAnswerOk}"/>
</StackLayout>
</StackLayout>
</ScrollView>
</xct:Popup>

View file

@ -0,0 +1,86 @@
using System;
using ShareeBike.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS;
using Xamarin.CommunityToolkit.UI.Views;
using Xamarin.Forms.Xaml;
namespace ShareeBike.View
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class FeedbackPopup : Popup<FeedbackPopup.Result>
{
/// <summary> Constructs user feedback popup.</summary>
/// <param name="battery">Object holding info about battery. For some batteries charging level might need to be updated by user.</param>
/// <param name="co2Saving"> Co2 saving information.</param>
public FeedbackPopup(
IBatteryMutable battery = null,
string co2Saving = null)
{
InitializeComponent();
if (battery == null
|| (battery.IsBackendAccessible.HasValue && battery.IsBackendAccessible.Value))
{
// Either
// - bike has no engine or
// - backend can access battery level information
// No need to ask user for input.
return;
}
BarLevelInputView.IsVisible = battery?.MaxChargeBars != null;
BarLevelInputView.Current = battery?.CurrentChargeBars?.ToString() ?? string.Empty;
BarLevelInputView.Maximum = battery?.MaxChargeBars != null ? battery?.MaxChargeBars.ToString() : String.Empty;
}
protected override FeedbackPopup.Result GetLightDismissResult()
{
return new Result
{
CurrentChargeBars = int.TryParse(BarLevelInputView.Current, out int current) ? (int?)current : null,
IsBikeBroken = bikeIsOkSwitch.IsToggled,
Message = feedbackMessage.Text
};
}
private void OnOkClicked(object sender, EventArgs eventArgs)
{
var result = new Result
{
CurrentChargeBars = int.TryParse(BarLevelInputView.Current, out int current) ? (int?)current : null,
IsBikeBroken = bikeIsOkSwitch.IsToggled,
Message = feedbackMessage.Text
};
Dismiss(result);
}
/// <summary>
/// Feedback given by user when returning bike.
/// </summary>
#if USCSHARP9
public class Result : IViewService.IUserFeedback
#else
public new class Result : IUserFeedback
#endif
{
/// <summary>
/// Holds the current charging level of the battery entered by user in bars, null if unknown.
/// </summary>
public int? CurrentChargeBars { get; set; }
/// <summary>
/// Holds whether bike is broken or not.
/// </summary>
public bool IsBikeBroken { get; set; }
/// <summary>
/// Holds either
/// - general feedback
/// - error description of broken bike
/// or both.
/// </summary>
public string Message { get; set; }
}
}
}

View file

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:resources="clr-namespace:ShareeBike.MultilingualResources;assembly=SharedBusinessLogic"
x:Class="ShareeBike.View.Help.HelpPage"
Style="{StaticResource TabbedPageStyle}">
<TabbedPage.Resources>
<x:String x:Key="IconSmartphone">&#xf3cd;</x:String>
<x:String x:Key="IconTariff">&#xf153;</x:String>
<x:String x:Key="IconFaq">&#xf059;</x:String>
</TabbedPage.Resources>
<Shell.TitleView>
<Grid ColumnDefinitions="Auto, 1*">
<Label Style="{StaticResource Label-Navbar}"
Text="{x:Static resources:AppResources.MarkingHelp}"/>
</Grid>
</Shell.TitleView>
<!--Pages can be added as references or in line-->
<ContentPage
x:Name="FaqPage"
IsEnabled="{Binding IsIdle}"
Title="FAQ">
<ContentPage.IconImageSource>
<FontImageSource Glyph="{StaticResource IconFaq}" FontFamily="FA-S" />
</ContentPage.IconImageSource>
<ContentPage.Content>
<Grid
RowDefinitions="Auto,*,Auto"
RowSpacing="0">
<BoxView Grid.Row="0"
HeightRequest="1"
WidthRequest="400"
HorizontalOptions="Center"
Color="{x:DynamicResource primary-back-title-color}"/>
<WebView Grid.Row="1"
x:Name="FaqWebView"
HeightRequest="1000"
WidthRequest="1000"
Source="{Binding FaqHtml}"/>
<BoxView Grid.Row="2"
HeightRequest="1"
WidthRequest="400"
HorizontalOptions="Center"
Color="{x:DynamicResource primary-back-title-color}"/>
<ActivityIndicator Grid.Row="0" Grid.RowSpan="3"
IsRunning="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
IsVisible="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>
<ContentPage
x:Name="ManualPage"
IsEnabled="{Binding IsIdle}"
Title="{x:Static resources:AppResources.MarkingTabManual}">
<ContentPage.IconImageSource>
<FontImageSource Glyph="{StaticResource IconSmartphone}" FontFamily="FA-S" />
</ContentPage.IconImageSource>
<ContentPage.Content>
<Grid
RowDefinitions="Auto,*,Auto"
RowSpacing="0">
<BoxView Grid.Row="0"
HeightRequest="1"
WidthRequest="400"
HorizontalOptions="Center"
Color="{x:DynamicResource primary-back-title-color}"/>
<WebView Grid.Row="1"
x:Name="ManualWebView"
HeightRequest="1000"
WidthRequest="1000"
Source="{Binding ManualHtml}"/>
<BoxView Grid.Row="2"
HeightRequest="1"
WidthRequest="400"
HorizontalOptions="Center"
Color="{x:DynamicResource primary-back-title-color}"/>
<ActivityIndicator Grid.Row="0" Grid.RowSpan="3"
IsRunning="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
IsVisible="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>
<ContentPage
x:Name="TariffPage"
IsEnabled="{Binding IsIdle}"
Title="{x:Static resources:AppResources.MarkingTabTariffs}">
<ContentPage.IconImageSource>
<FontImageSource Glyph="{StaticResource IconTariff}" FontFamily="FA-S" />
</ContentPage.IconImageSource>
<ContentPage.Content>
<Grid
RowDefinitions="Auto,*,Auto"
RowSpacing="0">
<BoxView Grid.Row="0"
HeightRequest="1"
WidthRequest="400"
HorizontalOptions="Center"
Color="{x:DynamicResource primary-back-title-color}"/>
<WebView Grid.Row="1"
x:Name="TariffsWebView"
HeightRequest="1000"
WidthRequest="1000"
Source="{Binding TariffsHtml}"/>
<BoxView Grid.Row="2"
HeightRequest="1"
WidthRequest="400"
HorizontalOptions="Center"
Color="{x:DynamicResource primary-back-title-color}"/>
<ActivityIndicator Grid.Row="0" Grid.RowSpan="3"
IsRunning="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
IsVisible="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>
</TabbedPage>

View file

@ -0,0 +1,54 @@
using System.Globalization;
using Serilog;
using ShareeBike.ViewModel;
using ShareeBike.ViewModel.Help;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace ShareeBike.View.Help
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class HelpPage : TabbedPage
{
public HelpPageViewModel ViewModel { get; }
public HelpPage()
{
InitializeComponent();
/// Info about renting.
TariffsWebView.Navigating += WebViewHelper.SelectDisplayTarget;
TariffsWebView.Navigated += (sender, ev) => WebViewHelper.HandleError(
sender,
ev,
"<html><b>Kann Mietinformationen nicht anzeigen!</b><br>Verbindung mit Internet ok?</html>");
/// Info about types of bikes.
ManualWebView.Navigating += WebViewHelper.SelectDisplayTarget;
ManualWebView.Navigated += (sender, ev) => WebViewHelper.HandleError(
sender,
ev,
"<html><b>Kann Radinformationen nicht anzeigen!</b><br>Verbindung mit Internet ok?</html>");
ViewModel = new HelpPageViewModel(
App.ModelRoot.NextActiveUri.Host,
App.ModelRoot.ResourceUrls.TariffsResourcePath,
App.ModelRoot.ResourceUrls.ManualResourcePath,
App.ModelRoot.IsSiteCachingOn,
CultureInfo.CurrentUICulture.TwoLetterISOLanguageName,
() => App.ModelRoot.GetConnector(App.ModelRoot.GetIsConnected()).Query,
resourceUrls => App.ModelRoot.ResourceUrls = resourceUrls);
this.BindingContext = ViewModel;
}
/// <summary> Called when page is shown. </summary>
protected override void OnAppearing()
{
ViewModel.OnAppearing();
}
}
}

View file

@ -0,0 +1,163 @@
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="ShareeBike.View.LegalInformation.LegalInformationPage"
xmlns:resources="clr-namespace:ShareeBike.MultilingualResources;assembly=SharedBusinessLogic"
Style="{StaticResource TabbedPageStyle}">
<TabbedPage.Resources>
<x:String x:Key="IconSmartphone">&#xf3cd;</x:String>
<x:String x:Key="IconPersonSafety">&#xf505;</x:String>
<x:String x:Key="IconDataSafety">&#xf56c;</x:String>
<x:String x:Key="IconLegalInfo">&#xf129;</x:String>
</TabbedPage.Resources>
<Shell.TitleView>
<Grid ColumnDefinitions="Auto, 1*">
<Label Style="{StaticResource Label-Navbar}"
Text="{x:Static resources:AppResources.MarkingLegalInformation}"/>
</Grid>
</Shell.TitleView>
<!--Pages can be added as references or in line-->
<ContentPage
IsEnabled="{Binding IsIdle}"
Title="{x:Static resources:AppResources.MarkingTabApp}">
<ContentPage.IconImageSource>
<FontImageSource Glyph="{StaticResource IconSmartphone}" FontFamily="FA-S" />
</ContentPage.IconImageSource>
<ContentPage.Content>
<Grid
RowDefinitions="Auto,*,Auto"
RowSpacing="0">
<BoxView Grid.Row="0"
HeightRequest="1"
WidthRequest="400"
HorizontalOptions="Center"
Color="{x:DynamicResource primary-back-title-color}"/>
<WebView Grid.Row="1"
x:Name="InfoLicenses"
Source="{Binding AppHtml}"
HeightRequest="1000"
WidthRequest="1000" />
<BoxView Grid.Row="2"
HeightRequest="1"
WidthRequest="400"
HorizontalOptions="Center"
Color="{x:DynamicResource primary-back-title-color}"/>
<ActivityIndicator Grid.Row="0" Grid.RowSpan="3"
IsRunning="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
IsVisible="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>
<ContentPage
IsEnabled="{Binding IsIdle}"
Title="{x:Static resources:AppResources.MarkingTabPrivacy}">
<ContentPage.IconImageSource>
<FontImageSource Glyph="{StaticResource IconPersonSafety}" FontFamily="FA-S" />
</ContentPage.IconImageSource>
<ContentPage.Content>
<Grid
RowDefinitions="Auto,*,Auto"
RowSpacing="0">
<BoxView Grid.Row="0"
HeightRequest="1"
WidthRequest="400"
HorizontalOptions="Center"
Color="{x:DynamicResource primary-back-title-color}"/>
<WebView Grid.Row="1"
x:Name="PrivacyWebView"
Source="{Binding PrivacyHtml}"
HeightRequest="1000"
WidthRequest="1000" />
<BoxView Grid.Row="2"
HeightRequest="1"
WidthRequest="400"
HorizontalOptions="Center"
Color="{x:DynamicResource primary-back-title-color}"/>
<ActivityIndicator Grid.Row="0" Grid.RowSpan="3"
IsRunning="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
IsVisible="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>
<ContentPage
IsEnabled="{Binding IsIdle}"
Title="{x:Static resources:AppResources.MarkingTabGtc}">
<ContentPage.IconImageSource>
<FontImageSource Glyph="{StaticResource IconDataSafety}" FontFamily="FA-S" />
</ContentPage.IconImageSource>
<ContentPage.Content>
<Grid
RowDefinitions="Auto,*,Auto"
RowSpacing="0">
<BoxView Grid.Row="0"
HeightRequest="1"
WidthRequest="400"
HorizontalOptions="Center"
Color="{x:DynamicResource primary-back-title-color}"/>
<WebView Grid.Row="1"
x:Name="GtcWebView"
Source ="{Binding GtcHtml}"
HeightRequest="1000"
WidthRequest="1000" />
<BoxView Grid.Row="2"
HeightRequest="1"
WidthRequest="400"
HorizontalOptions="Center"
Color="{x:DynamicResource primary-back-title-color}"/>
<ActivityIndicator Grid.Row="0" Grid.RowSpan="3"
IsRunning="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
IsVisible="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>
<ContentPage
IsEnabled="{Binding IsIdle}"
Title="{x:Static resources:AppResources.MarkingTabImpress}">
<ContentPage.IconImageSource>
<FontImageSource Glyph="{StaticResource IconLegalInfo}" FontFamily="FA-S" />
</ContentPage.IconImageSource>
<ContentPage.Content>
<Grid
RowDefinitions="Auto,*,Auto"
RowSpacing="0">
<BoxView Grid.Row="0"
HeightRequest="1"
WidthRequest="400"
HorizontalOptions="Center"
Color="{x:DynamicResource primary-back-title-color}"/>
<WebView Grid.Row="1"
x:Name="ImpressWebView"
Source="{Binding ImpressHtml}"
HeightRequest="1000"
WidthRequest="1000" />
<BoxView Grid.Row="2"
HeightRequest="1"
WidthRequest="400"
HorizontalOptions="Center"
Color="{x:DynamicResource primary-back-title-color}"/>
<ActivityIndicator Grid.Row="0" Grid.RowSpan="3"
IsRunning="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
IsVisible="{Binding IsIdle, Converter={StaticResource InvertedBoolConverter}}"
Scale="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Color="{x:DynamicResource primary-back-title-color}"/>
</Grid>
</ContentPage.Content>
</ContentPage>
</TabbedPage>

View file

@ -0,0 +1,60 @@
using System.Globalization;
using ShareeBike.ViewModel;
using ShareeBike.ViewModel.LegalInformation;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace ShareeBike.View.LegalInformation
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class LegalInformationPage : TabbedPage
{
public LegalInformationPageViewModel ViewModel { get; }
public LegalInformationPage()
{
InitializeComponent();
ViewModel = new LegalInformationPageViewModel(
App.ModelRoot.NextActiveUri.Host,
App.ModelRoot.ResourceUrls.GtcResourcePath,
App.ModelRoot.ResourceUrls.PrivacyResourcePath,
App.ModelRoot.ResourceUrls.ImpressResourcePath,
App.ModelRoot.IsSiteCachingOn,
resourceName => ViewModelResourceHelper.GetSource(resourceName),
() => App.ModelRoot.GetConnector(App.ModelRoot.GetIsConnected()).Query,
resourceUrls => App.ModelRoot.ResourceUrls = resourceUrls);
this.BindingContext = ViewModel;
InfoLicenses.Navigating += WebViewHelper.SelectDisplayTarget;
InfoLicenses.Navigated += (sender, ev) => WebViewHelper.HandleError(
sender,
ev,
"<html><b>Kann Lizenzinformationen nicht anzeigen!</b><br>Verbindung mit Internet ok?</html>");
PrivacyWebView.Navigating += WebViewHelper.SelectDisplayTarget;
PrivacyWebView.Navigated += (sender, ev) => WebViewHelper.HandleError(
sender,
ev,
"<html><b>Kann Datenschutzinformationen nicht anzeigen!</b><br>Verbindung mit Internet ok?</html>");
GtcWebView.Navigating += WebViewHelper.SelectDisplayTarget;
GtcWebView.Navigated += (sender, ev) => WebViewHelper.HandleError(
sender,
ev,
"<html><b>Kann allgemeine Geschäftsbedingungen nicht anzeigen!</b><br>Verbindung mit Internet ok?</html>");
ImpressWebView.Navigating += WebViewHelper.SelectDisplayTarget;
ImpressWebView.Navigated += (sender, ev) => WebViewHelper.HandleError(
sender,
ev,
"<html><b>Kann Impressum nicht anzeigen!</b><br>Verbindung mit Internet ok?</html>");
}
/// <summary> Called when page is shown. </summary>
protected override void OnAppearing()
{
ViewModel.OnAppearing();
}
}
}

View file

@ -0,0 +1,150 @@
<?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:resources="clr-namespace:ShareeBike.MultilingualResources;assembly=SharedBusinessLogic"
xmlns:sharedGui="clr-namespace:SharedGui.View"
xmlns:conv="clr-namespace:ShareeBike.View;assembly=SharedBusinessLogic"
x:Class="ShareeBike.View.Login.LoginPage"
BackgroundColor="{DynamicResource background-color}">
<Shell.TitleView>
<Grid ColumnDefinitions="Auto, 1*">
<Label Style="{StaticResource Label-Navbar}"
Text="{x:Static resources:AppResources.MarkingLogin}"/>
</Grid>
</Shell.TitleView>
<ContentPage.Resources>
<conv:BoolInverterConverter x:Key="BoolInverterConverter"/>
</ContentPage.Resources>
<ContentPage.Content>
<!--Grid for content and Running process in same row-->
<Grid>
<StackLayout
Grid.Row="0">
<Frame
Padding="10"
Margin="0,10,0,5"
HorizontalOptions="FillAndExpand"
BackgroundColor="White">
<StackLayout
x:Name="LoginPageView"
Padding="10">
<Label
Text="{x:Static resources:AppResources.MarkingLoginEmailAddressLabel}"
Margin="0,0,0,-5">
<Label.Triggers>
<DataTrigger
TargetType="Label"
Binding="{Binding Source={x:Reference EMailEntry}, Path=Text, TargetNullValue=''}"
Value="">
<Setter
Property="IsVisible"
Value="False" />
</DataTrigger>
</Label.Triggers>
</Label>
<Entry
Placeholder="{x:Static resources:AppResources.MarkingLoginEmailAddressPlaceholder}"
Keyboard="Email"
AutomationId="mail_address_text"
x:Name="EMailEntry"
Text="{Binding MailAddress}"
IsEnabled="{Binding IsLoggedOut}"/>
<Label
Text="{x:Static resources:AppResources.MarkingLoginPasswordPlaceholder}"
Margin="0,0,0,-5">
<Label.Triggers>
<DataTrigger
TargetType="Label"
Binding="{Binding Source={x:Reference PasswordEntry}, Path=Text, TargetNullValue=''}"
Value="">
<Setter
Property="IsVisible"
Value="False" />
</DataTrigger>
</Label.Triggers>
</Label>
<sharedGui:TogglePasswordEntry
Placeholder="{x:Static resources:AppResources.MarkingLoginPasswordPlaceholder}"
Text="{Binding Password}"
HidePassword="True"
AutomationId="password_text"
x:Name="PasswordEntry"
IsEnabled="{Binding IsLoggedOut}"/>
<Label
Text="{x:Static resources:AppResources.MarkingLoginPasswordLabel}"
HorizontalOptions="End"
Margin="0,-10,0,5"
FontSize="Small">
<Label.Triggers>
<DataTrigger
TargetType="Label"
Binding="{Binding Source={x:Reference PasswordEntry}, Path=Text, TargetNullValue=''}"
Value="">
<Setter
Property="IsVisible"
Value="False" />
</DataTrigger>
</Label.Triggers>
</Label>
<Button
Text="{x:Static resources:AppResources.ActionLoginLogin}"
AutomationId="login_button"
Command="{Binding OnLoginRequest}">
<Button.Triggers>
<DataTrigger TargetType="Button" Binding="{Binding IsLoginRequestAllowed}" Value="False">
<Setter Property="BorderColor" Value="DimGray" />
<Setter Property="BackgroundColor" Value="DimGray" />
<Setter Property="TextColor" Value="LightGray" />
</DataTrigger>
</Button.Triggers>
</Button>
<Button
Style="{StaticResource SecondaryButton}"
Text="{x:Static resources:AppResources.ActionLoginRegister}"
AutomationId="register_button"
Command="{Binding OnRegisterRequest}"
IsVisible="{Binding IsWebViewElementsVisible}">
</Button>
<Label
IsVisible="{Binding IsRegisterTargetsInfoVisible}"
FormattedText="{Binding RegisterTargetsInfo}">
</Label>
<Button
AutomationId="password_forgotten_button"
Style="{StaticResource NoOutlineButtonWhite}"
Text="{x:Static resources:AppResources.ActionLoginPasswordForgotten}"
Command="{Binding OnPasswordForgottonRequest}">
</Button>
</StackLayout>
</Frame>
</StackLayout>
<!--While process is running-->
<sharedGui:RunningProcessView
IsVisible="{Binding IsIdle, Converter={StaticResource BoolInverterConverter}}"
Grid.Row="0"/>
</Grid>
</ContentPage.Content>
</ContentPage>

View file

@ -0,0 +1,107 @@
using ShareeBike.ViewModel;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using System.Threading.Tasks;
using System;
using ShareeBike.Model.Device;
using ShareeBike.ViewModel.Account;
using ShareeBike.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS;
namespace ShareeBike.View.Login
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class LoginPage : ContentPage, IViewService
{
/// <summary> Reference to view model. </summary>
LoginPageViewModel m_oViewModel = null;
/// <summary> Constructs a login page. </summary>
public LoginPage()
{
InitializeComponent();
var l_oModel = App.ModelRoot;
m_oViewModel = new LoginPageViewModel(
l_oModel,
(url) => DependencyService.Get<IExternalBrowserService>().OpenUrl(url),
this);
BindingContext = m_oViewModel;
}
/// <summary>
/// Displays alert message.
/// </summary>
/// <param name="p_strTitle">Title of message.</param>
/// <param name="p_strMessage">Message to display.</param>
/// <param name="p_strCancel">Type of buttons.</param>
public new async Task DisplayAlert(string p_strTitle, string p_strMessage, string p_strCancel)
=> await App.Current.MainPage.DisplayAlert(p_strTitle, p_strMessage, p_strCancel);
/// <summary> Displays alert message.</summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="details">Detailed error description.</param>
/// <param name="cancel">Type of buttons.</param>
public async Task DisplayAdvancedAlert(
string title,
string message,
string details,
string cancel)
=> await App.Current.MainPage.DisplayAlert(title, $"{message}\r\nDetails:\r\n{details}", cancel);
/// <summary> Displays detailed alert message.</summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="details">Detailed error description.</param>
/// <param name="accept">Text of accept button.</param>
/// <param name="cancel">Text of cancel button.</param>
/// <returns>True if user pressed accept.</returns>
public async Task<bool> DisplayAdvancedAlert(string title, string message, string details, string accept, string cancel)
=> await App.Current.MainPage.DisplayAlert(title, !string.IsNullOrEmpty(details) ? $"{message}\r\nDetails:\r\n{details}" : $"{message}", accept, cancel);
/// <summary> Shows a page.</summary>
/// <param name="route">Route of the page to show.</param>
public async Task ShowPage(string route) => await Shell.Current.GoToAsync(route);
/// <summary> Pushes a page onto the modal stack. </summary>
/// <param name="p_oTypeOfPage">Page to display.</param>
public async Task PushModalAsync(ViewTypes typeOfPage)
=> await Navigation.PushModalAsync((Page)Activator.CreateInstance(typeOfPage.GetViewType()));
/// <summary> Pops a page from the modal stack. </summary>
public Task PopModalAsync()
{
throw new NotSupportedException();
}
/// <summary>
/// Invoked when pages is closed/ hidden.
/// Stops update process.
/// </summary>
protected async override void OnDisappearing()
{
if (m_oViewModel == null)
{
// View model might be null.
return;
}
await m_oViewModel.OnDisappearing();
}
/// <summary> Pushes a page onto the stack. </summary>
/// <param name="p_oTypeOfPage">Page to display.</param>
public async Task PushAsync(ViewTypes p_oTypeOfPage)
{
await Navigation.PushAsync((Page)Activator.CreateInstance(p_oTypeOfPage.GetViewType()));
}
#if USCSHARP9
public Task<IViewService.IUserFeedback> DisplayUserFeedbackPopup() => throw new NotSupportedException();
#else
public async Task<IUserFeedback> DisplayUserFeedbackPopup(IBatteryMutable battery = null) => throw new NotSupportedException();
#endif
}
}

View file

@ -0,0 +1,219 @@
<?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:maps="clr-namespace:Xamarin.Forms.GoogleMaps;assembly=Xamarin.Forms.GoogleMaps"
xmlns:bindings="clr-namespace:Xamarin.Forms.GoogleMaps.Bindings;assembly=Xamarin.Forms.GoogleMaps.Bindings"
xmlns:resources="clr-namespace:ShareeBike.MultilingualResources;assembly=SharedBusinessLogic"
x:Class="ShareeBike.View.Map.MapPage"
xmlns:sharedGui="clr-namespace:SharedGui.View"
Shell.NavBarIsVisible="{Binding IsNavBarVisible}"
BackgroundColor="{DynamicResource Key=background-color}">
<Shell.TitleView >
<Grid ColumnDefinitions="Auto, 1*">
<Label Style="{StaticResource Label-Navbar}"
Text="{x:Static resources:AppResources.MarkingBikeLocations}"/>
</Grid>
</Shell.TitleView>
<ContentPage.Content>
<!--Grid for Map with Buttons and Running process-->
<Grid>
<StackLayout
Spacing="0"
Grid.Row="0">
<sharedGui:NotConnectedToNetView/>
<Grid
RowDefinitions="20,46,1*,Auto"
ColumnDefinitions="1*,Auto,1*"
RowSpacing="0"
IsEnabled="{Binding IsMapPageEnabled}"
VerticalOptions="FillAndExpand">
<!--Map-->
<maps:Map
Grid.RowSpan="3"
Grid.ColumnSpan="3"
WidthRequest="320"
HeightRequest="800"
x:Name="MyMap"
MapType="Street">
<maps:Map.Behaviors>
<bindings:BindingPinsBehavior Value="{Binding Pins}"/>
<bindings:PinClickedToCommandBehavior Command="{Binding PinClickedCommand}"/>
</maps:Map.Behaviors>
</maps:Map>
<!--Buttons for choosing bike type-->
<Frame
CornerRadius="13"
Grid.Row="1"
Grid.Column="1"
Margin="0"
Padding="0"
IsVisible="{Binding IsNavBarVisible}"
BackgroundColor="{DynamicResource secondary-back-title-color}">
<StackLayout
Orientation="Horizontal"
Margin="0"
Padding="0">
<Button
x:Name="CitybikeButton"
AutomationId ="FilterCitybike_button"
Text="{x:Static resources:AppResources.MarkingCityBike}"
Command="{Binding OnToggleCargoToCitybike}"
IsVisible="{Binding IsToggleVisible}"
BackgroundColor="{Binding CitybikeColor}"
BorderColor="{Binding CitybikeColor}"
BorderWidth="0"
VerticalOptions="Center"
HorizontalOptions="Center"
WidthRequest="94"
HeightRequest="40"
CornerRadius="10"
Margin="3,0,0,0"
FontSize="Small"
FontAttributes="Bold"
TextColor="{Binding NoCitybikeColor}">
</Button>
<Button
x:Name="CargoButton"
AutomationId ="FilterCargo_button"
Text="{x:Static resources:AppResources.MarkingCargoBike}"
Command="{Binding OnToggleCitybikeToCargo}"
IsVisible="{Binding IsToggleVisible}"
BackgroundColor="{Binding CargoColor}"
BorderColor="{Binding CargoColor}"
BorderWidth="0"
VerticalOptions="Center"
HorizontalOptions="Center"
WidthRequest="94"
HeightRequest="40"
CornerRadius="10"
Margin="0,0,3,0"
FontSize="Small"
FontAttributes="Bold"
TextColor="{Binding NoCargoColor}">
</Button>
</StackLayout>
</Frame>
<!--MyBikes-->
<Frame
Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="3"
Margin="0,0,0,20"
Padding="0"
BackgroundColor="White"
HasShadow="True"
VerticalOptions="End"
HorizontalOptions="CenterAndExpand"
BorderColor="{DynamicResource primary-back-title-color}"
CornerRadius="10">
<Frame.Triggers>
<DataTrigger
TargetType="Frame"
Binding="{Binding Path=MyBikesCountText.Length}" Value="0">
<Setter Property="IsVisible" Value="false" />
</DataTrigger>
</Frame.Triggers>
<Frame.GestureRecognizers>
<TapGestureRecognizer Command="{Binding OnMyBikesButtonClicked}" />
</Frame.GestureRecognizers>
<Grid
RowDefinitions="20,Auto,1*"
ColumnDefinitions="Auto"
RowSpacing="0">
<Image
Grid.Row="1"
Margin="-3">
<Image.Source>
<FontImageSource
Glyph="{StaticResource IconMyBikes}"
Color="DimGray" FontFamily="FA-S"/>
</Image.Source>
</Image>
<BoxView
Grid.Row="0"
Grid.RowSpan="2"
BackgroundColor="{DynamicResource primary-back-title-color}"
WidthRequest="20"
HeightRequest="20"
CornerRadius="10"
HorizontalOptions="End"
VerticalOptions="Start"
Margin="5"/>
<Frame
Grid.Row="0"
Grid.RowSpan="2"
BackgroundColor="{DynamicResource primary-back-title-color}"
WidthRequest="20"
HeightRequest="20"
CornerRadius="50"
HasShadow="False"
HorizontalOptions="End"
VerticalOptions="Start"
Padding="0"
Margin="5">
<Label
Text="{Binding MyBikesCountText}"
FontSize="Medium"
FontAttributes="Bold"
VerticalOptions="Center"
HorizontalOptions="Center"
TextColor="White"
Padding="0"
Margin="-10"/>
</Frame>
<Label
Grid.Row="2"
Text="{x:Static resources:AppResources.MarkingMyBikes}"
FontSize="Micro"
TextColor="DimGray"
VerticalOptions="Center"
Margin="10,0,10,5"
Padding="0"/>
</Grid>
</Frame>
<!--Info text-->
<Label
Grid.Row="3"
Grid.ColumnSpan="3"
Text="{Binding StatusInfoText}"
IsVisible="{Binding Path=IsProcessWithRunningProcessView, Converter={StaticResource InvertedBoolConverter}}"
FontSize="Small"
TextColor="DimGray"
HorizontalOptions="CenterAndExpand">
<Label.Triggers>
<DataTrigger
TargetType="Label"
Binding="{Binding Path=StatusInfoText.Length}" Value="0">
<Setter Property="HeightRequest" Value="0" />
</DataTrigger>
<DataTrigger
TargetType="Label"
Binding="{Binding Path=StatusInfoText}" Value="Offline.">
<Setter Property="HeightRequest" Value="0" />
</DataTrigger>
</Label.Triggers>
</Label>
</Grid>
</StackLayout>
<!--While process is running-->
<sharedGui:RunningProcessView
IsVisible="{Binding IsProcessWithRunningProcessView}"
Grid.Row="0"/>
</Grid>
</ContentPage.Content>
</ContentPage>

View file

@ -0,0 +1,230 @@
using System;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace ShareeBike.View.Map
{
using Serilog;
using ShareeBike.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS;
using ShareeBike.ViewModel.Map;
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class MapPage : ContentPage, IViewService
{
/// <summary> View model to notify about whether page appears or hides. </summary>
private MapPageViewModel MapPageViewModel { get; set; }
/// <summary> Initialization status to ensure initialization logic is not called multiple times. </summary>
private bool isInitializationStarted = false;
/// <summary>
/// Constructs map page instance.
/// </summary>
public MapPage()
{
InitializeComponent();
}
/// <summary>
/// Displays alert message.
/// </summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="cancel">Type of buttons.</param>
public new async Task DisplayAlert(string title, string message, string cancel)
=> await App.Current.MainPage.DisplayAlert(title, message, cancel);
/// <summary> Displays alert message.</summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="details">Detailed error description.</param>
/// <param name="cancel">Type of buttons.</param>
public async Task DisplayAdvancedAlert(
string title,
string message,
string details,
string cancel)
=> await App.Current.MainPage.DisplayAlert(title, $"{message}\r\nDetails:\r\n{details}", cancel);
/// <summary> Displays detailed alert message.</summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="details">Detailed error description.</param>
/// <param name="accept">Text of accept button.</param>
/// <param name="cancel">Text of cancel button.</param>
/// <returns>True if user pressed accept.</returns>
public async Task<bool> DisplayAdvancedAlert(string title, string message, string details, string accept, string cancel)
=> await App.Current.MainPage.DisplayAlert(title, !string.IsNullOrEmpty(details) ? $"{message}\r\nDetails:\r\n{details}" : $"{message}", accept, cancel);
/// <summary>
/// Displays alert message.
/// </summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="accept">Text of accept button.</param>
/// <param name="cancel">Text of button.</param>
/// <returns>True if user pressed accept.</returns>
public new async Task<bool> DisplayAlert(string title, string message, string accept, string cancel)
=> await App.Current.MainPage.DisplayAlert(title, message, accept, cancel);
/// <summary> Shows a page.</summary>
/// <param name="route">Route of the page to show.</param>
public async Task ShowPage(string route) => await Shell.Current.GoToAsync(route);
/// <summary> Pushes a page onto the modal stack. </summary>
/// <param name="typeOfPage">Type of page to display.</param>
public async Task PushModalAsync(ViewTypes typeOfPage)
=> await Navigation.PushModalAsync((Page)Activator.CreateInstance(typeOfPage.GetViewType()));
/// <summary> Pops a page from the modal stack. </summary>
public async Task PopModalAsync()
=> await Navigation.PopModalAsync();
/// <summary> Pushes a page onto the stack. </summary>
/// <param name="typeOfPage">Page to display.</param>
public async Task PushAsync(ViewTypes typeOfPage)
{
var page = Activator.CreateInstance(typeOfPage.GetViewType());
if (page == null)
{
return;
}
await Navigation.PushAsync((Page)page);
}
#if USCSHARP9
public Task<IViewService.IUserFeedback> DisplayUserFeedbackPopup() => throw new NotSupportedException();
#else
public async Task<IUserFeedback> DisplayUserFeedbackPopup(IBatteryMutable battery = null) => throw new NotSupportedException();
#endif
/// <summary>
/// Invoked when page is shown.
/// Starts update process.
/// </summary>
protected async override void OnAppearing()
{
// Don't repeat the initialization if it has been completed already.
if (isInitializationStarted) return;
isInitializationStarted = true;
// Pass reference to member Navigation to show bikes at station x dialog.
try
{
Log.ForContext<MapPage>().Verbose("Constructing map page view model.");
MapPageViewModel = CreateMapPageViewModel();
}
catch (Exception exception)
{
Log.ForContext<MapPage>().Error("Constructing map page view model failed. {Exception}", exception);
isInitializationStarted = false;
return;
}
try
{
BindingContext = MapPageViewModel;
}
catch (Exception exception)
{
Log.ForContext<MapPage>().Error("Setting binding/ navigation on map page failed. {Exception}", exception);
isInitializationStarted = false;
return;
}
try
{
base.OnAppearing();
}
catch (Exception exception)
{
// Continue because styling is not essential.
Log.ForContext<MapPage>().Error("Invoking OnAppearing of base failed. {Exception}", exception);
}
try
{
// Premove and scale maps to avoid initial display of map in Rome.
PremoveAndScaleMap();
}
catch (Exception exception)
{
// Continue because a map not beeing moved/ scaled is no reason for aborting startup.
Log.ForContext<MapPage>().Error("Moving and scaling map failed. {Exception}", exception);
}
try
{
Log.ForContext<MapPage>().Verbose("Invoking OnAppearing on map page view model.");
await MapPageViewModel.OnAppearing();
}
catch (Exception exception)
{
Log.ForContext<MapPage>().Error("Invoking OnAppearing on map page view model failed. {Exception}", exception);
isInitializationStarted = false;
return;
}
try
{
Log.ForContext<MapPage>().Verbose("Setting map settings.");
//show current user position (blue dot) and enable button for centering map manually.
MyMap.UiSettings.MyLocationButtonEnabled = MapPageViewModel.IsLocationPermissionGranted;
MyMap.IsShowingUser = MapPageViewModel.IsLocationPermissionGranted;
//disable +/- buttons
MyMap.UiSettings.ZoomControlsEnabled = false;
}
catch (Exception exception)
{
Log.ForContext<MapPage>().Verbose("Setting map settings failed. {Exception}", exception);
}
isInitializationStarted = false;
}
/// <summary>
/// Premoves the Map to a certain location.
/// </summary>
private void PremoveAndScaleMap()
{
Log.ForContext<MapPage>().Verbose("Moving and scaling map.");
MapPageViewModel.MoveAndScale(
(mapSpan) => MyMap.MoveToRegion(mapSpan),
App.ModelRoot.ActiveMapSpan);
}
/// <summary>
/// Creates the Map Page's view model.
/// </summary>
private MapPageViewModel CreateMapPageViewModel()
{
Log.ForContext<MapPage>().Verbose("Constructing map page view model.");
return new MapPageViewModel(
App.ModelRoot,
App.PermissionsService,
App.BluetoothService,
App.LocationServicesContainer.Active,
(mapspan) => MyMap.MoveToRegion(mapspan),
this,
Navigation);
}
/// <summary>
/// Invoked when pages is closed/ hidden.
/// Stops update process.
/// </summary>
protected async override void OnDisappearing()
{
if (MapPageViewModel != null)
{
// View model might be null.
await MapPageViewModel?.OnDisappearing();
}
base.OnDisappearing();
}
}
}

View file

@ -0,0 +1,36 @@
<?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_minisurvey="clr-namespace:ShareeBike.View.MiniSurvey.Question"
x:Class="ShareeBike.View.MiniSurvey.MiniSurveyPage">
<ContentPage.Resources>
<ResourceDictionary>
<local_minisurvey:QuestionViewCellTemplateSelector x:Key="questionViewCellTemplateSelector"/>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<Frame>
<StackLayout>
<Label
FontSize="Large"
FontAttributes="Bold"
Text="{Binding Title}"/>
<Label
Text="{Binding Subtitle}"/>
<ListView
x:Name="MiniSurveyListView"
HasUnevenRows="True"
ItemTemplate="{StaticResource questionViewCellTemplateSelector}">
</ListView>
<Label
Text="{Binding Footer}"/>
<Button
IsEnabled="False"
Command="{Binding OnButtonClicked}"
Text="OK"
WidthRequest="100"
Margin="0,0,0,3"/>
</StackLayout>
</Frame>
</ContentPage.Content>
</ContentPage>

View file

@ -0,0 +1,95 @@
using System;
using System.Threading.Tasks;
using ShareeBike.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS;
using ShareeBike.ViewModel.MiniSurvey;
using Xamarin.CommunityToolkit.Extensions;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace ShareeBike.View.MiniSurvey
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class MiniSurveyPage : ContentPage, IViewService
{
public MiniSurveyPage()
{
var model = App.ModelRoot;
var vm = new MiniSurveyViewModel(
() => model.GetIsConnected(),
(isConnected) => model.GetConnector(isConnected),
this);
InitializeComponent();
BindingContext = vm;
MiniSurveyListView.ItemsSource = vm;
}
/// <summary>
/// Displays alert message.
/// </summary>
/// <param name="p_strTitle">Title of message.</param>
/// <param name="p_strMessage">Message to display.</param>
/// <param name="p_strCancel">Type of buttons.</param>
public new async Task DisplayAlert(string p_strTitle, string p_strMessage, string p_strCancel)
=> await App.Current.MainPage.DisplayAlert(p_strTitle, p_strMessage, p_strCancel);
/// <summary> Displays alert message.</summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="details">Detailed error description.</param>
/// <param name="cancel">Type of buttons.</param>
public async Task DisplayAdvancedAlert(
string title,
string message,
string details,
string cancel)
=> await App.Current.MainPage.DisplayAlert(title, $"{message}\r\nDetails:\r\n{details}", cancel);
/// <summary> Displays detailed alert message.</summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="details">Detailed error description.</param>
/// <param name="accept">Text of accept button.</param>
/// <param name="cancel">Text of cancel button.</param>
/// <returns>True if user pressed accept.</returns>
public async Task<bool> DisplayAdvancedAlert(string title, string message, string details, string accept, string cancel)
=> await App.Current.MainPage.DisplayAlert(title, !string.IsNullOrEmpty(details) ? $"{message}\r\nDetails:\r\n{details}" : $"{message}", accept, cancel);
/// <summary>
/// Displays alert message.
/// </summary>
/// <param name="p_strTitle">Title of message.</param>
/// <param name="p_strMessage">Message to display.</param>
/// <param name="p_strAccept">Text of accept button.</param>
/// <param name="p_strCancel">Text of button.</param>
/// <returns>True if user pressed accept.</returns>
public new async Task<bool> DisplayAlert(string p_strTitle, string p_strMessage, string p_strAccept, string p_strCancel)
=> await App.Current.MainPage.DisplayAlert(p_strTitle, p_strMessage, p_strAccept, p_strCancel);
/// <summary> Shows a page.</summary>
/// <param name="route">Route of the page to show.</param>
public async Task ShowPage(string route) => await Shell.Current.GoToAsync(route);
/// <summary> Pushes a page onto the modal stack. </summary>
/// <param name="p_oTypeOfPage">Page to display.</param>
public Task PushModalAsync(ViewTypes p_oTypeOfPage) => throw new NotSupportedException();
/// <summary> Pops a page from the modal stack. </summary>
public Task PopModalAsync() => Navigation.PopModalAsync();
/// <summary> Pushes a page onto the stack. </summary>
/// <param name="p_oTypeOfPage">Page to display.</param>
public Task PushAsync(ViewTypes p_oTypeOfPage) => throw new NotSupportedException();
#if USCSHARP9
public async Task<IViewService.IUserFeedback> DisplayUserFeedbackPopup() => await Navigation.ShowPopupAsync<FeedbackPopup.Result>(new FeedbackPopup());
#else
/// <summary> Displays user feedback popup.</summary>
/// <param name="co2Saving"> Co2 saving information.</param>
/// <returns>User feedback.</returns>
public async Task<IUserFeedback> DisplayUserFeedbackPopup(IBatteryMutable battery = null) => await Navigation.ShowPopupAsync<FeedbackPopup.Result>(new FeedbackPopup(battery));
#endif
}
}

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<ViewCell xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:resources="clr-namespace:ShareeBike.MultilingualResources;assembly=SharedBusinessLogic"
x:Class="ShareeBike.View.MiniSurvey.Question.CheckOneViewCell">
<ViewCell.View>
<Frame>
<StackLayout>
<Label
FontSize="Medium"
Text="{Binding QuestionText}" />
<Picker
Title="{x:Static resources:AppResources.MiniSurveyAskForAnswer}"
SelectedItem="{Binding AnswerText}"
ItemsSource="{Binding AnswersText}"/>
</StackLayout>
</Frame>
</ViewCell.View>
</ViewCell>

View file

@ -0,0 +1,14 @@
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace ShareeBike.View.MiniSurvey.Question
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class CheckOneViewCell : ViewCell
{
public CheckOneViewCell()
{
InitializeComponent();
}
}
}

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<ViewCell xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:resources="clr-namespace:ShareeBike.MultilingualResources;assembly=SharedBusinessLogic"
x:Class="ShareeBike.View.MiniSurvey.Question.FreeTextViewCell">
<ViewCell.View>
<Frame>
<StackLayout>
<Label
FontSize="Medium"
Text="{Binding QuestionText}" />
<Editor
AutoSize="TextChanges"
Text="{Binding AnswerText}"
Placeholder="{x:Static resources:AppResources.MiniSurveyEnterAnswer}">
</Editor>
</StackLayout>
</Frame>
</ViewCell.View>
</ViewCell>

View file

@ -0,0 +1,15 @@

using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace ShareeBike.View.MiniSurvey.Question
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class FreeTextViewCell : ViewCell
{
public FreeTextViewCell()
{
InitializeComponent();
}
}
}

View file

@ -0,0 +1,26 @@
using Xamarin.Forms;
namespace ShareeBike.View.MiniSurvey.Question
{
/// <summary>
/// Selects different templates for different question types.
/// </summary>
public class QuestionViewCellTemplateSelector : DataTemplateSelector
{
DataTemplate checkOneViewCell;
DataTemplate freeTextViewCell;
public QuestionViewCellTemplateSelector()
{
checkOneViewCell = new DataTemplate(typeof(CheckOneViewCell));
freeTextViewCell = new DataTemplate(typeof(FreeTextViewCell));
}
protected override DataTemplate OnSelectTemplate(object item, BindableObject container)
{
return item is ViewModel.MiniSurvey.Question.FreeTextViewModel
? freeTextViewCell
: checkOneViewCell;
}
}
}

View file

@ -0,0 +1,139 @@
<?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:xct="http://xamarin.com/schemas/2020/toolkit"
x:Class="ShareeBike.View.MyBikes.MyBikesPage"
xmlns:resources="clr-namespace:ShareeBike.MultilingualResources;assembly=SharedBusinessLogic"
xmlns:sharedGui="clr-namespace:SharedGui.View"
xmlns:rental_process="clr-namespace:ShareeBike.ViewModel.Bikes;assembly=SharedBusinessLogic"
xmlns:bikeRentalProcess="clr-namespace:SharedGui.View.Bike.RentalProcess"
xmlns:local_bike="clr-namespace:ShareeBike.View.Bike"
BackgroundColor="{DynamicResource background-color}"
Shell.FlyoutBehavior="{Binding FlyoutBehavior}"
Shell.NavBarIsVisible="{Binding IsIdle}">
<Shell.TitleView>
<Grid ColumnDefinitions="Auto, 1*">
<Label Style="{StaticResource Label-Navbar}"
Text="{x:Static resources:AppResources.MarkingMyBikes}"/>
</Grid>
</Shell.TitleView>
<ContentPage.Resources>
<ResourceDictionary>
<local_bike:BikeViewCellTemplateSelector x:Key="bikeTemplateSelector"/>
<xct:MultiConverter x:Key="RentalProcessToVisibleConverter">
<xct:EnumToBoolConverter>
<xct:EnumToBoolConverter.TrueValues>
<rental_process:CurrentRentalProcess>CloseLock</rental_process:CurrentRentalProcess>
<rental_process:CurrentRentalProcess>EndRental</rental_process:CurrentRentalProcess>
</xct:EnumToBoolConverter.TrueValues>
</xct:EnumToBoolConverter>
<xct:InvertedBoolConverter />
</xct:MultiConverter>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<!--Grid for Bike(s) view and Running process in same row-->
<Grid>
<!--Bike(s) view-->
<Grid
IsVisible="{Binding RentalProcess.State, Converter={StaticResource RentalProcessToVisibleConverter}}"
Grid.Row="0"
RowSpacing="0"
RowDefinitions="1*,Auto">
<StackLayout
Grid.Row="0"
Spacing="0"
Orientation="Vertical">
<!--No Network Connection-->
<sharedGui:NotConnectedToNetView/>
<!--Bike data-->
<Grid
RowDefinitions="Auto,1*"
RowSpacing="0">
<!--Hint for Outdated Data.-->
<sharedGui:HintForRefreshingPageView
Grid.Row="0"/>
<!--Bike(s)-->
<ListView
Grid.Row="1"
x:Name="MyBikesListView"
BackgroundColor="{DynamicResource background-color}"
SelectionMode="None"
SelectedItem="{Binding SelectedBike}"
IsEnabled="{Binding IsIdle}"
HasUnevenRows="True"
SeparatorVisibility="None"
ItemTemplate="{StaticResource bikeTemplateSelector}"
IsPullToRefreshEnabled="True"
RefreshCommand="{Binding RefreshCommand}"
IsRefreshing="{Binding IsRefreshing}"/>
<!--No Bikes-->
<Label
Grid.Row="1"
Margin="20"
IsVisible="{Binding IsNoBikesOccupiedVisible}"
Text="{Binding NoBikesOccupiedText}"/>
</Grid>
</StackLayout>
<!--Info text-->
<Label
Grid.Row="1"
Text="{Binding StatusInfoText}"
IsVisible="{Binding Path=IsProcessWithRunningProcessView, Converter={StaticResource InvertedBoolConverter}}"
FontSize="Small"
TextColor="DimGray"
Padding="5"
HorizontalOptions="CenterAndExpand">
<Label.Triggers>
<DataTrigger
TargetType="Label"
Binding="{Binding Path=StatusInfoText.Length}" Value="0">
<Setter Property="HeightRequest" Value="0" />
</DataTrigger>
<DataTrigger
TargetType="Label"
Binding="{Binding Path=StatusInfoText}" Value="Offline.">
<Setter Property="HeightRequest" Value="0" />
</DataTrigger>
</Label.Triggers>
</Label>
</Grid>
<!--While process is running-->
<sharedGui:RunningProcessView
Grid.Row="0"
IsVisible="{Binding IsProcessWithRunningProcessView}"/>
<!--OpenLock View-->
<bikeRentalProcess:RentalProcessBookedClosedOpenLock
Grid.Row="0"/>
<!--CloseLock View-->
<bikeRentalProcess:RentalProcessBookedOpenCloseLock
Grid.Row="0"/>
<!--EndRental View-->
<bikeRentalProcess:RentalProcessBookedClosedEndRental
Grid.Row="0"/>
</Grid>
</ContentPage.Content>
</ContentPage>

View file

@ -0,0 +1,179 @@
using Plugin.Connectivity;
using System;
using System.Threading;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace ShareeBike.View.MyBikes
{
using Serilog;
using ShareeBike.Model;
using ShareeBike.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS;
using ShareeBike.Model.Device;
using ShareeBike.MultilingualResources;
using ShareeBike.ViewModel.MyBikes;
using Xamarin.CommunityToolkit.Extensions;
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class MyBikesPage : ContentPage, IViewService
{
/// <summary> Refernce to view model. </summary>
MyBikesPageViewModel m_oViewModel = null;
/// <summary> Initialization status to ensure initialization logic is not called multiple times. </summary>
private bool isInitializationStarted = false;
/// <summary>
/// Constructs a my bikes page.
/// </summary>
public MyBikesPage()
{
}
/// <summary>
/// Invoked when page is shown.
/// Starts update process.
/// </summary>
protected async override void OnAppearing()
{
// Don't repeat the initialization if it has been completed already.
if (isInitializationStarted) return;
isInitializationStarted = true;
if (m_oViewModel != null)
{
// No need to create view model, set binding context an items source if already done.
// If done twice tap events are fired multiple times (when hiding page using home button).
await m_oViewModel.OnAppearingOrRefresh();
isInitializationStarted = false;
return;
}
try
{
var model = App.ModelRoot;
m_oViewModel = new MyBikesPageViewModel(
model.ActiveUser,
App.PermissionsService,
App.BluetoothService,
Device.RuntimePlatform,
() => model.GetIsConnected(),
(isConnected) => model.GetConnector(isConnected),
App.LocationServicesContainer.Active,
model.LocksServices.Active,
model.Stations,
model.Polling,
model.PostAction,
model.SmartDevice,
this,
(url) => DependencyService.Get<IExternalBrowserService>().OpenUrl(url))
{
IsReportLevelVerbose = model.IsReportLevelVerbose
};
}
catch (Exception exception)
{
Log.ForContext<MyBikesPage>().Error("Displaying bikes at station page failed. {Exception}", exception);
await DisplayAlert(
AppResources.ErrorPageNotLoadedTitle,
$"{AppResources.ErrorPageNotLoaded}\r\n{exception.Message}",
AppResources.MessageAnswerOk);
isInitializationStarted = false;
return;
}
InitializeComponent();
BindingContext = m_oViewModel;
MyBikesListView.ItemsSource = m_oViewModel;
await m_oViewModel.OnAppearingOrRefresh();
isInitializationStarted = false;
}
/// <summary>
/// Invoked when pages is closed/ hidden.
/// Stops update process.
/// </summary>
protected async override void OnDisappearing()
{
if (m_oViewModel == null)
{
// View model might be null (Example: Occured when page to query for location permissions was opened)
return;
}
await m_oViewModel.OnDisappearing();
}
/// <summary>
/// Displays alert message.
/// </summary>
/// <param name="p_strTitle">Title of message.</param>
/// <param name="p_strMessage">Message to display.</param>
/// <param name="p_strCancel">Type of buttons.</param>
public new async Task DisplayAlert(string p_strTitle, string p_strMessage, string p_strCancel)
=> await App.Current.MainPage.DisplayAlert(p_strTitle, p_strMessage, p_strCancel);
/// <summary> Displays alert message.</summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="details">Detailed error description.</param>
/// <param name="cancel">Type of buttons.</param>
public async Task DisplayAdvancedAlert(
string title,
string message,
string details,
string cancel)
=> await App.Current.MainPage.DisplayAlert(title, $"{message}\r\nDetails:\r\n{details}", cancel);
/// <summary> Displays detailed alert message.</summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="details">Detailed error description.</param>
/// <param name="accept">Text of accept button.</param>
/// <param name="cancel">Text of cancel button.</param>
/// <returns>True if user pressed accept.</returns>
public async Task<bool> DisplayAdvancedAlert(string title, string message, string details, string accept, string cancel)
=> await App.Current.MainPage.DisplayAlert(title, !string.IsNullOrEmpty(details) ? $"{message}\r\nDetails:\r\n{details}" : $"{message}", accept, cancel);
/// <summary>
/// Displays alert message.
/// </summary>
/// <param name="p_strTitle">Title of message.</param>
/// <param name="p_strMessage">Message to display.</param>
/// <param name="p_strAccept">Text of accept button.</param>
/// <param name="p_strCancel">Text of button.</param>
/// <returns>True if user pressed accept.</returns>
public new async Task<bool> DisplayAlert(string p_strTitle, string p_strMessage, string p_strAccept, string p_strCancel)
=> await App.Current.MainPage.DisplayAlert(p_strTitle, p_strMessage, p_strAccept, p_strCancel);
/// <summary> Shows a page.</summary>
/// <param name="route">Route of the page to show.</param>
public async Task ShowPage(string route) => await Shell.Current.GoToAsync(route);
/// <summary> Pushes a page onto the modal stack. </summary>
/// <param name="typeOfPage">Page to display.</param>
public async Task PushModalAsync(ViewTypes typeOfPage)
=> await Navigation.PushModalAsync((Page)Activator.CreateInstance(typeOfPage.GetViewType()));
/// <summary> Pops a page from the modal stack. </summary>
public Task PopModalAsync() => throw new NotSupportedException();
/// <summary> Pushes a page onto the stack. </summary>
/// <param name="p_oTypeOfPage">Page to display.</param>
public Task PushAsync(ViewTypes p_oTypeOfPage) => throw new NotSupportedException();
#if USCSHARP9
public async Task<IViewService.IUserFeedback> DisplayUserFeedbackPopup() => await Navigation.ShowPopupAsync<FeedbackPopup.Result>(new FeedbackPopup());
#else
/// <summary> Displays user feedback popup.</summary>
/// <param name="co2Saving"> Co2 saving information.</param>
/// <returns>User feedback.</returns>
public async Task<IUserFeedback> DisplayUserFeedbackPopup(IBatteryMutable battery = null) => await Navigation.ShowPopupAsync<FeedbackPopup.Result>(new FeedbackPopup(battery));
#endif
}
}

View file

@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8"?>
<Shell xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:resources="clr-namespace:ShareeBike.MultilingualResources;assembly=SharedBusinessLogic"
xmlns:mappage="clr-namespace:ShareeBike.View.Map"
xmlns:findbike="clr-namespace:ShareeBike.View.SelectBike"
xmlns:mybikes="clr-namespace:ShareeBike.View.MyBikes"
xmlns:account="clr-namespace:ShareeBike.View.Account"
xmlns:login="clr-namespace:ShareeBike.View.Login"
xmlns:settings="clr-namespace:ShareeBike.View.Settings"
xmlns:contact="clr-namespace:ShareeBike.View.Contact"
xmlns:help="clr-namespace:ShareeBike.View.Help"
xmlns:info="clr-namespace:ShareeBike.View.LegalInformation"
xmlns:header="clr-namespace:ShareeBike.View.RootShell"
xmlns:version="clr-namespace:SharedGui.View"
BackgroundColor="{DynamicResource Key=primary-back-title-color}"
Title="Shell"
x:Class="ShareeBike.View.RootShell.AppShell">
<Shell.FlyoutHeader>
<header:FlyoutHeader/>
</Shell.FlyoutHeader>
<FlyoutItem FlyoutDisplayOptions="AsMultipleItems">
<ShellContent
Title="{x:Static resources:AppResources.MarkingBikeLocations}"
Route="MapPage"
ContentTemplate="{DataTemplate mappage:MapPage}">
<ShellContent.FlyoutIcon>
<FontImageSource Glyph="{StaticResource IconMap}" Color="{DynamicResource Key=primary-back-title-color}" FontFamily="FA-S" />
</ShellContent.FlyoutIcon>
</ShellContent>
</FlyoutItem>
<FlyoutItem FlyoutDisplayOptions="AsMultipleItems">
<ShellContent
Title="{x:Static resources:AppResources.MarkingSelectBike}"
IsVisible="{Binding IsSelectBikePageVisible}"
ContentTemplate="{DataTemplate findbike:SelectBikePage}">
<ShellContent.FlyoutIcon>
<FontImageSource Glyph="{StaticResource IconSelectBike}" Color="{DynamicResource Key=primary-back-title-color}" FontFamily="FA-S" />
</ShellContent.FlyoutIcon>
</ShellContent>
</FlyoutItem>
<FlyoutItem FlyoutDisplayOptions="AsMultipleItems">
<ShellContent
Title="{x:Static resources:AppResources.MarkingMyBikes}"
IsVisible="{Binding IsMyBikesPageVisible}"
ContentTemplate="{DataTemplate mybikes:MyBikesPage}">
<ShellContent.FlyoutIcon>
<FontImageSource Glyph="{StaticResource IconMyBikes}" Color="{DynamicResource Key=primary-back-title-color}" FontFamily="FA-S" />
</ShellContent.FlyoutIcon>
</ShellContent>
</FlyoutItem>
<FlyoutItem FlyoutDisplayOptions="AsMultipleItems">
<ShellContent
Title="{x:Static resources:AppResources.MarkingAccount}"
IsVisible="{Binding IsAccountPageVisible}"
ContentTemplate="{DataTemplate account:AccountPage}">
<ShellContent.FlyoutIcon>
<FontImageSource Glyph="{StaticResource IconAccount}" Color="{DynamicResource Key=primary-back-title-color}" FontFamily="FA-S" />
</ShellContent.FlyoutIcon>
</ShellContent>
</FlyoutItem>
<FlyoutItem FlyoutDisplayOptions="AsMultipleItems">
<ShellContent
Title="{x:Static resources:AppResources.MarkingLogin}"
Route="LoginPage"
IsVisible="{Binding IsLoginPageVisible}"
ContentTemplate="{DataTemplate login:LoginPage}">
<ShellContent.FlyoutIcon>
<FontImageSource Glyph="{StaticResource IconLogin}" Color="{DynamicResource Key=primary-back-title-color}" FontFamily="FA-S" />
</ShellContent.FlyoutIcon>
</ShellContent>
</FlyoutItem>
<FlyoutItem FlyoutDisplayOptions="AsMultipleItems">
<ShellContent
Title="{x:Static resources:AppResources.MarkingContact}"
Route="ContactPage"
ContentTemplate="{DataTemplate contact:ContactPage}">
<ShellContent.FlyoutIcon>
<FontImageSource Glyph="{StaticResource IconContact}" Color="{DynamicResource Key=primary-back-title-color}" FontFamily="FA-S" />
</ShellContent.FlyoutIcon>
</ShellContent>
</FlyoutItem>
<FlyoutItem FlyoutDisplayOptions="AsMultipleItems">
<ShellContent
Title="{x:Static resources:AppResources.MarkingSettings}"
ContentTemplate="{DataTemplate settings:SettingsPage}">
<ShellContent.FlyoutIcon>
<FontImageSource Glyph="{StaticResource IconSettings}" Color="{DynamicResource Key=primary-back-title-color}" FontFamily="FA-S" />
</ShellContent.FlyoutIcon>
</ShellContent>
</FlyoutItem>
<FlyoutItem FlyoutDisplayOptions="AsMultipleItems">
<ShellContent
Title="{x:Static resources:AppResources.MarkingHelp}"
ContentTemplate="{DataTemplate help:HelpPage}">
<ShellContent.FlyoutIcon>
<FontImageSource Glyph="{StaticResource IconHelp}" Color="DimGray" FontFamily="FA-S"/>
</ShellContent.FlyoutIcon>
</ShellContent>
</FlyoutItem>
<FlyoutItem FlyoutDisplayOptions="AsMultipleItems">
<ShellContent
Title="{x:Static resources:AppResources.MarkingLegalInformation}"
ContentTemplate="{DataTemplate info:LegalInformationPage}">
<ShellContent.FlyoutIcon>
<FontImageSource Glyph="{StaticResource IconLegalInfo}" Color="DimGray" FontFamily="FA-S" />
</ShellContent.FlyoutIcon>
</ShellContent>
</FlyoutItem>
<Shell.FlyoutFooter>
<version:VersionNumberView/>
</Shell.FlyoutFooter>
</Shell>

View file

@ -0,0 +1,15 @@

using ShareeBike.ViewModel.RootShell;
using Xamarin.Forms;
namespace ShareeBike.View.RootShell
{
public partial class AppShell : Shell
{
public AppShell()
{
InitializeComponent();
BindingContext = new AppShellViewModel();
}
}
}

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
BackgroundColor="#009BDB"
x:Class="ShareeBike.View.RootShell.FlyoutHeader"
HeightRequest="195">
<Grid Padding="20">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Image
Grid.Row="0"
HeightRequest="100"
Aspect="AspectFit"
HorizontalOptions="StartAndExpand"
Source="menu_logo.png"/>
<Label
Grid.Row="1"
Text="Gefördert durch &#x0a;Bayerisches Staatsministerium für &#x0a;Wohnen, Bau und Verkehr"
TextColor="White"
FontSize="Small"/>
</Grid>
</ContentView>

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;
using Xamarin.Forms.Xaml;
namespace ShareeBike.View.RootShell
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class FlyoutHeader : ContentView
{
public FlyoutHeader()
{
InitializeComponent();
}
}
}

View file

@ -0,0 +1,226 @@
<?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:xct="http://xamarin.com/schemas/2020/toolkit"
x:Class="ShareeBike.View.SelectBike.SelectBikePage"
xmlns:conv="clr-namespace:ShareeBike.View;assembly=SharedBusinessLogic"
xmlns:resources="clr-namespace:ShareeBike.MultilingualResources;assembly=SharedBusinessLogic"
xmlns:rental_process="clr-namespace:ShareeBike.ViewModel.Bikes;assembly=SharedBusinessLogic"
xmlns:bikeRentalProcess="clr-namespace:SharedGui.View.Bike.RentalProcess"
xmlns:local_bike="clr-namespace:ShareeBike.View.Bike"
xmlns:sharedGui="clr-namespace:SharedGui.View"
BackgroundColor="{DynamicResource background-color}"
Shell.NavBarIsVisible="{Binding IsIdle}">
<Shell.TitleView>
<Grid ColumnDefinitions="Auto, 1*">
<Label Style="{StaticResource Label-Navbar}"
Text="{x:Static resources:AppResources.MarkingSelectBike}"/>
</Grid>
</Shell.TitleView>
<ContentPage.Resources>
<ResourceDictionary>
<local_bike:BikeViewCellTemplateSelector x:Key="bikeTemplateSelector"/>
<conv:StringNotNullOrEmptyToVisibleConverter x:Key="Label_Converter"/>
<xct:MultiConverter x:Key="RentalProcessToVisibleConverter">
<xct:EnumToBoolConverter>
<xct:EnumToBoolConverter.TrueValues>
<rental_process:CurrentRentalProcess>CloseLock</rental_process:CurrentRentalProcess>
<rental_process:CurrentRentalProcess>EndRental</rental_process:CurrentRentalProcess>
</xct:EnumToBoolConverter.TrueValues>
</xct:EnumToBoolConverter>
<xct:InvertedBoolConverter />
</xct:MultiConverter>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<!--Grid for Bike(s) view and Running process in same row-->
<Grid>
<!-- Grid for Content -->
<Grid
IsVisible="{Binding RentalProcess.State, Converter={StaticResource RentalProcessToVisibleConverter}}"
Grid.Row="0"
RowSpacing="0"
RowDefinitions="1*,Auto">
<StackLayout
Grid.Row="0"
Spacing="0"
Orientation="Vertical">
<StackLayout
BackgroundColor="White"
Padding="20,0,20,0">
<Grid
RowDefinitions="Auto,Auto"
ColumnDefinitions="*,Auto">
<!--Search bike-->
<Label
Grid.Column="0"
Grid.ColumnSpan="2"
Grid.Row="0"
Text="{x:Static resources:AppResources.MarkingSelectBikeLabel}"
Margin="0,5,0,-5">
</Label>
<Entry
Grid.Column="0"
Grid.Row="1"
x:Name="SelectBikeEntry"
Placeholder="{x:Static resources:AppResources.PlaceholderSelectBike}"
MaxLength="10"
CursorPosition="0"
Text="{Binding BikeIdUserInput, Mode=TwoWay}"/>
<Button
Grid.Column="1"
Grid.Row="1"
WidthRequest="100"
Text="{x:Static resources:AppResources.MarkingSelectBikeButton}"
Command="{Binding OnSelectBikeRequest}">
<Button.Triggers>
<DataTrigger TargetType="Button" Binding="{Binding IsSelectBikeEnabled}" Value="False">
<Setter Property="BorderColor" Value="DimGray" />
<Setter Property="BackgroundColor" Value="DimGray" />
<Setter Property="TextColor" Value="LightGray" />
</DataTrigger>
</Button.Triggers>
</Button>
</Grid>
<!--Line-->
<BoxView
HeightRequest="1"
WidthRequest="400"
HorizontalOptions="Center"
Color="{DynamicResource primary-back-title-color}"/>
</StackLayout>
<!--No Network Connection-->
<sharedGui:NotConnectedToNetView/>
<!--Bike data-->
<Grid
RowDefinitions="Auto,Auto"
RowSpacing="0">
<!--Hint for Outdated Data.-->
<sharedGui:HintForRefreshingPageView
Grid.Row="0"/>
<!--Bike-->
<ListView
Grid.Row="1"
x:Name="SelectBikeListView"
BackgroundColor="{DynamicResource background-color}"
SelectionMode="None"
SelectedItem="{Binding SelectedBike}"
IsEnabled="{Binding IsIdle}"
HasUnevenRows="True"
SeparatorVisibility="None"
ItemTemplate="{StaticResource bikeTemplateSelector}"
IsPullToRefreshEnabled="True"
RefreshCommand="{Binding RefreshCommand}"
IsRefreshing="{Binding IsRefreshing}"/>
</Grid>
</StackLayout>
<!--Info at End of Page-->
<StackLayout
Grid.Row="1"
Orientation="Vertical"
Spacing="0"
Padding="20,0,20,0">
<!--Info text-->
<Label
Text="{Binding StatusInfoText}"
IsVisible="{Binding Path=IsProcessWithRunningProcessView, Converter={StaticResource InvertedBoolConverter}}"
FontSize="Small"
TextColor="DimGray"
Padding="5"
HorizontalOptions="CenterAndExpand">
<Label.Triggers>
<DataTrigger
TargetType="Label"
Binding="{Binding Path=StatusInfoText.Length}" Value="0">
<Setter Property="HeightRequest" Value="0" />
</DataTrigger>
<DataTrigger
TargetType="Label"
Binding="{Binding Path=StatusInfoText}" Value="Offline.">
<Setter Property="HeightRequest" Value="0" />
</DataTrigger>
</Label.Triggers>
</Label>
<!--Login-->
<StackLayout Spacing="0">
<StackLayout.Triggers>
<DataTrigger TargetType="StackLayout"
Binding="{Binding IsLoginRequiredHintVisible}"
Value="false">
<Setter Property="HeightRequest" Value="0" />
</DataTrigger>
</StackLayout.Triggers>
<!--Line-->
<BoxView
HeightRequest="1"
WidthRequest="400"
HorizontalOptions="Center"
IsVisible="{Binding IsLoginRequiredHintVisible}"
Color="DimGray" />
<!--Login required-->
<Label
IsVisible="{Binding IsLoginRequiredHintVisible}"
TextType="Html"
TextColor="DimGray"
Text="{Binding LoginRequiredHintText}">
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding LoginRequiredHintClickedCommand}"/>
</Label.GestureRecognizers>
</Label>
</StackLayout>
</StackLayout>
</Grid>
<!--While process is running-->
<sharedGui:RunningProcessView
Grid.Row="0"
IsVisible="{Binding IsProcessWithRunningProcessView}"/>
<!--RequestBike View-->
<bikeRentalProcess:RentalProcessStartReservationOrRental
Grid.Row="0"/>
<!--OpenLock View-->
<bikeRentalProcess:RentalProcessBookedClosedOpenLock
Grid.Row="0"/>
<!--CloseLock View-->
<bikeRentalProcess:RentalProcessBookedOpenCloseLock
Grid.Row="0"/>
<!--EndRental View-->
<bikeRentalProcess:RentalProcessBookedClosedEndRental
Grid.Row="0"/>
</Grid>
</ContentPage.Content>
</ContentPage>

View file

@ -0,0 +1,183 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Serilog;
using ShareeBike.Model;
using ShareeBike.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS;
using ShareeBike.Model.Device;
using ShareeBike.MultilingualResources;
using ShareeBike.ViewModel.SelectBike;
using Xamarin.CommunityToolkit.Extensions;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace ShareeBike.View.SelectBike
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class SelectBikePage : ContentPage, IViewService
{
/// <summary> Reference to view model. </summary>
SelectBikePageViewModel m_oViewModel = null;
/// <summary>
/// Holds a value indicating whether page already subscribed to shell item changes or not.
/// </summary>
private bool _IsShellItemChangedReceived = false;
public SelectBikePage() { }
/// <summary>
/// Invoked when page is shown.
/// Starts update process.
/// </summary>
protected async override void OnAppearing()
{
if (m_oViewModel != null)
{
// No need to create view model, set binding context an items source if already done.
// If done twice tap events are fired multiple times (when hiding page using home button).
await m_oViewModel.OnAppearingOrRefresh();
return;
}
try
{
var model = App.ModelRoot;
m_oViewModel = new SelectBikePageViewModel(
model.ActiveUser,
model,
App.PermissionsService,
App.BluetoothService,
Device.RuntimePlatform,
() => model.GetIsConnected(),
(isConnected) => model.GetConnector(isConnected),
App.LocationServicesContainer.Active,
model.LocksServices.Active,
model.Stations,
model.Polling,
model.PostAction,
model.SmartDevice,
this,
(url) => DependencyService.Get<IExternalBrowserService>().OpenUrl(url))
{
IsReportLevelVerbose = model.IsReportLevelVerbose
};
}
catch (Exception exception)
{
Log.ForContext<SelectBikePage>().Error("Displaying bikes at station page failed. {Exception}", exception);
await DisplayAlert(
AppResources.ErrorPageNotLoadedTitle,
$"{AppResources.ErrorPageNotLoaded}\r\n{exception.Message}",
AppResources.MessageAnswerOk);
return;
}
InitializeComponent();
BindingContext = m_oViewModel;
SelectBikeListView.ItemsSource = m_oViewModel;
await m_oViewModel.OnAppearingOrRefresh();
}
/// <summary>
/// Invoked when page is disappearing to
/// - stop the update process
/// - to subscribe to events.
/// </summary>
protected async override void OnDisappearing()
{
if (!_IsShellItemChangedReceived && Shell.Current != null)
{
// Subscribe to events.
// Do not do this on startup because Shell.Current is null, if FindeBikePage is startup page.
Shell.Current.Navigated += (sender, e) =>
{
if (e.Source != ShellNavigationSource.ShellItemChanged)
{
// Nothing to do.
return;
}
// Reset previous user input after switch of pages to allow user to select a differnt bike if one has been selected before.
m_oViewModel.BikeIdUserInput = String.Empty;
};
}
_IsShellItemChangedReceived = true;
await (m_oViewModel?.OnDisappearing() ?? Task.CompletedTask);
}
/// <summary>
/// Displays alert message.
/// </summary>
/// <param name="p_strTitle">Title of message.</param>
/// <param name="p_strMessage">Message to display.</param>
/// <param name="p_strCancel">Type of buttons.</param>
public new async Task DisplayAlert(string p_strTitle, string p_strMessage, string p_strCancel)
=> await App.Current.MainPage.DisplayAlert(p_strTitle, p_strMessage, p_strCancel);
/// <summary> Displays alert message.</summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="details">Detailed error description.</param>
/// <param name="cancel">Type of buttons.</param>
public async Task DisplayAdvancedAlert(
string title,
string message,
string details,
string cancel)
=> await App.Current.MainPage.DisplayAlert(title, $"{message}\r\nDetails:\r\n{details}", cancel);
/// <summary> Displays detailed alert message.</summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="details">Detailed error description.</param>
/// <param name="accept">Text of accept button.</param>
/// <param name="cancel">Text of cancel button.</param>
/// <returns>True if user pressed accept.</returns>
public async Task<bool> DisplayAdvancedAlert(string title, string message, string details, string accept, string cancel)
=> await App.Current.MainPage.DisplayAlert(title, !string.IsNullOrEmpty(details) ? $"{message}\r\nDetails:\r\n{details}" : $"{message}", accept, cancel);
/// <summary>
/// Displays alert message.
/// </summary>
/// <param name="p_strTitle">Title of message.</param>
/// <param name="p_strMessage">Message to display.</param>
/// <param name="p_strAccept">Text of accept button.</param>
/// <param name="p_strCancel">Text of button.</param>
/// <returns>True if user pressed accept.</returns>
public new async Task<bool> DisplayAlert(string p_strTitle, string p_strMessage, string p_strAccept, string p_strCancel)
=> await App.Current.MainPage.DisplayAlert(p_strTitle, p_strMessage, p_strAccept, p_strCancel);
/// <summary> Shows a page.</summary>
/// <param name="route">Route of the page to show.</param>
public async Task ShowPage(string route) => await Shell.Current.GoToAsync(route);
/// <summary> Pushes a page onto the modal stack. </summary>
/// <param name="typeOfPage">Page to display.</param>
public async Task PushModalAsync(ViewTypes typeOfPage)
=> await Navigation.PushModalAsync((Page)Activator.CreateInstance(typeOfPage.GetViewType()));
/// <summary> Pops a page from the modal stack. </summary>
public Task PopModalAsync() => throw new NotSupportedException();
/// <summary> Pushes a page onto the stack. </summary>
/// <param name="p_oTypeOfPage">Page to display.</param>
public Task PushAsync(ViewTypes p_oTypeOfPage) => throw new NotSupportedException();
#if USCSHARP9
public async Task<IViewService.IUserFeedback> DisplayUserFeedbackPopup() => await Navigation.ShowPopupAsync<FeedbackPopup.Result>(new FeedbackPopup());
#else
/// <summary> Displays user feedback popup.</summary>
/// <param name="co2Saving"> Co2 saving information.</param>
/// <returns>User feedback.</returns>
public async Task<IUserFeedback> DisplayUserFeedbackPopup(IBatteryMutable battery = null) => await Navigation.ShowPopupAsync<FeedbackPopup.Result>(new FeedbackPopup(battery));
#endif
}
}

View file

@ -0,0 +1,309 @@
<?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="ShareeBike.View.Settings.SettingsPage"
xmlns:conv="clr-namespace:ShareeBike.View.Settings;assembly=SharedBusinessLogic"
xmlns:account="clr-namespace:ShareeBike.Model.User.Account;assembly=SharedBusinessLogic"
xmlns:resources="clr-namespace:ShareeBike.MultilingualResources;assembly=SharedBusinessLogic"
BackgroundColor="{DynamicResource background-color}">
<ContentPage.Resources>
<conv:BackendPermissionsToVisibleConverter x:Key="Frame_Converter"/>
<conv:PermissionToVisibleConverter x:Key="SwitchTheme_Converter" VisibleFlag="{x:Static account:Permissions.SwitchTheme}"/>
<conv:PermissionToVisibleConverter x:Key="PickCopriServer_Converter" VisibleFlag="{x:Static account:Permissions.PickCopriServer}"/>
<conv:PermissionToVisibleConverter x:Key="ManagePolling_Converter" VisibleFlag="{x:Static account:Permissions.ManagePolling}"/>
<conv:PermissionToVisibleConverter x:Key="ManageCopriCacheExpiration_Converter" VisibleFlag="{x:Static account:Permissions.ManageCopriCacheExpiration}"/>
<conv:PermissionToVisibleConverter x:Key="PickLockServiceImplementation_Converter" VisibleFlag="{x:Static account:Permissions.PickLockServiceImplementation}"/>
<conv:PermissionToVisibleConverter x:Key="PickLocationServiceImplementation_Converter" VisibleFlag="{x:Static account:Permissions.PickLocationServiceImplementation}"/>
<conv:PermissionToVisibleConverter x:Key="PickLoggingLevel_Converter" VisibleFlag="{x:Static account:Permissions.PickLoggingLevel}"/>
<conv:PermissionToVisibleConverter x:Key="ReportLevel_Converter" VisibleFlag="{x:Static account:Permissions.ReportLevel}"/>
<conv:PermissionToVisibleConverter x:Key="ShowDiagnostics_Converter" VisibleFlag="{x:Static account:Permissions.ShowDiagnostics}"/>
<conv:PermissionToVisibleConverter x:Key="SwitchSiteCaching_Converter" VisibleFlag="{x:Static account:Permissions.SwitchNoSiteCaching}"/>
</ContentPage.Resources>
<Shell.TitleView>
<Grid ColumnDefinitions="Auto, 1*">
<Label Style="{StaticResource Label-Navbar}"
Text="{x:Static resources:AppResources.MarkingSettings}"/>
</Grid>
</Shell.TitleView>
<ContentPage.Content>
<ScrollView>
<StackLayout
Spacing="0">
<Frame
Padding="10"
Margin="0,10,0,5"
HorizontalOptions="FillAndExpand"
BackgroundColor="White"
IsVisible="true">
<Grid ColumnDefinitions="*,Auto">
<Label Text="{x:Static resources:AppResources.MarkingCenterMapToCurrentPos}"/>
<Switch Grid.Column="1" IsToggled="{Binding CenterMapToCurrentLocation}"/>
</Grid>
</Frame>
<!-- Filter on view ShareeBike/ Citybike -->
<Frame
Padding="10"
Margin="0,5,0,5"
HorizontalOptions="FillAndExpand"
BackgroundColor="White"
IsVisible="{Binding IsGroupFilterVisible}">
<StackLayout>
<Label Text="{x:Static resources:AppResources.MarkingShowHideBikesOfType}"/>
<ListView
HasUnevenRows="True"
HeightRequest="120"
x:Name="Filters">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell IsEnabled="{Binding IsEnabled}">
<Grid ColumnDefinitions="*,Auto">
<Label Text="{Binding Text}"/>
<Switch Grid.Column="1" IsToggled="{Binding IsActivated}"/>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</Frame>
<!-- Picker to select startup page -->
<Frame
Padding="10"
Margin="0,5,0,5"
HorizontalOptions="FillAndExpand"
BackgroundColor="White"
IsVisible="{Binding DebugLevel, Converter={StaticResource Frame_Converter}}">
<StackLayout>
<Label Text="{x:Static resources:AppResources.MarkingStartupPage}"/>
<Picker
ItemsSource="{Binding StartupSettings.ServicesTextList}"
SelectedItem="{Binding StartupSettings.ActiveText}"/>
</StackLayout>
</Frame>
<!-- Themes -->
<Frame
Padding="10"
Margin="0,5,0,5"
HorizontalOptions="FillAndExpand"
BackgroundColor="White"
IsVisible="{Binding DebugLevel, Converter={StaticResource Frame_Converter}}">
<StackLayout>
<Label
Text="Theme"
IsVisible="{Binding DebugLevel, Converter={StaticResource SwitchTheme_Converter}}"/>
<Picker
ItemsSource="{Binding Themes.ServicesTextList}"
SelectedItem="{Binding Themes.ActiveText}"
IsVisible="{Binding DebugLevel, Converter={StaticResource SwitchTheme_Converter}}"/>
</StackLayout>
</Frame>
<!-- COPRI server selection -->
<Frame
Padding="10"
Margin="0,5,0,5"
HorizontalOptions="FillAndExpand"
BackgroundColor="White"
IsVisible="{Binding DebugLevel, Converter={StaticResource Frame_Converter}}">
<StackLayout>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource PickCopriServer_Converter}}"
Text="{Binding CopriServerUriList.CopriServerUriDescription}"/>
<Picker
IsVisible="{Binding DebugLevel, Converter={StaticResource PickCopriServer_Converter}}"
ItemsSource="{Binding CopriServerUriList.ServerTextList}"
SelectedItem="{Binding CopriServerUriList.NextActiveServerText}"/>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource ManagePolling_Converter}}"
Text="{Binding Polling.PollingText}"/>
<Switch
IsVisible="{Binding DebugLevel, Converter={StaticResource ManagePolling_Converter}}"
IsToggled="{Binding Polling.IsActivated}"/>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource ManagePolling_Converter}}"
Text="{Binding Polling.PeriodeTotalSecondsText}"/>
<Stepper
IsVisible="{Binding DebugLevel, Converter={StaticResource ManagePolling_Converter}}"
Minimum="5"
Increment="5"
Maximum="600"
IsEnabled="{Binding Polling.IsActivated}"
Value="{Binding Polling.PeriodeTotalSeconds}"/>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource ManageCopriCacheExpiration_Converter}}"
Text="Time after which COPRI-cache expires [s]"/>
<Slider
IsVisible="{Binding DebugLevel, Converter={StaticResource ManageCopriCacheExpiration_Converter}}"
x:Name="expiresAfter"
Minimum="0"
Maximum="15"
Value="{Binding ExpiresAfterTotalSeconds}"/>
<Entry
IsVisible="{Binding DebugLevel, Converter={StaticResource ManageCopriCacheExpiration_Converter}}"
IsReadOnly="True"
Text="{Binding ExpiresAfterTotalSecondsText}"/>
</StackLayout>
</Frame>
<!-- Lock control -->
<Frame
Padding="10"
Margin="0,5,0,5"
HorizontalOptions="FillAndExpand"
BackgroundColor="White"
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLockServiceImplementation_Converter}}">
<StackLayout>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLockServiceImplementation_Converter}}"
Text="{x:Static resources:AppResources.MarkingLockControl}" />
<Picker
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLockServiceImplementation_Converter}}"
ItemsSource="{Binding LocksServices.Services.ServicesTextList}"
SelectedItem="{Binding LocksServices.Services.ActiveText}"/>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLockServiceImplementation_Converter}}"
Text="Bluetooth Connect Timeout [sec]"/>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLockServiceImplementation_Converter}}"
Text="{Binding LocksServices.ConnectTimeoutSecText}"/>
<Stepper
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLockServiceImplementation_Converter}}"
Minimum="0.1"
Increment="0.25"
Maximum="60"
Value="{Binding LocksServices.ConnectTimeoutSec}"/>
</StackLayout>
</Frame>
<!-- Geolocation -->
<Frame
Padding="10"
Margin="0,5,0,5"
HorizontalOptions="FillAndExpand"
BackgroundColor="White"
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLocationServiceImplementation_Converter}}">
<StackLayout>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLocationServiceImplementation_Converter}}"
Text="{x:Static resources:AppResources.MarkingGeolocationControl}" />
<Picker
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLocationServiceImplementation_Converter}}"
ItemsSource="{Binding GeolocationServices.ServicesTextList}"
SelectedItem="{Binding GeolocationServices.ActiveText}"/>
</StackLayout>
</Frame>
<!-- Web site caching -->
<Frame
Padding="10"
Margin="0,5,0,5"
HorizontalOptions="FillAndExpand"
BackgroundColor="White"
IsVisible="{Binding DebugLevel, Converter={StaticResource SwitchSiteCaching_Converter}}">
<StackLayout>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource SwitchSiteCaching_Converter}}"
Text="{x:Static resources:AppResources.MarkingWebsiteCaching}"/>
<Switch
IsVisible="{Binding DebugLevel, Converter={StaticResource SwitchSiteCaching_Converter}}"
IsToggled="{Binding IsSiteCachingOnDisplayValue}"/>
</StackLayout>
</Frame>
<!-- Logging -->
<Frame
Padding="10"
Margin="0,5,0,5"
HorizontalOptions="FillAndExpand"
BackgroundColor="White"
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLoggingLevel_Converter}}">
<StackLayout>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLoggingLevel_Converter}}"
Text="{x:Static resources:AppResources.MarkingLoggingLevel}" />
<Picker
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLoggingLevel_Converter}}"
ItemsSource="{Binding LoggingLevels}"
SelectedItem="{Binding SelectedLoggingLevel}"/>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLoggingLevel_Converter}}"
Text="Logdatei in externen Pfad schreiben"/>
<Switch
IsVisible="{Binding DebugLevel, Converter={StaticResource PickLoggingLevel_Converter}}"
IsToggled="{Binding LogToExternalFolderDisplayValue}"
IsEnabled="{Binding IsLogToExternalFolderVisible}"/>
</StackLayout>
</Frame>
<!-- Logging -->
<Frame
Padding="10"
Margin="0,5,0,5"
HorizontalOptions="FillAndExpand"
BackgroundColor="White"
IsVisible="{Binding DebugLevel, Converter={StaticResource ReportLevel_Converter}}">
<StackLayout>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource ReportLevel_Converter}}"
Text="{x:Static resources:AppResources.MarkingVerboseErrorMessage}" />
<Switch
IsVisible="{Binding DebugLevel, Converter={StaticResource ReportLevel_Converter}}"
IsToggled="{Binding IsReportLevelVerbose}"/>
</StackLayout>
</Frame>
<!-- Display of parameters -->
<Frame
Padding="10"
Margin="0,5,0,5"
HorizontalOptions="FillAndExpand"
BackgroundColor="White"
IsVisible="{Binding DebugLevel, Converter={StaticResource ShowDiagnostics_Converter}}">
<StackLayout>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource ShowDiagnostics_Converter}}"
Text="Device Identifier" />
<Entry
IsVisible="{Binding DebugLevel, Converter={StaticResource ShowDiagnostics_Converter}}"
IsEnabled="false"
Text="{Binding DeviceIdentifier}"/>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource ShowDiagnostics_Converter}}"
Text="Copri Sitzungkeks"/>
<Entry
IsVisible="{Binding DebugLevel, Converter={StaticResource ShowDiagnostics_Converter}}"
IsEnabled="false"
Text="{Binding SessionCookie}"/>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource ShowDiagnostics_Converter}}"
Text="Interner Pfad (Einstell./ ggf. Logging)"/>
<Editor
IsVisible="{Binding DebugLevel, Converter={StaticResource ShowDiagnostics_Converter}}"
IsEnabled="false"
Text="{Binding InternalPath}"/>
<Label
IsVisible="{Binding DebugLevel, Converter={StaticResource ShowDiagnostics_Converter}}"
Text="Externer Pfad (Mock/ ggf. Logging)"/>
<Editor
IsVisible="{Binding DebugLevel, Converter={StaticResource ShowDiagnostics_Converter}}"
IsEnabled="false"
Text="{Binding ExternalPath}"/>
</StackLayout>
</Frame>
</StackLayout>
</ScrollView>
</ContentPage.Content>
</ContentPage>

View file

@ -0,0 +1,139 @@
using ShareeBike.ViewModel;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using System.Threading.Tasks;
using System;
using ShareeBike.Model.Device;
using Xamarin.CommunityToolkit.Extensions;
using ShareeBike.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS;
namespace ShareeBike.View.Settings
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class SettingsPage : ContentPage, IViewService
{
/// <summary> Refernce to view model. </summary>
SettingsPageViewModel m_oViewModel = null;
/// <summary> Constructs a settings page. </summary>
public SettingsPage()
{
InitializeComponent();
var l_oModel = App.ModelRoot;
m_oViewModel = new SettingsPageViewModel(
l_oModel,
App.LocationServicesContainer,
this);
BindingContext = m_oViewModel;
Filters.ItemsSource = m_oViewModel.GroupFilter;
}
/// <summary> Displays alert message. </summary>
/// <param name="p_strTitle">Title of message.</param>
/// <param name="p_strMessage">Message to display.</param>
/// <param name="p_strCancel">Type of buttons.</param>
public new async Task DisplayAlert(string p_strTitle, string p_strMessage, string p_strCancel)
=> await App.Current.MainPage.DisplayAlert(p_strTitle, p_strMessage, p_strCancel);
/// <summary> Displays alert message.</summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="details">Detailed error description.</param>
/// <param name="cancel">Type of buttons.</param>
public async Task DisplayAdvancedAlert(
string title,
string message,
string details,
string cancel)
=> await App.Current.MainPage.DisplayAlert(title, $"{message}\r\nDetails:\r\n{details}", cancel);
/// <summary> Displays detailed alert message.</summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="details">Detailed error description.</param>
/// <param name="accept">Text of accept button.</param>
/// <param name="cancel">Text of cancel button.</param>
/// <returns>True if user pressed accept.</returns>
public async Task<bool> DisplayAdvancedAlert(string title, string message, string details, string accept, string cancel)
=> await App.Current.MainPage.DisplayAlert(title, !string.IsNullOrEmpty(details) ? $"{message}\r\nDetails:\r\n{details}" : $"{message}", accept, cancel);
/// <summary> Displays alert message.</summary>
/// <param name="p_strTitle">Title of message.</param>
/// <param name="p_strMessage">Message to display.</param>
/// <param name="p_strAccept">Text of accept button.</param>
/// <param name="p_strCancel">Text of button.</param>
/// <returns>True if user pressed accept.</returns>
public new async Task<bool> DisplayAlert(string p_strTitle, string p_strMessage, string p_strAccept, string p_strCancel)
=> await App.Current.MainPage.DisplayAlert(p_strTitle, p_strMessage, p_strAccept, p_strCancel);
/// <summary>
/// Displays an action sheet.
/// </summary>
/// <param name="p_strTitle">Title of message.</param>
/// <param name="p_strMessage">Message to display.</param>
/// <param name="p_strCancel">Text of button.</param>
/// <param name="destruction"></param>
/// <param name="p_oButtons">Buttons holding options to select.</param>
/// <returns>Text selected</returns>
public new async Task<string> DisplayActionSheet(String p_strTitle, String p_strCancel, String destruction, params String[] p_oButtons)
=> await base.DisplayActionSheet(p_strTitle, p_strCancel, destruction, p_oButtons);
/// <summary> Shows a page.</summary>
/// <param name="route">Route of the page to show.</param>
public async Task ShowPage(string route) => await Shell.Current.GoToAsync(route);
/// <summary> Pushes a page onto the modal stack. </summary>
/// <param name="p_oTypeOfPage">Page to display.</param>
public Task PushModalAsync(ViewTypes p_oTypeOfPage)
=> throw new NotImplementedException();
/// <summary> Pops a page from the modal stack. </summary>
public Task PopModalAsync()
=> throw new NotSupportedException();
/// <summary>
/// Invoked when pages is closed/ hidden.
/// Stops update process.
/// </summary>
protected async override void OnDisappearing()
{
if (m_oViewModel == null)
{
// View model might be null.
return;
}
await m_oViewModel?.OnDisappearing();
}
/// <summary> Pushes a page onto the stack. </summary>
/// <param name="p_oTypeOfPage">Page to display.</param>
public async Task PushAsync(ViewTypes p_oTypeOfPage)
=> await Navigation.PushAsync((Page)Activator.CreateInstance(p_oTypeOfPage.GetViewType()));
#if USCSHARP9
public async Task<IViewService.IUserFeedback> DisplayUserFeedbackPopup() => await Navigation.ShowPopupAsync<FeedbackPopup.Result>(new FeedbackPopup());
#else
/// <summary> Displays user feedback popup.</summary>
/// <param name="co2Saving"> Co2 saving information.</param>
/// <returns>User feedback.</returns>
public async Task<IUserFeedback> DisplayUserFeedbackPopup(IBatteryMutable battery = null) => await Navigation.ShowPopupAsync<FeedbackPopup.Result>(new FeedbackPopup(battery));
#endif
#if USERFEEDBACKDLG_TRYOUT
public async void OnFeedbackClickedAsync(object sender, EventArgs ev)
{
var result = await DisplayUserFeedbackPopup();
DisplayAlert(
"Title",
$"Bike broken: {result.IsBikeBroken}. Message: {result.Message}.",
"OK");
}
#endif
}
}

View file

@ -0,0 +1,78 @@
using System;
using ShareeBike.View.BikesAtStation;
using ShareeBike.View.Contact;
using ShareeBike.View.CopriWebView;
using ShareeBike.View.SelectBike;
using ShareeBike.View.LegalInformation;
using ShareeBike.View.Help;
using ShareeBike.View.Login;
using ShareeBike.View.Map;
using ShareeBike.View.MiniSurvey;
using ShareeBike.View.MyBikes;
using ShareeBike.View.Settings;
using ShareeBike.View.WhatsNew;
using ShareeBike.View.WhatsNew.Gtc;
using Xamarin.Forms;
namespace ShareeBike.View
{
public static class ViewTypesTypeProvider
{
public static Type GetViewType(this ViewTypes viewType)
{
switch (viewType)
{
case ViewTypes.LoginPage:
return typeof(LoginPage);
case ViewTypes.MapPage:
return typeof(MapPage);
case ViewTypes.RegisterPage:
return typeof(RegisterPage);
case ViewTypes.PasswordForgottenPage:
return typeof(PasswordForgottenPage);
case ViewTypes.MyBikesPage:
return typeof(MyBikesPage);
case ViewTypes.SettingsPage:
return typeof(SettingsPage);
case ViewTypes.LegalInformationPage:
return typeof(LegalInformationPage);
case ViewTypes.HelpPage:
return typeof(HelpPage);
case ViewTypes.ManageAccountPage:
return typeof(ManageAccountPage);
case ViewTypes.GtcPage:
return typeof(GtcPage);
case ViewTypes.WhatsNewPage:
return typeof(WhatsNewPage);
case ViewTypes.BikesAtStation:
return typeof(BikesAtStationPage);
case ViewTypes.ContactPage:
return typeof(ContactPage);
case ViewTypes.SelectStationPage:
return typeof(SelectStationPage);
case ViewTypes.MiniSurvey:
return typeof(MiniSurveyPage);
case ViewTypes.SelectBikePage:
return typeof(SelectBikePage);
default:
return typeof(ContentPage);
}
}
}
}

View file

@ -0,0 +1,21 @@
<?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="ShareeBike.View.WhatsNew.Gtc.GtcPage">
<ContentPage.Content>
<Frame>
<StackLayout>
<WebView
HeightRequest="1000"
WidthRequest="500"
Source="{Binding GtcHtml}"/>
<Button
Text="OK"
WidthRequest="100"
Command="{Binding OnOk}"
Margin="0,0,0,3"/>
</StackLayout>
</Frame>
</ContentPage.Content>
</ContentPage>

View file

@ -0,0 +1,78 @@
using System;
using System.Globalization;
using System.Threading.Tasks;
using ShareeBike.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS;
using ShareeBike.ViewModel;
using ShareeBike.ViewModel.WhatsNew.Gtc;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace ShareeBike.View.WhatsNew.Gtc
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class GtcPage : ContentPage, IViewService
{
public GtcPage()
{
InitializeComponent();
gtcViewModel = new GtcViewModel(
App.ModelRoot.NextActiveUri.Host,
App.ModelRoot.IsSiteCachingOn,
(resourceName) => ViewModelResourceHelper.GetSource(resourceName),
this);
BindingContext = gtcViewModel;
}
/// <summary> Displays alert message.</summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="details">Detailed error description.</param>
/// <param name="cancel">Type of buttons.</param>
public async Task DisplayAdvancedAlert(
string title,
string message,
string details,
string cancel)
=> await App.Current.MainPage.DisplayAlert(title, $"{message}\r\nDetails:\r\n{details}", cancel);
/// <summary> Displays detailed alert message.</summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="details">Detailed error description.</param>
/// <param name="accept">Text of accept button.</param>
/// <param name="cancel">Text of cancel button.</param>
/// <returns>True if user pressed accept.</returns>
public async Task<bool> DisplayAdvancedAlert(string title, string message, string details, string accept, string cancel)
=> await App.Current.MainPage.DisplayAlert(title, !string.IsNullOrEmpty(details) ? $"{message}\r\nDetails:\r\n{details}" : $"{message}", accept, cancel);
/// <summary> Invoked when page is shown. </summary>
protected async override void OnAppearing()
=> await gtcViewModel.OnAppearing();
/// <summary> Reference to view model.</summary>
GtcViewModel gtcViewModel;
public async Task PopModalAsync()
=> await Navigation.PopModalAsync();
/// <summary> Pushes a page onto the stack. </summary>
/// <param name="p_oTypeOfPage">Page to display.</param>
public Task PushAsync(ViewTypes p_oTypeOfPage)
=> throw new NotImplementedException();
public Task PushModalAsync(ViewTypes p_oTypeOfPage)
=> throw new NotImplementedException();
/// <summary> Shows a page.</summary>
/// <param name="route">Route of the page to show.</param>
public async Task ShowPage(string route) => await Shell.Current.GoToAsync(route);
#if USCSHARP9
public Task<IViewService.IUserFeedback> DisplayUserFeedbackPopup() => throw new NotSupportedException();
#else
public async Task<IUserFeedback> DisplayUserFeedbackPopup(IBatteryMutable battery = null) => throw new NotSupportedException();
#endif
}
}

View file

@ -0,0 +1,44 @@
<?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="ShareeBike.View.WhatsNew.WhatsNewPage">
<ContentPage.Content>
<ScrollView>
<Frame>
<StackLayout>
<Label Text="{Binding WhatsNewTitle}"
FontSize="Large"
VerticalOptions="Start"
HorizontalOptions="CenterAndExpand" />
<Frame>
<StackLayout>
<Label
Text="{Binding WhatsNewText}"
TextType="Html"/>
<Label FormattedText="{Binding AgbChangedText}"
IsVisible="{Binding IsAgbChangedVisible}">
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding OnShowAgbTapped}"/>
</Label.GestureRecognizers>
</Label>
</StackLayout>
</Frame>
<Frame IsVisible="{Binding IsFeedbackVisible}">
<StackLayout>
<Label Text="Gibts Verbesserungsvorschläge/ Probleme mit der App?"/>
<Button Text="Verbesserungsmail schreiben"/>
<Label Text="Die App läuft rund und tut was sie soll? Über eine Bewertung würden wir uns sehr freuen!"/>
<Button Text="Bewertung abgeben"/>
</StackLayout>
</Frame>
<Button
Text="OK"
WidthRequest="100"
Command="{Binding OnOk}"
Margin="0,0,0,3"/>
</StackLayout>
</Frame>
</ScrollView>
</ContentPage.Content>
</ContentPage>

View file

@ -0,0 +1,101 @@
using System;
using System.Threading.Tasks;
using ShareeBike.Model.Bikes.BikeInfoNS.DriveNS.BatteryNS;
using ShareeBike.Model.Device;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace ShareeBike.View.WhatsNew
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class WhatsNewPage : ContentPage, IViewService
{
/// <summary> Holds a reference on the view model. </summary>
private ViewModel.WhatsNew.WhatsNewViewModel WhatsNewViewModel;
/// <summary> Constructs whats new page.</summary>
/// <param name="showMasterDetail">Action to invoke master detail page.</param>
public WhatsNewPage(Action showMasterDetail)
{
InitializeComponent();
WhatsNewViewModel = new ViewModel.WhatsNew.WhatsNewViewModel(
DependencyService.Get<IAppInfo>().Version,
App.ModelRoot.WhatsNew.WhatsNewText,
App.ModelRoot.WhatsNew.IsShowAgbRequired,
showMasterDetail,
this);
BindingContext = WhatsNewViewModel;
}
/// <summary> Displays alert message.</summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="details">Detailed error description.</param>
/// <param name="cancel">Type of buttons.</param>
public async Task DisplayAdvancedAlert(
string title,
string message,
string details,
string cancel)
=> await App.Current.MainPage.DisplayAlert(title, $"{message}\r\nDetails:\r\n{details}", cancel);
/// <summary> Displays detailed alert message.</summary>
/// <param name="title">Title of message.</param>
/// <param name="message">Message to display.</param>
/// <param name="details">Detailed error description.</param>
/// <param name="accept">Text of accept button.</param>
/// <param name="cancel">Text of cancel button.</param>
/// <returns>True if user pressed accept.</returns>
public async Task<bool> DisplayAdvancedAlert(string title, string message, string details, string accept, string cancel)
=> await App.Current.MainPage.DisplayAlert(title, !string.IsNullOrEmpty(details) ? $"{message}\r\nDetails:\r\n{details}" : $"{message}", accept, cancel);
public Task PopModalAsync()
{
throw new NotImplementedException(); ;
}
/// <summary> Pushes a page onto the stack. </summary>
/// <param name="p_oTypeOfPage">Page to display.</param>
public Task PushAsync(ViewTypes p_oTypeOfPage)
{
throw new NotImplementedException();
}
public async Task PushModalAsync(ViewTypes p_oTypeOfPage)
{
await Navigation.PushModalAsync((Page)Activator.CreateInstance(p_oTypeOfPage.GetViewType()));
}
/// <summary> Shows a page.</summary>
/// <param name="route">Route of the page to show.</param>
public async Task ShowPage(string route) => await Shell.Current.GoToAsync(route);
#if USCSHARP9
public Task<IViewService.IUserFeedback> DisplayUserFeedbackPopup() => throw new NotSupportedException();
#else
public async Task<IUserFeedback> DisplayUserFeedbackPopup(IBatteryMutable battery = null) => throw new NotSupportedException();
#endif
/// <summary>
/// Invoked when pages is closed/ hidden.
/// /// </summary>
protected override void OnDisappearing()
{
base.OnDisappearing();
if (WhatsNewViewModel == null)
{
// View model might be null.
return;
}
WhatsNewViewModel?.OnDisappearing(() =>
{
App.ModelRoot.WhatsNew.WasShownInCurrentSession = true;
App.ModelRoot.Save();
});
}
}
}

View file

@ -0,0 +1,62 @@
using System.ComponentModel;
using ShareeBike.MultilingualResources;
using ShareeBike.Services;
using ShareeBike.Services.CopriApi.ServerUris;
using ShareeBike.View.Themes;
using ShareeBike.ViewModel.LegalInformation;
namespace ShareeBike.ViewModel.RootShell
{
public class AppShellViewModel : INotifyPropertyChanged
{
public AppShellViewModel()
{
App.ModelRoot.ActiveUser.StateChanged += (sender, eventargs) =>
{
// Login state changed. Update related menu entries.
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsMyBikesPageVisible)));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsAccountPageVisible)));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsLoginPageVisible)));
};
// Update flyout view model whenever theme is switched.
App.ModelRoot.Themes.PropertyChanged += (sender, eventargs) =>
{
if (!(sender is ServicesContainerMutableT<object> themes))
return;
MasterDetailMenuTitle = GetMasterDetailMenuTitle(themes.Active);
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(MasterDetailMenuTitle)));
};
MasterDetailMenuTitle = GetMasterDetailMenuTitle(App.ModelRoot.Themes.Active);
}
/// <summary>
/// Gets the flyout title from theme name
/// </summary>
/// <param name="theme">Name of theme.</param>
/// <returns>Flyout title.</returns>
private string GetMasterDetailMenuTitle(object theme)
{
if (!(theme is ITheme active))
return ShareeBike.Themes.ShareeBike.OPERATORINFO;
return $"{(!string.IsNullOrEmpty(active.OperatorInfo) ? ($"{active.OperatorInfo}") : "sharee.bike")}";
}
/// <summary>
/// Holds the title of the flyout page.
/// </summary>
public string MasterDetailMenuTitle { get; private set; }
public event PropertyChangedEventHandler PropertyChanged;
public bool IsMyBikesPageVisible => App.ModelRoot.ActiveUser.IsLoggedIn;
public bool IsAccountPageVisible => App.ModelRoot.ActiveUser.IsLoggedIn;
public bool IsLoginPageVisible => !App.ModelRoot.ActiveUser.IsLoggedIn;
}
}

View file

@ -0,0 +1,42 @@
using System.IO;
using System.Reflection;
using System.Text;
using Serilog;
namespace ShareeBike.ViewModel
{
public static class ViewModelResourceHelper
{
/// <summary> Get resource prefix depending on platform.</summary>
public static string ResourcePrefix
{
get
{
#if __IOS__
return "ShareeBike.iOS.";
#endif
#if __ANDROID__
return "ShareeBike.Droid.";
#endif
#if WINDOWS_UWP
return "ShareeBike.WinPhone.";
#endif
}
}
/// <summary> Gets an embedded html resource.</summary>
/// <param name="resrouceName">Name of resource to get.</param>
/// <returns></returns>
public static string GetSource(string resrouceName)
{
var resourceName = ResourcePrefix + resrouceName;
Log.Verbose($"Using this resource prefix {ResourcePrefix}.");
// note that the prefix includes the trailing period '.' that is required
var assembly = typeof(ViewModelResourceHelper).GetTypeInfo().Assembly;
var stream = assembly.GetManifestResourceStream(resourceName);
return stream != null
? (new StreamReader(stream, Encoding.UTF8)).ReadToEnd()
: string.Format("<!DOCTYPE html><html lang=\"de\"><body>An error occurred loading html- resource {0}.</body>", resourceName);
}
}
}