Merge branch 'API_GiveBack' into 'master'

Update master to pre-alpha

See merge request fabinfra/fabaccess/borepin!9
This commit is contained in:
TheJoKlLa 2021-09-07 12:30:54 +00:00
commit 81bdc4a8ac
143 changed files with 1593 additions and 7574 deletions

3
.gitmodules vendored
View File

@ -4,3 +4,6 @@
[submodule "external/SASL"]
path = external/SASL
url = https://github.com/kjkriegel/S22.Sasl.git
[submodule "external/NFC"]
path = external/NFC
url = https://gitlab.com/fabinfra/fabaccess/nfc.git

View File

@ -15,16 +15,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Borepin.GTK", "Borepin\Bore
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Borepin.macOS", "Borepin\Borepin.macOS\Borepin.macOS.csproj", "{3EC23FE7-395E-4BBC-B56B-9455354BDA34}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NFC_Test", "NFC_Test\NFC_Test.csproj", "{41EC0C17-B456-42AE-89F2-79DDB8ED9858}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NFC", "NFC\NFC.csproj", "{9C2ED2EB-D91C-4D80-9580-6A135C05AF11}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FabAccessAPI", "FabAccessAPI\FabAccessAPI.csproj", "{3251FCE9-FEA3-4662-8BEB-636BE6732D48}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "S22.Sasl", "external\SASL\S22.Sasl.csproj", "{7FEC3D5E-C240-41B6-BBFA-895C4F4D45CA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FabAccessAPI_Test", "FabAccessAPI_Test\FabAccessAPI_Test.csproj", "{1C85978A-9FC0-4064-8399-FA2455C5EC2A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NFC", "external\NFC\NFC\NFC.csproj", "{D53A98E8-48B5-4DCE-A98E-4623EE746E16}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -233,54 +231,6 @@ Global
{3EC23FE7-395E-4BBC-B56B-9455354BDA34}.Release|x64.Build.0 = Release|Any CPU
{3EC23FE7-395E-4BBC-B56B-9455354BDA34}.Release|x86.ActiveCfg = Release|Any CPU
{3EC23FE7-395E-4BBC-B56B-9455354BDA34}.Release|x86.Build.0 = Release|Any CPU
{41EC0C17-B456-42AE-89F2-79DDB8ED9858}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{41EC0C17-B456-42AE-89F2-79DDB8ED9858}.Debug|Any CPU.Build.0 = Debug|Any CPU
{41EC0C17-B456-42AE-89F2-79DDB8ED9858}.Debug|ARM.ActiveCfg = Debug|Any CPU
{41EC0C17-B456-42AE-89F2-79DDB8ED9858}.Debug|ARM.Build.0 = Debug|Any CPU
{41EC0C17-B456-42AE-89F2-79DDB8ED9858}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{41EC0C17-B456-42AE-89F2-79DDB8ED9858}.Debug|iPhone.Build.0 = Debug|Any CPU
{41EC0C17-B456-42AE-89F2-79DDB8ED9858}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{41EC0C17-B456-42AE-89F2-79DDB8ED9858}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{41EC0C17-B456-42AE-89F2-79DDB8ED9858}.Debug|x64.ActiveCfg = Debug|Any CPU
{41EC0C17-B456-42AE-89F2-79DDB8ED9858}.Debug|x64.Build.0 = Debug|Any CPU
{41EC0C17-B456-42AE-89F2-79DDB8ED9858}.Debug|x86.ActiveCfg = Debug|Any CPU
{41EC0C17-B456-42AE-89F2-79DDB8ED9858}.Debug|x86.Build.0 = Debug|Any CPU
{41EC0C17-B456-42AE-89F2-79DDB8ED9858}.Release|Any CPU.ActiveCfg = Release|Any CPU
{41EC0C17-B456-42AE-89F2-79DDB8ED9858}.Release|Any CPU.Build.0 = Release|Any CPU
{41EC0C17-B456-42AE-89F2-79DDB8ED9858}.Release|ARM.ActiveCfg = Release|Any CPU
{41EC0C17-B456-42AE-89F2-79DDB8ED9858}.Release|ARM.Build.0 = Release|Any CPU
{41EC0C17-B456-42AE-89F2-79DDB8ED9858}.Release|iPhone.ActiveCfg = Release|Any CPU
{41EC0C17-B456-42AE-89F2-79DDB8ED9858}.Release|iPhone.Build.0 = Release|Any CPU
{41EC0C17-B456-42AE-89F2-79DDB8ED9858}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{41EC0C17-B456-42AE-89F2-79DDB8ED9858}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{41EC0C17-B456-42AE-89F2-79DDB8ED9858}.Release|x64.ActiveCfg = Release|Any CPU
{41EC0C17-B456-42AE-89F2-79DDB8ED9858}.Release|x64.Build.0 = Release|Any CPU
{41EC0C17-B456-42AE-89F2-79DDB8ED9858}.Release|x86.ActiveCfg = Release|Any CPU
{41EC0C17-B456-42AE-89F2-79DDB8ED9858}.Release|x86.Build.0 = Release|Any CPU
{9C2ED2EB-D91C-4D80-9580-6A135C05AF11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C2ED2EB-D91C-4D80-9580-6A135C05AF11}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C2ED2EB-D91C-4D80-9580-6A135C05AF11}.Debug|ARM.ActiveCfg = Debug|Any CPU
{9C2ED2EB-D91C-4D80-9580-6A135C05AF11}.Debug|ARM.Build.0 = Debug|Any CPU
{9C2ED2EB-D91C-4D80-9580-6A135C05AF11}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{9C2ED2EB-D91C-4D80-9580-6A135C05AF11}.Debug|iPhone.Build.0 = Debug|Any CPU
{9C2ED2EB-D91C-4D80-9580-6A135C05AF11}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{9C2ED2EB-D91C-4D80-9580-6A135C05AF11}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{9C2ED2EB-D91C-4D80-9580-6A135C05AF11}.Debug|x64.ActiveCfg = Debug|Any CPU
{9C2ED2EB-D91C-4D80-9580-6A135C05AF11}.Debug|x64.Build.0 = Debug|Any CPU
{9C2ED2EB-D91C-4D80-9580-6A135C05AF11}.Debug|x86.ActiveCfg = Debug|Any CPU
{9C2ED2EB-D91C-4D80-9580-6A135C05AF11}.Debug|x86.Build.0 = Debug|Any CPU
{9C2ED2EB-D91C-4D80-9580-6A135C05AF11}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C2ED2EB-D91C-4D80-9580-6A135C05AF11}.Release|Any CPU.Build.0 = Release|Any CPU
{9C2ED2EB-D91C-4D80-9580-6A135C05AF11}.Release|ARM.ActiveCfg = Release|Any CPU
{9C2ED2EB-D91C-4D80-9580-6A135C05AF11}.Release|ARM.Build.0 = Release|Any CPU
{9C2ED2EB-D91C-4D80-9580-6A135C05AF11}.Release|iPhone.ActiveCfg = Release|Any CPU
{9C2ED2EB-D91C-4D80-9580-6A135C05AF11}.Release|iPhone.Build.0 = Release|Any CPU
{9C2ED2EB-D91C-4D80-9580-6A135C05AF11}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{9C2ED2EB-D91C-4D80-9580-6A135C05AF11}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{9C2ED2EB-D91C-4D80-9580-6A135C05AF11}.Release|x64.ActiveCfg = Release|Any CPU
{9C2ED2EB-D91C-4D80-9580-6A135C05AF11}.Release|x64.Build.0 = Release|Any CPU
{9C2ED2EB-D91C-4D80-9580-6A135C05AF11}.Release|x86.ActiveCfg = Release|Any CPU
{9C2ED2EB-D91C-4D80-9580-6A135C05AF11}.Release|x86.Build.0 = Release|Any CPU
{3251FCE9-FEA3-4662-8BEB-636BE6732D48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3251FCE9-FEA3-4662-8BEB-636BE6732D48}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3251FCE9-FEA3-4662-8BEB-636BE6732D48}.Debug|ARM.ActiveCfg = Debug|Any CPU
@ -353,6 +303,30 @@ Global
{1C85978A-9FC0-4064-8399-FA2455C5EC2A}.Release|x64.Build.0 = Release|Any CPU
{1C85978A-9FC0-4064-8399-FA2455C5EC2A}.Release|x86.ActiveCfg = Release|Any CPU
{1C85978A-9FC0-4064-8399-FA2455C5EC2A}.Release|x86.Build.0 = Release|Any CPU
{D53A98E8-48B5-4DCE-A98E-4623EE746E16}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D53A98E8-48B5-4DCE-A98E-4623EE746E16}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D53A98E8-48B5-4DCE-A98E-4623EE746E16}.Debug|ARM.ActiveCfg = Debug|Any CPU
{D53A98E8-48B5-4DCE-A98E-4623EE746E16}.Debug|ARM.Build.0 = Debug|Any CPU
{D53A98E8-48B5-4DCE-A98E-4623EE746E16}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{D53A98E8-48B5-4DCE-A98E-4623EE746E16}.Debug|iPhone.Build.0 = Debug|Any CPU
{D53A98E8-48B5-4DCE-A98E-4623EE746E16}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{D53A98E8-48B5-4DCE-A98E-4623EE746E16}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{D53A98E8-48B5-4DCE-A98E-4623EE746E16}.Debug|x64.ActiveCfg = Debug|Any CPU
{D53A98E8-48B5-4DCE-A98E-4623EE746E16}.Debug|x64.Build.0 = Debug|Any CPU
{D53A98E8-48B5-4DCE-A98E-4623EE746E16}.Debug|x86.ActiveCfg = Debug|Any CPU
{D53A98E8-48B5-4DCE-A98E-4623EE746E16}.Debug|x86.Build.0 = Debug|Any CPU
{D53A98E8-48B5-4DCE-A98E-4623EE746E16}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D53A98E8-48B5-4DCE-A98E-4623EE746E16}.Release|Any CPU.Build.0 = Release|Any CPU
{D53A98E8-48B5-4DCE-A98E-4623EE746E16}.Release|ARM.ActiveCfg = Release|Any CPU
{D53A98E8-48B5-4DCE-A98E-4623EE746E16}.Release|ARM.Build.0 = Release|Any CPU
{D53A98E8-48B5-4DCE-A98E-4623EE746E16}.Release|iPhone.ActiveCfg = Release|Any CPU
{D53A98E8-48B5-4DCE-A98E-4623EE746E16}.Release|iPhone.Build.0 = Release|Any CPU
{D53A98E8-48B5-4DCE-A98E-4623EE746E16}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{D53A98E8-48B5-4DCE-A98E-4623EE746E16}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{D53A98E8-48B5-4DCE-A98E-4623EE746E16}.Release|x64.ActiveCfg = Release|Any CPU
{D53A98E8-48B5-4DCE-A98E-4623EE746E16}.Release|x64.Build.0 = Release|Any CPU
{D53A98E8-48B5-4DCE-A98E-4623EE746E16}.Release|x86.ActiveCfg = Release|Any CPU
{D53A98E8-48B5-4DCE-A98E-4623EE746E16}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -34,7 +34,7 @@
<AndroidLinkMode>None</AndroidLinkMode>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugSymbols>false</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
@ -42,6 +42,14 @@
<WarningLevel>4</WarningLevel>
<AndroidManagedSymbols>true</AndroidManagedSymbols>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
<MandroidI18n />
<AndroidKeyStore>false</AndroidKeyStore>
<AndroidSigningKeyStore>
</AndroidSigningKeyStore>
<AndroidSigningStorePass>
</AndroidSigningStorePass>
<AndroidCreatePackagePerAbi>true</AndroidCreatePackagePerAbi>
</PropertyGroup>
<ItemGroup>
<Reference Include="Mono.Android" />
@ -56,14 +64,17 @@
<PackageReference Include="Prism.DryIoc.Forms">
<Version>7.2.0.1422</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms" Version="4.7.0.1351" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2012" />
<PackageReference Include="Xamarin.Essentials" Version="1.5.3.2" />
</ItemGroup>
<ItemGroup>
<Compile Include="MainActivity.cs" />
<Compile Include="MainApplication.cs" />
<Compile Include="PlatformInitializer.cs" />
<Compile Include="Resources\Resource.designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\PreferenceService.cs" />
<Compile Include="Services\SecretService.cs" />
<Compile Include="SplashActivity.cs" />
</ItemGroup>
<ItemGroup>

View File

@ -16,7 +16,7 @@ namespace Borepin.Droid
base.OnCreate(savedInstanceState);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
LoadApplication(new App());
LoadApplication(new App(new PlatformInitializer()));
}
}
}

View File

@ -0,0 +1,16 @@
using Borepin.Droid.Services;
using Borepin.Service;
using Prism;
using Prism.Ioc;
namespace Borepin.Droid
{
public class PlatformInitializer : IPlatformInitializer
{
public void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.Register<IPreferenceService, PreferenceService>();
containerRegistry.Register<ISecretService, SecretService>();
}
}
}

View File

@ -27,3 +27,10 @@ using Android.App;
// Add some common permissions, these can be removed if not needed
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
//#if DEBUG
//[assembly: Application(Debuggable=true)]
//#else
//[assembly: Application(Debuggable = false)]
//#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,33 @@
using Borepin.Service;
using Xamarin.Essentials;
namespace Borepin.Droid.Services
{
public class PreferenceService : IPreferenceService
{
public void Clear()
{
Preferences.Clear();
}
public bool ContainsKey(string key)
{
return Preferences.ContainsKey(key);
}
public string Get(string key, string defaultValue)
{
return Preferences.Get(key, defaultValue);
}
public void Remove(string key)
{
Preferences.Remove(key);
}
public void Set(string key, string value)
{
Preferences.Set(key, value);
}
}
}

View File

@ -0,0 +1,29 @@
using Borepin.Service;
using System.Threading.Tasks;
using Xamarin.Essentials;
namespace Borepin.Droid.Services
{
public class SecretService : ISecretService
{
public Task<string> GetAsync(string key)
{
return SecureStorage.GetAsync(key);
}
public bool Remove(string key)
{
return SecureStorage.Remove(key);
}
public void RemoveAll()
{
SecureStorage.RemoveAll();
}
public Task SetAsync(string key, string value)
{
return SecureStorage.SetAsync(key, value);
}
}
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\Xamarin.Forms.4.7.0.1351\build\Xamarin.Forms.props" Condition="Exists('..\..\packages\Xamarin.Forms.4.7.0.1351\build\Xamarin.Forms.props')" />
<Import Project="..\..\packages\Xamarin.Forms.5.0.0.2012\build\Xamarin.Forms.props" Condition="Exists('..\..\packages\Xamarin.Forms.5.0.0.2012\build\Xamarin.Forms.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -90,22 +90,23 @@
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="webkit-sharp, Version=1.1.15.0, Culture=neutral, PublicKeyToken=eaa1d335d2e19745, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.Platform.GTK.4.7.0.1351\lib\net45\webkit-sharp.dll</HintPath>
<HintPath>..\..\packages\Xamarin.Forms.Platform.GTK.5.0.0.2012\lib\net45\webkit-sharp.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.4.7.0.1351\lib\netstandard2.0\Xamarin.Forms.Core.dll</HintPath>
<HintPath>..\..\packages\Xamarin.Forms.5.0.0.2012\lib\netstandard2.0\Xamarin.Forms.Core.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.4.7.0.1351\lib\netstandard2.0\Xamarin.Forms.Platform.dll</HintPath>
<HintPath>..\..\packages\Xamarin.Forms.5.0.0.2012\lib\netstandard2.0\Xamarin.Forms.Platform.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform.GTK, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.Platform.GTK.4.7.0.1351\lib\net45\Xamarin.Forms.Platform.GTK.dll</HintPath>
<HintPath>..\..\packages\Xamarin.Forms.Platform.GTK.5.0.0.2012\lib\net45\Xamarin.Forms.Platform.GTK.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.4.7.0.1351\lib\netstandard2.0\Xamarin.Forms.Xaml.dll</HintPath>
<HintPath>..\..\packages\Xamarin.Forms.5.0.0.2012\lib\netstandard2.0\Xamarin.Forms.Xaml.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="PlatformInitializer.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
@ -124,10 +125,10 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Xamarin.Forms.4.7.0.1351\build\Xamarin.Forms.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.4.7.0.1351\build\Xamarin.Forms.props'))" />
<Error Condition="!Exists('..\..\packages\Xamarin.Forms.4.7.0.1351\build\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.4.7.0.1351\build\Xamarin.Forms.targets'))" />
<Error Condition="!Exists('..\..\packages\Xamarin.Forms.5.0.0.2012\build\Xamarin.Forms.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.5.0.0.2012\build\Xamarin.Forms.props'))" />
<Error Condition="!Exists('..\..\packages\Xamarin.Forms.5.0.0.2012\build\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.5.0.0.2012\build\Xamarin.Forms.targets'))" />
</Target>
<Import Project="..\..\packages\Xamarin.Forms.4.7.0.1351\build\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.4.7.0.1351\build\Xamarin.Forms.targets')" />
<Import Project="..\..\packages\Xamarin.Forms.5.0.0.2012\build\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.5.0.0.2012\build\Xamarin.Forms.targets')" />
</Project>

View File

@ -0,0 +1,13 @@
using Prism;
using Prism.Ioc;
namespace Borepin.GTK
{
public class PlatformInitializer : IPlatformInitializer
{
public void RegisterTypes(IContainerRegistry containerRegistry)
{
}
}
}

View File

@ -1,9 +1,8 @@
using Borepin;
using System;
using System;
using Xamarin.Forms;
using Xamarin.Forms.Platform.GTK;
namespace GameOfLife.GTK
namespace Borepin.GTK
{
class MainClass
{
@ -13,10 +12,9 @@ namespace GameOfLife.GTK
Gtk.Application.Init();
Forms.Init();
var app = new App();
var window = new FormsWindow();
window.LoadApplication(app);
window.SetApplicationTitle("Game of Life");
window.LoadApplication(new App(new PlatformInitializer()));
window.SetApplicationTitle("FabAccess");
window.Show();
Gtk.Application.Run();

View File

@ -5,6 +5,6 @@
<package id="Prism.Core" version="8.0.0.1909" targetFramework="net472" />
<package id="Prism.DryIoc.Forms" version="7.2.0.1422" targetFramework="net48" />
<package id="Prism.Forms" version="7.2.0.1422" targetFramework="net48" />
<package id="Xamarin.Forms" version="4.7.0.1351" targetFramework="net48" />
<package id="Xamarin.Forms.Platform.GTK" version="4.7.0.1351" targetFramework="net48" />
<package id="Xamarin.Forms" version="5.0.0.2012" targetFramework="net48" />
<package id="Xamarin.Forms.Platform.GTK" version="5.0.0.2012" targetFramework="net48" />
</packages>

View File

@ -95,7 +95,10 @@
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="PlatformInitializer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\PreferenceService.cs" />
<Compile Include="Services\SecretService.cs" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
@ -174,8 +177,8 @@
<PackageReference Include="Prism.DryIoc.Forms">
<Version>7.2.0.1422</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms" Version="4.7.0.1351" />
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.2.11" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2012" />
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.2.12" />
<PackageReference Include="Xamarin.Essentials" Version="1.5.3.2" />
</ItemGroup>
<ItemGroup>

View File

@ -6,7 +6,7 @@
{
this.InitializeComponent();
LoadApplication(new Borepin.App());
LoadApplication(new Borepin.App(new PlatformInitializer()));
}
}
}

View File

@ -35,7 +35,7 @@
DisplayName="Borepin.UWP"
Square150x150Logo="Assets\Square150x150Logo.png"
Square44x44Logo="Assets\Square44x44Logo.png"
Description="Borepin.UWP" BackgroundColor="#3c474d">
Description="Borepin.UWP" BackgroundColor="#3C474D">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" Square310x310Logo="Assets\LargeTile.png" Square71x71Logo="Assets\SmallTile.png" ShortName="FabAccess">
<uap:ShowNameOnTiles>
<uap:ShowOn Tile="square150x150Logo" />
@ -43,7 +43,7 @@
<uap:ShowOn Tile="square310x310Logo" />
</uap:ShowNameOnTiles>
</uap:DefaultTile>
<uap:SplashScreen Image="Assets\SplashScreen.png" BackgroundColor="#3c474d"/>
<uap:SplashScreen Image="Assets\SplashScreen.png" BackgroundColor="#3C474D"/>
<uap:LockScreen BadgeLogo="Assets\BadgeLogo.png" Notification="badgeAndTileText"/>
<uap:InitialRotationPreference>
<uap:Rotation Preference="landscape"/></uap:InitialRotationPreference>

View File

@ -0,0 +1,16 @@
using Borepin.UWP.Services;
using Borepin.Service;
using Prism;
using Prism.Ioc;
namespace Borepin.UWP
{
public class PlatformInitializer : IPlatformInitializer
{
public void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.Register<IPreferenceService, PreferenceService>();
containerRegistry.Register<ISecretService, SecretService>();
}
}
}

View File

@ -0,0 +1,33 @@
using Borepin.Service;
using Xamarin.Essentials;
namespace Borepin.UWP.Services
{
public class PreferenceService : IPreferenceService
{
public void Clear()
{
Preferences.Clear();
}
public bool ContainsKey(string key)
{
return Preferences.ContainsKey(key);
}
public string Get(string key, string defaultValue)
{
return Preferences.Get(key, defaultValue);
}
public void Remove(string key)
{
Preferences.Remove(key);
}
public void Set(string key, string value)
{
Preferences.Set(key, value);
}
}
}

View File

@ -0,0 +1,29 @@
using Borepin.Service;
using System.Threading.Tasks;
using Xamarin.Essentials;
namespace Borepin.UWP.Services
{
public class SecretService : ISecretService
{
public Task<string> GetAsync(string key)
{
return SecureStorage.GetAsync(key);
}
public bool Remove(string key)
{
return SecureStorage.Remove(key);
}
public void RemoveAll()
{
SecureStorage.RemoveAll();
}
public Task SetAsync(string key, string value)
{
return SecureStorage.SetAsync(key, value);
}
}
}

View File

@ -1,5 +1,4 @@

using Foundation;
using Foundation;
using UIKit;
namespace Borepin.iOS
@ -20,7 +19,7 @@ namespace Borepin.iOS
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
LoadApplication(new App(new PlatformInitializer()));
return base.FinishedLaunching(app, options);
}

View File

@ -74,12 +74,12 @@
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="Services\PreferenceService.cs" />
<Compile Include="Services\SecretService.cs" />
<None Include="Entitlements.plist" />
<None Include="Info.plist" />
<Compile Include="PlatformInitializer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="CNFC\Card.cs" />
<Compile Include="CNFC\Hardware.cs" />
<Compile Include="CNFC\Reader.cs" />
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="Resources\LaunchScreen.storyboard" />
@ -179,7 +179,7 @@
</PackageReference>
<PackageReference Include="Xamarin.Essentials" Version="1.5.3.2" />
<PackageReference Include="Xamarin.Forms">
<Version>4.7.0.1351</Version>
<Version>5.0.0.2012</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
@ -188,10 +188,6 @@
<Project>{F93856BD-0C8D-4469-A8DB-6E513002BFD7}</Project>
<Name>Borepin</Name>
</ProjectReference>
<ProjectReference Include="..\..\NFC\NFC.csproj">
<Project>{9C2ED2EB-D91C-4D80-9580-6A135C05AF11}</Project>
<Name>NFC</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Assets.xcassets\LaunchIcon.imageset\" />

View File

@ -1,67 +0,0 @@
//using System;
//using System.Threading;
//using CoreNFC;
//using Foundation;
//using NFC;
//using NFC.ISO7816_4;
//namespace Borepin.iOS.CNFC
//{
// public class Card : ICard
// {
// private NFCTagReaderSession _session;
// private INFCMiFareTag _tag;
// public Card(NFCTagReaderSession session, INFCMiFareTag tag)
// {
// _session = session;
// _tag = tag;
// }
// public void Connect()
// {
// var counter = new CountdownEvent(1);
// NSError err = null;
// _session.ConnectTo(_tag, (error) =>
// {
// err = error;
// counter.Signal();
// });
// counter.Wait();
// if (err != null)
// {
// throw new Exception(err.LocalizedDescription);
// }
// }
// public void Disconnect()
// {
// // TODO: decide on which should be used
// //_session.RestartPolling();
// _session.InvalidateSession("card disconnect");
// }
// public APDUResponse Transmit(APDUCommand cmd)
// {
// var counter = new CountdownEvent(1);
// byte[] buf = null;
// _tag.SendMiFareIso7816Command(new NFCIso7816Apdu(NSData.FromArray(cmd.Data)), (response, sw1, sw2, NSError) =>
// {
// // reassembly the original apdu message
// buf = new byte[response.Length + 2];
// response.ToArray().CopyTo(buf, 0);
// buf[response.Length + 0] = sw1;
// buf[response.Length + 1] = sw2;
// counter.Signal();
// });
// counter.Wait();
// return new APDUResponse(buf);
// }
// }
//}

View File

@ -1,24 +0,0 @@
//using System;
//using CoreNFC;
//using NFC;
//namespace Borepin.iOS.CNFC
//{
// public class Hardware : IHardware
// {
// public bool IsAvailable()
// {
// return NFCReaderSession.ReadingAvailable;
// }
// public String[] GetReaders()
// {
// return new String[] { "main" };
// }
// public IReader OpenReader(String readerID)
// {
// return new Reader();
// }
// }
//}

View File

@ -1,66 +0,0 @@
//using System;
//using CoreFoundation;
//using CoreNFC;
//using Foundation;
//using NFC;
//namespace Borepin.iOS.CNFC
//{
// public class Reader : NFCTagReaderSessionDelegate, IReader
// {
// public event ReaderEventHandler CardDiscovered;
// public event ReaderEventHandler CardLost;
// private NFCReaderSession _session = null;
// private DispatchQueue _queue;
// public void Start()
// {
// _queue = new DispatchQueue("NFC Reader Queue", true);
// // sessions cannot be reused
// _session = new NFCTagReaderSession(NFCPollingOption.Iso14443, this, _queue)
// {
// AlertMessage = "TODO",
// };
// if (_session == null)
// {
// Console.WriteLine("Oh no! The session is null!");
// }
// _session.BeginSession();
// }
// public void Stop()
// {
// _session?.InvalidateSession();
// _session = null;
// }
// public override void DidDetectTags(NFCTagReaderSession session, INFCTag[] tags)
// {
// Console.WriteLine("Did detect tags");
// Console.WriteLine(tags[0].Type);
// //INFCIso7816Tag tag = tags[0].GetNFCIso7816Tag();
// INFCMiFareTag tag = tags[0].GetNFCMiFareTag();
// if (tag != null)
// {
// Console.WriteLine("Card ist valid");
// CardDiscovered?.Invoke(this, new Card(session, tag));
// }
// else
// {
// Console.WriteLine("Card is not ISO7816");
// }
// }
// public override void DidInvalidate(NFCTagReaderSession session, NSError error)
// {
// // TODO: decide what to do
// Console.WriteLine("reader session invalidated");
// }
// }
//}

View File

@ -0,0 +1,16 @@
using Borepin.iOS.Services;
using Borepin.Service;
using Prism;
using Prism.Ioc;
namespace Borepin.iOS
{
public class PlatformInitializer : IPlatformInitializer
{
public void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.Register<IPreferenceService, PreferenceService>();
containerRegistry.Register<ISecretService, SecretService>();
}
}
}

View File

@ -0,0 +1,33 @@
using Borepin.Service;
using Xamarin.Essentials;
namespace Borepin.iOS.Services
{
public class PreferenceService : IPreferenceService
{
public void Clear()
{
Preferences.Clear();
}
public bool ContainsKey(string key)
{
return Preferences.ContainsKey(key);
}
public string Get(string key, string defaultValue)
{
return Preferences.Get(key, defaultValue);
}
public void Remove(string key)
{
Preferences.Remove(key);
}
public void Set(string key, string value)
{
Preferences.Set(key, value);
}
}
}

View File

@ -0,0 +1,29 @@
using Borepin.Service;
using System.Threading.Tasks;
using Xamarin.Essentials;
namespace Borepin.iOS.Services
{
public class SecretService : ISecretService
{
public Task<string> GetAsync(string key)
{
return SecureStorage.GetAsync(key);
}
public bool Remove(string key)
{
return SecureStorage.Remove(key);
}
public void RemoveAll()
{
SecureStorage.RemoveAll();
}
public Task SetAsync(string key, string value)
{
return SecureStorage.SetAsync(key, value);
}
}
}

View File

@ -8,15 +8,17 @@ namespace Borepin.macOS
[Register("AppDelegate")]
public class AppDelegate : FormsApplicationDelegate
{
NSWindow window;
readonly NSWindow window;
public AppDelegate()
{
var style = NSWindowStyle.Closable | NSWindowStyle.Resizable | NSWindowStyle.Titled;
var rect = new CoreGraphics.CGRect(200, 1000, 1024, 768);
window = new NSWindow(rect, style, NSBackingStore.Buffered, false);
window.Title = "Xamarin.Forms on Mac!"; // choose your own Title here
window.TitleVisibility = NSWindowTitleVisibility.Hidden;
window = new NSWindow(rect, style, NSBackingStore.Buffered, false)
{
Title = "Xamarin.Forms on Mac!", // choose your own Title here
TitleVisibility = NSWindowTitleVisibility.Hidden
};
}
public override NSWindow MainWindow
@ -27,7 +29,7 @@ namespace Borepin.macOS
public override void DidFinishLaunching(NSNotification notification)
{
Forms.Init();
LoadApplication(new App());
LoadApplication(new App(new PlatformInitializer()));
base.DidFinishLaunching(notification);
}
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\Xamarin.Forms.4.7.0.1351\build\Xamarin.Forms.props" Condition="Exists('..\..\packages\Xamarin.Forms.4.7.0.1351\build\Xamarin.Forms.props')" />
<Import Project="..\..\packages\Xamarin.Forms.5.0.0.2012\build\Xamarin.Forms.props" Condition="Exists('..\..\packages\Xamarin.Forms.5.0.0.2012\build\Xamarin.Forms.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -74,13 +74,16 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.4.7.0.1351\lib\Xamarin.Mac\Xamarin.Forms.Core.dll</HintPath>
<HintPath>..\..\packages\Xamarin.Forms.5.0.0.2012\lib\Xamarin.Mac\Xamarin.Forms.Core.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.4.7.0.1351\lib\Xamarin.Mac\Xamarin.Forms.Platform.dll</HintPath>
<HintPath>..\..\packages\Xamarin.Forms.5.0.0.2012\lib\Xamarin.Mac\Xamarin.Forms.Platform.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform.macOS, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.5.0.0.2012\lib\Xamarin.Mac\Xamarin.Forms.Platform.macOS.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.4.7.0.1351\lib\Xamarin.Mac\Xamarin.Forms.Xaml.dll</HintPath>
<HintPath>..\..\packages\Xamarin.Forms.5.0.0.2012\lib\Xamarin.Mac\Xamarin.Forms.Xaml.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Mac" />
</ItemGroup>
@ -110,6 +113,7 @@
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="PlatformInitializer.cs" />
<Compile Include="ViewController.cs" />
<Compile Include="ViewController.designer.cs">
<DependentUpon>ViewController.cs</DependentUpon>
@ -127,10 +131,10 @@
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Xamarin.Forms.4.7.0.1351\build\Xamarin.Forms.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.4.7.0.1351\build\Xamarin.Forms.props'))" />
<Error Condition="!Exists('..\..\packages\Xamarin.Forms.4.7.0.1351\build\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.4.7.0.1351\build\Xamarin.Forms.targets'))" />
<Error Condition="!Exists('..\..\packages\Xamarin.Forms.5.0.0.2012\build\Xamarin.Forms.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.5.0.0.2012\build\Xamarin.Forms.props'))" />
<Error Condition="!Exists('..\..\packages\Xamarin.Forms.5.0.0.2012\build\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.5.0.0.2012\build\Xamarin.Forms.targets'))" />
</Target>
<Import Project="..\..\packages\Xamarin.Forms.4.7.0.1351\build\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.4.7.0.1351\build\Xamarin.Forms.targets')" />
<Import Project="..\..\packages\Xamarin.Forms.5.0.0.2012\build\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.5.0.0.2012\build\Xamarin.Forms.targets')" />
</Project>

View File

@ -0,0 +1,13 @@
using Prism;
using Prism.Ioc;
namespace Borepin.macOS
{
public class PlatformInitializer : IPlatformInitializer
{
public void RegisterTypes(IContainerRegistry containerRegistry)
{
}
}
}

View File

@ -5,5 +5,5 @@
<package id="Prism.DryIoc.Forms" version="7.2.0.1422" targetFramework="xamarinmac20" />
<package id="Prism.Forms" version="7.2.0.1422" targetFramework="xamarinmac20" />
<package id="System.Reflection.Emit.Lightweight" version="4.7.0" targetFramework="xamarinmac20" />
<package id="Xamarin.Forms" version="4.7.0.1351" targetFramework="xamarinmac20" />
<package id="Xamarin.Forms" version="5.0.0.2012" targetFramework="xamarinmac20" />
</packages>

View File

@ -7,19 +7,17 @@ using Borepin.DialogModel;
using Borepin.Service.Connections;
using Borepin.Service.BFFH;
using Borepin.Service.Credentials;
using System.Collections.Generic;
using Borepin.Model;
using Prism;
using Borepin.Page.SetUpProcess;
using Borepin.PageModel.SetUpProcess;
using Borepin.Page.AddServerProcess;
using Borepin.PageModel.AddServerProcess;
namespace Borepin
{
public partial class App
{
private IConnectionService _ConnectionService;
private ICredentialService _CredentialService;
private IBFFHService _BFFHService;
public App()
public App(IPlatformInitializer platformInitializer) : base(platformInitializer)
{
}
@ -28,17 +26,7 @@ namespace Borepin
{
InitializeComponent();
Prism.Navigation.INavigationResult result;
List<Connection> connection_list = await _ConnectionService.GetConnectionList();
if (connection_list.Count == 0)
{
result = await NavigationService.NavigateAsync("/NavigationPage/HostSelectPage");
}
else
{
result = await NavigationService.NavigateAsync("/MainPage/NavigationPage/ServerListPage");
}
Prism.Navigation.INavigationResult result = await NavigationService.NavigateAsync("/MainPage/NavigationPage/SetUpProcess_WelcomePage");
if (!result.Success)
{
System.Diagnostics.Debugger.Break();
@ -53,24 +41,23 @@ namespace Borepin
containerRegistry.RegisterForNavigation<MachinePage, MachinePageModel>();
containerRegistry.RegisterForNavigation<SettingsPage>();
containerRegistry.RegisterForNavigation<MachineListPage, MachineListPageModel>();
containerRegistry.RegisterForNavigation<LoginPasswordPage, LoginPasswordPageModel>();
containerRegistry.RegisterForNavigation<HostSelectPage, HostSelectPageModel>();
containerRegistry.RegisterForNavigation<LoginChoosePage, LoginChoosePageModel>();
containerRegistry.RegisterForNavigation<LoginPasswordPage, LoginPasswordPageModel>("AddServerProcess_LoginPasswordPage");
containerRegistry.RegisterForNavigation<HostSelectPage, HostSelectPageModel>("AddServerProcess_HostSelectPage");
containerRegistry.RegisterForNavigation<LoginChoosePage, LoginChoosePageModel>("AddServerProcess_LoginChoosePage");
containerRegistry.RegisterForNavigation<ServerListPage, ServerListPageModel>();
containerRegistry.RegisterForNavigation<ServerPage, ServerPageModel>();
containerRegistry.RegisterForNavigation<ListPage, ListPageModel>();
containerRegistry.RegisterForNavigation<TestPage, TestPageModel>();
containerRegistry.RegisterForNavigation<WelcomePage, WelcomePageModel>("SetUpProcess_WelcomePage");
containerRegistry.RegisterForNavigation<ScanPage, ScanPageModel>("SetUpProcess_ScanPage");
// Register Dialog
containerRegistry.RegisterDialog<ConfirmDialog, ConfirmDialogModel>();
// Register Service
_ConnectionService = new ConnectionService();
_CredentialService = new CredentialService();
_BFFHService = new BFFHService(_CredentialService);
containerRegistry.RegisterInstance<IConnectionService>(_ConnectionService);
containerRegistry.RegisterInstance<ICredentialService>(_CredentialService);
containerRegistry.RegisterInstance<IBFFHService>(_BFFHService);
containerRegistry.Register<IConnectionService, ConnectionService>();
containerRegistry.Register<ICredentialService, CredentialService>();
containerRegistry.RegisterSingleton<IBFFHService, BFFHService>();
}
}
}

View File

@ -0,0 +1,48 @@
using Prism.Mvvm;
using Prism.Navigation;
using System.Threading.Tasks;
namespace Borepin.Base
{
/// <summary>
/// Base for all BFFH Based PageModels
/// </summary>
public abstract class PageModelBase : BindableBase, INavigationAware
{
#region Private Properties
protected readonly INavigationService _NavigationService;
#endregion
#region Contructors
public PageModelBase(INavigationService navigationService)
{
_NavigationService = navigationService;
}
#endregion
#region Properties
/// <summary>
/// PageModel is Busy
/// </summary>
private bool _IsBusy = true;
public bool IsBusy
{
get => _IsBusy;
set => SetProperty(ref _IsBusy, value);
}
#endregion
#region Data
/// <summary>
/// Load Data async
/// </summary>
/// <returns></returns>
public abstract Task LoadData();
#endregion
#region INavigationAware
public abstract void OnNavigatedFrom(INavigationParameters parameters);
public abstract void OnNavigatedTo(INavigationParameters parameters);
#endregion
}
}

View File

@ -9,7 +9,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
<NeutralLanguage>de-DE</NeutralLanguage>
<NeutralLanguage>en</NeutralLanguage>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>portable</DebugType>
@ -21,11 +21,10 @@
</Target>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Plugin.Multilingual" Version="1.0.2" />
<PackageReference Include="Prism.DryIoc.Forms" Version="7.2.0.1422" />
<PackageReference Include="Xamarin.Forms" Version="4.7.0.1351" />
<PackageReference Include="Xamarin.Essentials" Version="1.5.3.2" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2012" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
<PackageReference Include="Xamarin.Forms.EntryAutoComplete" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<Compile Update="Page\MachineListPage.xaml.cs">
@ -34,15 +33,21 @@
<Compile Update="Page\SettingsPage.xaml.cs">
<DependentUpon>SettingsPage.xaml</DependentUpon>
</Compile>
<Compile Update="Page\SetUpProcess\ScanPage.xaml.cs">
<DependentUpon>ScanPage.xaml</DependentUpon>
</Compile>
<Compile Update="Page\SetUpProcess\WelcomePage.xaml.cs">
<DependentUpon>WelcomePage.xaml</DependentUpon>
</Compile>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Update="Resources\Text\TextResource.en-US.Designer.cs">
<Compile Update="Resources\Text\TextResource.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>TextResource.en-US.resx</DependentUpon>
<DependentUpon>TextResource.resx</DependentUpon>
</Compile>
<Compile Update="Styles\LightTheme.xaml.cs">
<DependentUpon>LightTheme.xaml</DependentUpon>
@ -55,16 +60,16 @@
<EmbeddedResource Update="Dialog\ConfirmDialog.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Page\AddServerDialog\HostSelectPage.xaml">
<EmbeddedResource Update="Page\AddServerProcess\HostSelectPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Page\ListPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Page\AddServerDialog\LoginChoosePage.xaml">
<EmbeddedResource Update="Page\AddServerProcess\LoginChoosePage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Page\AddServerDialog\LoginPasswordPage.xaml">
<EmbeddedResource Update="Page\AddServerProcess\LoginPasswordPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Page\MachinePage.xaml">
@ -82,26 +87,40 @@
<EmbeddedResource Update="Page\SettingsPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Page\SetUpProcess\ScanPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Page\SetUpProcess\WelcomePage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Page\TestPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Resources\Text\TextResource.en-US.resx">
<EmbeddedResource Update="Resources\Text\TextResource.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>TextResource.en-US.Designer.cs</LastGenOutput>
<LastGenOutput>TextResource.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Styles\LightTheme.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="View\IsBusyView.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="View\ListItemView.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="View\ScanView.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="View\ServerListItemView.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="Base\" />
<Folder Include="Behaviour\" />
</ItemGroup>
<ItemGroup>

View File

@ -0,0 +1,43 @@
using Plugin.Multilingual;
using System;
using System.Reflection;
using System.Resources;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Borepin.Helpers
{
[ContentProperty("Text")]
public class TranslateExtension : IMarkupExtension
{
const string ResourceId = "Borepin.Resources.Text.TextResource";
static readonly Lazy<ResourceManager> resmgr = new Lazy<ResourceManager>(() => new ResourceManager(ResourceId, typeof(TranslateExtension).GetTypeInfo().Assembly));
public string Text { get; set; }
public object ProvideValue(IServiceProvider serviceProvider)
{
if (Text == null)
return "";
var ci = CrossMultilingual.Current.CurrentCultureInfo;
var translation = resmgr.Value.GetString(Text, ci);
if (translation == null)
{
#if DEBUG
//throw new ArgumentException(
// String.Format("Key '{0}' was not found in resources '{1}' for culture '{2}'.", Text, ResourceId, ci.Name),
// "Text");
translation = "!MISSING TEXT!";
#else
translation = Text; // returns the key, which GETS DISPLAYED TO THE USER
#endif
}
return translation;
}
}
}

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="de" original="BOREPIN/PROPERTIES/RESOURCES.RESX" tool-id="MultilingualAppToolkit" product-name="n/a" product-version="n/a" build-num="n/a">
<header>
<tool tool-id="MultilingualAppToolkit" tool-name="Multilingual App Toolkit" tool-version="4.0.6916.0" tool-company="Microsoft" />
</header>
<body>
<group id="BOREPIN/PROPERTIES/RESOURCES.RESX" datatype="resx" />
</body>
</file>
<file datatype="xml" source-language="en" target-language="de" original="BOREPIN/RESOURCES/TEXT/TEXTRESOURCE.RESX" tool-id="MultilingualAppToolkit" product-name="n/a" product-version="n/a" build-num="n/a">
<header>
<tool tool-id="MultilingualAppToolkit" tool-name="Multilingual App Toolkit" tool-version="4.0.6916.0" tool-company="Microsoft" />
</header>
<body>
<group id="BOREPIN/RESOURCES/TEXT/TEXTRESOURCE.RESX" datatype="resx">
<trans-unit id="SetUp_WelcomePage_Text" translate="yes" xml:space="preserve">
<source>Hier muss ein kurzer Text hin was FabAccess ist und was man damit machen kann</source>
<target state="new">Hier muss ein kurzer Text hin was FabAccess ist und was man damit machen kann</target>
</trans-unit>
<trans-unit id="SetUp_WelcomePage_Title" translate="yes" xml:space="preserve">
<source>Welcome</source>
<target state="new">Welcome</target>
</trans-unit>
<trans-unit id="SetUp_WelcomePage_Button" translate="yes" xml:space="preserve">
<source>Start working</source>
<target state="new">Start working</target>
</trans-unit>
<trans-unit id="SetUp_ScanPage_Button" translate="yes" xml:space="preserve">
<source>Login to your Space</source>
<target state="new">Login to your Space</target>
</trans-unit>
<trans-unit id="SetUp_ScanPage_Text" translate="yes" xml:space="preserve">
<source>Wenn du dieses Logo siehst, dann kannst du es scannen</source>
<target state="new">Wenn du dieses Logo siehst, dann kannst du es scannen</target>
</trans-unit>
</group>
</body>
</file>
</xliff>

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="en" original="BOREPIN/PROPERTIES/RESOURCES.RESX" tool-id="MultilingualAppToolkit" product-name="n/a" product-version="n/a" build-num="n/a">
<header>
<tool tool-id="MultilingualAppToolkit" tool-name="Multilingual App Toolkit" tool-version="4.0.6916.0" tool-company="Microsoft" />
</header>
<body>
<group id="BOREPIN/PROPERTIES/RESOURCES.RESX" datatype="resx" />
</body>
</file>
<file datatype="xml" source-language="en" target-language="en" original="BOREPIN/RESOURCES/TEXT/TEXTRESOURCE.RESX" tool-id="MultilingualAppToolkit" product-name="n/a" product-version="n/a" build-num="n/a">
<header>
<tool tool-id="MultilingualAppToolkit" tool-name="Multilingual App Toolkit" tool-version="4.0.6916.0" tool-company="Microsoft" />
</header>
<body>
<group id="BOREPIN/RESOURCES/TEXT/TEXTRESOURCE.RESX" datatype="resx">
<trans-unit id="SetUp_WelcomePage_Text" translate="yes" xml:space="preserve">
<source>Hier muss ein kurzer Text hin was FabAccess ist und was man damit machen kann</source>
<target state="new">Hier muss ein kurzer Text hin was FabAccess ist und was man damit machen kann</target>
</trans-unit>
<trans-unit id="SetUp_WelcomePage_Title" translate="yes" xml:space="preserve">
<source>Welcome</source>
<target state="new">Welcome</target>
</trans-unit>
<trans-unit id="SetUp_WelcomePage_Button" translate="yes" xml:space="preserve">
<source>Start working</source>
<target state="new">Start working</target>
</trans-unit>
<trans-unit id="SetUp_ScanPage_Button" translate="yes" xml:space="preserve">
<source>Login to your Space</source>
<target state="new">Login to your Space</target>
</trans-unit>
<trans-unit id="SetUp_ScanPage_Text" translate="yes" xml:space="preserve">
<source>Wenn du dieses Logo siehst, dann kannst du es scannen</source>
<target state="new">Wenn du dieses Logo siehst, dann kannst du es scannen</target>
</trans-unit>
</group>
</body>
</file>
</xliff>

View File

@ -1,17 +0,0 @@
<?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="Borepin.Page.HostSelectPage"
xmlns:customControl="clr-namespace:EntryAutoComplete;assembly=EntryAutoComplete">
<NavigationPage.TitleView>
<Label Text="FabAccess" FontAttributes="Bold" HorizontalOptions="FillAndExpand" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" VerticalOptions="FillAndExpand" FontSize="Medium" TextColor="{StaticResource FirstColor}"/>
</NavigationPage.TitleView>
<ContentPage.Content>
<StackLayout Padding="20">
<Label Text="Host" Style="{StaticResource LabelStyle_PropertyTitle}"></Label>
<Entry Text="{Binding Host}"/>
<Button Text="Detect local host" Command="{Binding DetectHostCommand}" Style="{StaticResource ButtonStyle_Primary}"/>
<Button Text="Select Host" Command="{Binding UseHostCommand}" Style="{StaticResource ButtonStyle_Primary}"/>
</StackLayout>
</ContentPage.Content>
</ContentPage>

View File

@ -0,0 +1,16 @@
<?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="Borepin.Page.AddServerProcess.HostSelectPage">
<NavigationPage.TitleView>
<Label Text="FabAccess" Style="{StaticResource Style_Label_Header}"/>
</NavigationPage.TitleView>
<ContentPage.Content>
<StackLayout Padding="20">
<Label Text="Host" Style="{StaticResource Style_Label_Property_Title}"></Label>
<Entry Text="{Binding Host}"/>
<Button Text="Detect local host" Command="{Binding DetectHostCommand}" Style="{StaticResource Style_Button_Primary}"/>
<Button Text="Select Host" Command="{Binding UseHostCommand}" Style="{StaticResource Style_Button_Primary}"/>
</StackLayout>
</ContentPage.Content>
</ContentPage>

View File

@ -1,8 +1,7 @@

using Xamarin.Forms;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Borepin.Page
namespace Borepin.Page.AddServerProcess
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class HostSelectPage : ContentPage

View File

@ -1,19 +1,19 @@
<?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="Borepin.Page.LoginChoosePage">
x:Class="Borepin.Page.AddServerProcess.LoginChoosePage">
<NavigationPage.TitleView>
<Label Text="FabAccess" FontAttributes="Bold" HorizontalOptions="FillAndExpand" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" VerticalOptions="FillAndExpand" FontSize="Medium" TextColor="{StaticResource FirstColor}"/>
</NavigationPage.TitleView>
<ContentPage.Content>
<StackLayout Padding="20">
<Label Text="Sign In:" Style="{StaticResource LabelStyle_PropertyTitle}"></Label>
<Button Text="Login with Password" Command="{Binding LoginPasswordCommand}" Style="{StaticResource ButtonStyle_Primary}"/>
<Label Text="or" Style="{StaticResource LabelStyle_PropertyTitle}"></Label>
<Button Text="Login with Card" Style="{StaticResource ButtonStyle_Primary}" IsEnabled="False"/>
<Label Text="Sign In:" Style="{StaticResource Style_Label_Property_Title}"></Label>
<Button Text="Login with Password" Command="{Binding LoginPasswordCommand}" Style="{StaticResource Style_Button_Primary}"/>
<Label Text="or" Style="{StaticResource Style_Label_Property_Title}"></Label>
<Button Text="Login with Card" Style="{StaticResource Style_Button_Primary}" IsEnabled="False"/>
<Label Text="Sign Up:" Style="{StaticResource LabelStyle_PropertyTitle}"></Label>
<Button Text="Register" Style="{StaticResource ButtonStyle_Primary}" IsEnabled="False"/>
<Label Text="Sign Up:" Style="{StaticResource Style_Label_Property_Title}"></Label>
<Button Text="Register" Style="{StaticResource Style_Button_Primary}" IsEnabled="False"/>
</StackLayout>
</ContentPage.Content>
</ContentPage>

View File

@ -2,7 +2,7 @@
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Borepin.Page
namespace Borepin.Page.AddServerProcess
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class LoginChoosePage : ContentPage

View File

@ -1,19 +1,19 @@
<?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="Borepin.Page.LoginPasswordPage">
x:Class="Borepin.Page.AddServerProcess.LoginPasswordPage">
<NavigationPage.TitleView>
<Label Text="FabAccess" FontAttributes="Bold" HorizontalOptions="FillAndExpand" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" VerticalOptions="FillAndExpand" FontSize="Medium" TextColor="{StaticResource FirstColor}"/>
</NavigationPage.TitleView>
<ContentPage.Content>
<StackLayout Padding="20">
<Label Text="Username" Style="{StaticResource LabelStyle_PropertyTitle}"></Label>
<Label Text="Username" Style="{StaticResource Style_Label_Property_Title}"></Label>
<Entry Text="{Binding Username}"/>
<Label Text="Password" Style="{StaticResource LabelStyle_PropertyTitle}"></Label>
<Label Text="Password" Style="{StaticResource Style_Label_Property_Title}"></Label>
<Entry Text="{Binding Password}" IsPassword="True"/>
<Button Text="Login" Command="{Binding AuthenticateCommand}" Style="{StaticResource ButtonStyle_Primary}"/>
<Button Text="Login" Command="{Binding AuthenticateCommand}" Style="{StaticResource Style_Button_Primary}"/>
</StackLayout>
</ContentPage.Content>
</ContentPage>

View File

@ -2,7 +2,7 @@
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Borepin.Page
namespace Borepin.Page.AddServerProcess
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class LoginPasswordPage : ContentPage

View File

@ -2,21 +2,32 @@
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:Borepin.View"
x:Class="Borepin.Page.MachineListPage">
x:Class="Borepin.Page.MachineListPage"
xmlns:converters="clr-namespace:Borepin.Converter">
<NavigationPage.TitleView>
<Label Text="Machines" HorizontalOptions="End" Margin="0, 0, 10, 0" VerticalOptions="CenterAndExpand" FontSize="Medium" TextColor="{StaticResource FirstColor}"/>
</NavigationPage.TitleView>
<ContentPage.Resources>
<ResourceDictionary>
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<StackLayout>
<ListView ItemsSource="{Binding MachineListItemViewModel_List}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<views:MachineListItemView />
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<StackLayout Padding="20">
<StackLayout IsVisible="{Binding IsBusy}">
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
</StackLayout>
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
<ListView ItemsSource="{Binding MachineListItemViewModel_List}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<views:MachineListItemView />
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</StackLayout>
</ContentPage.Content>
</ContentPage>

View File

@ -10,14 +10,20 @@
<ResourceDictionary>
<converters:MachineStateColorConverter x:Key="MachineStateColorConverter"/>
<converters:IsNotNullBoolConverter x:Key="IsNotNullBoolConverter"/>
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<StackLayout Padding="20">
<Label Text="{Binding Name}" Style="{StaticResource LabelStyle_Title}"/>
<StackLayout IsVisible="{Binding IsBusy}">
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
</StackLayout>
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
<Label Text="{Binding Name}" Style="{StaticResource LabelStyle_Title}"/>
<Button Text="Use" Command="{Binding UseMachineCommand}" IsVisible="{Binding CanUse}" Style="{StaticResource ButtonStyle_Primary}"/>
<Button Text="GiveBack" Command="{Binding GiveBackMachineCommand}" IsVisible="{Binding CanGiveBack}" Style="{StaticResource ButtonStyle_Primary}"/>
<Button Text="Use" Command="{Binding UseMachineCommand}" IsVisible="{Binding CanUse}" Style="{StaticResource Style_Button_Primary}"/>
<Button Text="GiveBack" Command="{Binding GiveBackMachineCommand}" IsVisible="{Binding CanGiveBack}" Style="{StaticResource Style_Button_Primary}"/>
</StackLayout>
</StackLayout>
</ContentPage.Content>
</ContentPage>

View File

@ -2,33 +2,44 @@
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:Borepin.View"
x:Class="Borepin.Page.ServerListPage">
x:Class="Borepin.Page.ServerListPage"
xmlns:converters="clr-namespace:Borepin.Converter">
<NavigationPage.TitleView>
<Label Text="Servers" HorizontalOptions="End" Margin="0, 0, 10, 0" VerticalOptions="CenterAndExpand" FontSize="Medium" TextColor="{StaticResource FirstColor}"/>
</NavigationPage.TitleView>
<ContentPage.Resources>
<ResourceDictionary>
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<StackLayout>
<Label Text="Active Connection" IsVisible="{Binding HasActiveConnection}"/>
<ListView ItemsSource="{Binding ActiveConnection}" IsVisible="{Binding HasActiveConnection}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<views:ServerListItemView />
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<Label Text="Last Connections"/>
<ListView ItemsSource="{Binding ServerListItemViewModel_List}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<views:ServerListItemView />
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<Button Text="Connect to new Server" Command="{Binding AddInstancesCommand}"/>
<StackLayout Padding="20">
<StackLayout IsVisible="{Binding IsBusy}">
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
</StackLayout>
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
<Label Text="Active Connection" IsVisible="{Binding HasActiveConnection}"/>
<ListView ItemsSource="{Binding ActiveConnection}" IsVisible="{Binding HasActiveConnection}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<views:ServerListItemView />
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<Label Text="Last Connections"/>
<ListView ItemsSource="{Binding ServerListItemViewModel_List}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<views:ServerListItemView />
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<Button Text="Connect to new Server" Command="{Binding AddInstancesCommand}"/>
</StackLayout>
</StackLayout>
</ContentPage.Content>
</ContentPage>

View File

@ -2,18 +2,23 @@
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Borepin.Page.ServerPage"
xmlns:converter="clr-namespace:Borepin.Converter">
xmlns:converters="clr-namespace:Borepin.Converter">
<ContentPage.Resources>
<ResourceDictionary>
<converter:InvertBoolConverter x:Key="invertBool" />
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<StackLayout>
<Label Text="{Binding Connection_Item.Address}"/>
<Button IsVisible="{Binding IsConnected, Converter={StaticResource invertBool}}" Text="Connect" Command="{Binding ConnectCommand}"/>
<Button IsVisible="{Binding IsConnected}" Text="Disconnect" Command="{Binding ConnectCommand}"/>
<Button Text="Delete" Command="{Binding DeleteCommand}"/>
<StackLayout Padding="20">
<StackLayout IsVisible="{Binding IsBusy}">
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
</StackLayout>
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
<Label Text="{Binding Connection_Item.Address}"/>
<Button IsVisible="{Binding IsConnected, Converter={StaticResource InvertBoolConverter}}" Text="Connect" Command="{Binding ConnectCommand}"/>
<Button IsVisible="{Binding IsConnected}" Text="Disconnect" Command="{Binding ConnectCommand}"/>
<Button Text="Delete" Command="{Binding DeleteCommand}"/>
</StackLayout>
</StackLayout>
</ContentPage.Content>
</ContentPage>

View File

@ -0,0 +1,16 @@
<?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="Borepin.Page.SetUpProcess.ScanPage"
xmlns:i18n="clr-namespace:Borepin.Helpers"
xmlns:views="clr-namespace:Borepin.View">
<ContentPage.Content>
<ScrollView>
<StackLayout Style="{StaticResource Style_StackLayout_Content}">
<views:ScanView />
<Label Text="{i18n:Translate SetUp_ScanPage_Text}" Style="{StaticResource Style_Label_Text}"/>
<Button Text="{i18n:Translate SetUp_ScanPage_Button}" Command="{Binding NextCommand}" Style="{StaticResource Style_Button_Primary}"/>
</StackLayout>
</ScrollView>
</ContentPage.Content>
</ContentPage>

View File

@ -0,0 +1,14 @@
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Borepin.Page.SetUpProcess
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ScanPage : ContentPage
{
public ScanPage()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,15 @@
<?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="Borepin.Page.SetUpProcess.WelcomePage"
xmlns:i18n="clr-namespace:Borepin.Helpers">
<ContentPage.Content>
<ScrollView>
<StackLayout Style="{StaticResource Style_StackLayout_Content}">
<Label Text="{i18n:Translate SetUp_WelcomePage_Title}" Style="{StaticResource Style_Label_Title_Center}"/>
<Label Text="{i18n:Translate SetUp_WelcomePage_Text}" Style="{StaticResource Style_Label_Text}"/>
<Button Text="{i18n:Translate SetUp_WelcomePage_Button}" Command="{Binding NextCommand}" Style="{StaticResource Style_Button_Primary}"/>
</StackLayout>
</ScrollView>
</ContentPage.Content>
</ContentPage>

View File

@ -0,0 +1,14 @@
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Borepin.Page.SetUpProcess
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class WelcomePage : ContentPage
{
public WelcomePage()
{
InitializeComponent();
}
}
}

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="Borepin.Page.TestPage"
xmlns:converters="clr-namespace:Borepin.Converter">
<ContentPage.Resources>
<ResourceDictionary>
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<StackLayout Padding="20">
<StackLayout IsVisible="{Binding IsBusy}">
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
</StackLayout>
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
<Label Text="TestPage"/>
</StackLayout>
</StackLayout>
</ContentPage.Content>
</ContentPage>

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 Borepin.Page
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class TestPage : ContentPage
{
public TestPage()
{
InitializeComponent();
}
}
}

View File

@ -1,5 +1,4 @@
using Borepin.Service.BFFH;
using Borepin.Service.Connections;
using Prism.Mvvm;
using Prism.Navigation;
using System;
@ -8,7 +7,7 @@ using System.Threading.Tasks;
using System.Windows.Input;
using Xamarin.Forms;
namespace Borepin.PageModel
namespace Borepin.PageModel.AddServerProcess
{
public class HostSelectPageModel : BindableBase
{
@ -67,7 +66,7 @@ namespace Borepin.PageModel
await _BFFHService.Connect(connection);
INavigationResult result = await _NavigationService.NavigateAsync("LoginChoosePage");
INavigationResult result = await _NavigationService.NavigateAsync("AddServerProcess_LoginChoosePage");
if(!result.Success)
{
System.Diagnostics.Debugger.Break();
@ -84,7 +83,7 @@ namespace Borepin.PageModel
private void DetectHostCommandExecuted()
{
// Use Demo Host
Host = "192.168.178.20:59661";
Host = "127.0.0.1:59661";
}
}
}

View File

@ -3,7 +3,7 @@ using Prism.Navigation;
using System.Windows.Input;
using Xamarin.Forms;
namespace Borepin.PageModel
namespace Borepin.PageModel.AddServerProcess
{
public class LoginChoosePageModel : BindableBase
{
@ -25,7 +25,7 @@ namespace Borepin.PageModel
private async void LoginPasswordCommandExecuted()
{
INavigationResult result = await _NavigationService.NavigateAsync("LoginPasswordPage");
INavigationResult result = await _NavigationService.NavigateAsync("AddServerProcess_LoginPasswordPage");
if (!result.Success)
{
System.Diagnostics.Debugger.Break();

View File

@ -7,7 +7,7 @@ using Prism.Navigation;
using System.Threading.Tasks;
using System.Windows.Input;
namespace Borepin.PageModel
namespace Borepin.PageModel.AddServerProcess
{
public class LoginPasswordPageModel : BindableBase
{

View File

@ -1,36 +1,40 @@
using Borepin.ViewModel;
using Prism.Mvvm;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Windows.Input;
using Prism.Commands;
using Prism.Navigation;
using Borepin.Service.Connections;
using Borepin.Service.BFFH;
using Borepin.Model;
using Borepin.Base;
namespace Borepin.PageModel
{
public class MachineListPageModel : BindableBase, INavigationAware
public class MachineListPageModel : PageModelBase
{
private readonly INavigationService _NavigationService;
private readonly IConnectionService _ConnectionService;
#region Private Properties
private readonly IBFFHService _BFFHService;
#endregion
public MachineListPageModel(INavigationService navigationService, IConnectionService connectionService, IBFFHService bffhService)
#region Constructors
public MachineListPageModel(INavigationService navigationService, IBFFHService bFFHService) : base(navigationService)
{
_NavigationService = navigationService;
_ConnectionService = connectionService;
_BFFHService = bffhService;
_BFFHService = bFFHService;
SelectInstanceCommand = new DelegateCommand<object>(SelectInstanceCommandExecuted);
}
#endregion
private async Task<bool> LoadData()
#region Data
public override async Task LoadData()
{
if(_BFFHService.ActiveConnection == null)
if (_BFFHService.ActiveConnection == null)
{
return await Task.FromResult(true);
return;
}
else
{
IsConnected = true;
}
FabAccessAPI.Machines machineInterface = await _BFFHService.GetMachineInterface();
@ -38,23 +42,31 @@ namespace Borepin.PageModel
List<Machine> list = new List<Machine>();
IReadOnlyList<FabAccessAPI.Machine> machine_list = await machineInterface.ListMachines();
foreach(FabAccessAPI.Machine machine in machine_list)
foreach (FabAccessAPI.Machine machine in machine_list)
{
list.Add(new Machine() { Instance = machine, MInfo = await machine.GetMInfo() });
}
List<MachineListItemViewModel> viewmodel_list = new List<MachineListItemViewModel>();
foreach(Machine machine in list)
foreach (Machine machine in list)
{
viewmodel_list.Add(new MachineListItemViewModel(machine));
}
MachineListItemViewModel_List = viewmodel_list;
return await Task.FromResult(true);
IsBusy = false;
}
#endregion
#region Properties
private bool _IsConnected = false;
public bool IsConnected
{
get => _IsConnected;
set => SetProperty(ref _IsConnected, value);
}
private List<MachineListItemViewModel> _MachineListItemViewModel_List;
public List<MachineListItemViewModel> MachineListItemViewModel_List
{
@ -88,13 +100,14 @@ namespace Borepin.PageModel
#endregion
#region INavigationAware
public void OnNavigatedFrom(INavigationParameters parameters)
public override void OnNavigatedFrom(INavigationParameters parameters)
{
}
public void OnNavigatedTo(INavigationParameters parameters)
public override void OnNavigatedTo(INavigationParameters parameters)
{
IsBusy = true;
Task.Run(LoadData);
}
#endregion

View File

@ -1,26 +1,45 @@
using Borepin.Model;
using Borepin.Base;
using Borepin.Model;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Navigation;
using System.Threading.Tasks;
using System.Windows.Input;
using static FabAccessAPI.Schema.Machine.WriteInterface;
namespace Borepin.PageModel
{
public class MachinePageModel : BindableBase, INavigationAware
public class MachinePageModel : PageModelBase
{
private readonly INavigationService _NavigationService;
public MachinePageModel(INavigationService navigationService)
#region Contructors
public MachinePageModel(INavigationService navigationService) : base(navigationService)
{
_NavigationService = navigationService;
UseMachineCommand = new DelegateCommand(UseMachineCommandExecuted);
GiveBackMachineCommand = new DelegateCommand(GiveBackMachineCommandExecuted);
}
#endregion
#region Data
public override Task LoadData()
{
Name = MachineItem.MInfo.Name;
CanUse = MachineItem.MInfo.State == FabAccessAPI.Schema.State.free;
//if (GiveBack == null)
//{
// GiveBack = await MachineItem.Instance.GetGiveBack();
//}
CanGiveBack = GiveBack != null;
IsBusy = false;
return Task.CompletedTask;
}
#endregion
#region Properties
private Machine _MachineItem;
public Machine MachineItem
{
@ -36,11 +55,11 @@ namespace Borepin.PageModel
}
private IGiveBack _GiveBack;
//public IGiveBack GiveBack
//{
// get => _GiveBack;
// set => SetProperty(ref _GiveBack, value);
//}
public IGiveBack GiveBack
{
get => _GiveBack;
set => SetProperty(ref _GiveBack, value);
}
private bool _CanUse;
public bool CanUse
@ -55,7 +74,6 @@ namespace Borepin.PageModel
get => _CanGiveBack;
set => SetProperty(ref _CanGiveBack, value);
}
#endregion
#region Commands
@ -68,8 +86,8 @@ namespace Borepin.PageModel
private async void UseMachineCommandExecuted()
{
_GiveBack = await MachineItem.Instance.Use();
CanGiveBack = _GiveBack != null;
GiveBack = await MachineItem.Instance.Use();
CanGiveBack = GiveBack != null;
MachineItem.MInfo = await MachineItem.Instance.GetMInfo();
@ -85,32 +103,29 @@ namespace Borepin.PageModel
private async void GiveBackMachineCommandExecuted()
{
await _GiveBack.Ret();
await GiveBack.Ret();
_GiveBack = null;
CanGiveBack = _GiveBack != null;
GiveBack = null;
CanGiveBack = GiveBack != null;
MachineItem.MInfo = await MachineItem.Instance.GetMInfo();
CanUse = MachineItem.MInfo.State == FabAccessAPI.Schema.State.free;
}
#endregion
#region INavigationAware
public void OnNavigatedFrom(INavigationParameters parameters)
#region INavigationService
public override void OnNavigatedFrom(INavigationParameters parameters)
{
}
public void OnNavigatedTo(INavigationParameters parameters)
public override void OnNavigatedTo(INavigationParameters parameters)
{
MachineItem = parameters["instance"] as Machine;
Name = MachineItem.MInfo.Name;
CanUse = MachineItem.MInfo.State == FabAccessAPI.Schema.State.free;
CanGiveBack = _GiveBack != null;
IsBusy = true;
Task.Run(LoadData);
}
#endregion
}

View File

@ -9,26 +9,30 @@ using Prism.Commands;
using Prism.Navigation;
using Borepin.Service.Connections;
using Borepin.Service.BFFH;
using Borepin.Base;
namespace Borepin.PageModel
{
public class ServerListPageModel : BindableBase, INavigationAware
public class ServerListPageModel : PageModelBase
{
private readonly INavigationService _NavigationService;
#region Private Properties
private readonly IConnectionService _ConnectionService;
private readonly IBFFHService _BFFHService;
#endregion
public ServerListPageModel(INavigationService navigationService, IConnectionService connectionService, IBFFHService bffhService)
#region Constructors
public ServerListPageModel(INavigationService navigationService, IConnectionService connectionService, IBFFHService bffhService) : base(navigationService)
{
_NavigationService = navigationService;
_ConnectionService = connectionService;
_BFFHService = bffhService;
AddInstancesCommand = new DelegateCommand(AddInstancesCommandExecuted);
SelectInstanceCommand = new DelegateCommand<object>(SelectInstanceCommandExecuted);
}
#endregion
private async Task<bool> LoadData()
#region Data
public override async Task LoadData()
{
List<Connection> list = await _ConnectionService.GetConnectionList();
if (_BFFHService.ActiveConnection != null)
@ -47,12 +51,11 @@ namespace Borepin.PageModel
HasActiveConnection = false;
}
//list = (List<Connection>)list.OrderBy(x => x.LastTime);
ServerListItemViewModel_List = list.Select(x => new ServerListItemViewModel(x)).ToList();
return await Task.FromResult(true);
IsBusy = false;
}
#endregion
#region Properties
private List<ServerListItemViewModel> _ServerListItemViewModel_List;
@ -117,13 +120,14 @@ namespace Borepin.PageModel
#endregion
#region INavigationAware
public void OnNavigatedFrom(INavigationParameters parameters)
public override void OnNavigatedFrom(INavigationParameters parameters)
{
}
public void OnNavigatedTo(INavigationParameters parameters)
public override void OnNavigatedTo(INavigationParameters parameters)
{
IsBusy = true;
Task.Run(LoadData);
}
#endregion

View File

@ -1,9 +1,9 @@
using Borepin.Model;
using Borepin.Base;
using Borepin.Model;
using Borepin.Service.BFFH;
using Borepin.Service.Connections;
using Borepin.Service.Credentials;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Navigation;
using Prism.Services.Dialogs;
using System.Threading.Tasks;
@ -11,17 +11,18 @@ using System.Windows.Input;
namespace Borepin.PageModel
{
public class ServerPageModel : BindableBase, INavigationAware
public class ServerPageModel : PageModelBase
{
private readonly INavigationService _NavigationService;
#region Private Properties
private readonly IDialogService _DialogService;
private readonly IConnectionService _ConnectionService;
private readonly IBFFHService _BFFHService;
private readonly ICredentialService _CredentialService;
#endregion
public ServerPageModel(INavigationService navigationService, IDialogService dialogService, IConnectionService connectionService, IBFFHService bffhService, ICredentialService credentialService)
#region Constructors
public ServerPageModel(INavigationService navigationService, IDialogService dialogService, IConnectionService connectionService, IBFFHService bffhService, ICredentialService credentialService) : base(navigationService)
{
_NavigationService = navigationService;
_DialogService = dialogService;
_ConnectionService = connectionService;
@ -31,6 +32,14 @@ namespace Borepin.PageModel
ConnectCommand = new DelegateCommand(async () => await ConnectCommandExecuted());
DeleteCommand = new DelegateCommand(DeleteCommandExecuted);
}
#endregion
#region Data
public override Task LoadData()
{
throw new System.NotImplementedException();
}
#endregion
#region Properties
private Connection _Connection_Item;
@ -58,6 +67,8 @@ namespace Borepin.PageModel
private async Task ConnectCommandExecuted()
{
IsBusy = true;
if(IsConnected)
{
_BFFHService.Disconnect();
@ -71,6 +82,8 @@ namespace Borepin.PageModel
IsConnected = true;
}
IsBusy = false;
}
private ICommand _DeleteCommand;
@ -122,16 +135,16 @@ namespace Borepin.PageModel
#endregion
#region INavigationAware
public void OnNavigatedFrom(INavigationParameters parameters)
public override void OnNavigatedFrom(INavigationParameters parameters)
{
}
public void OnNavigatedTo(INavigationParameters parameters)
public override void OnNavigatedTo(INavigationParameters parameters)
{
Connection_Item = parameters["instance"] as Connection;
if(_BFFHService.ActiveConnection != null && Connection_Item != null)
if (_BFFHService.ActiveConnection != null && Connection_Item != null)
{
IsConnected = Connection_Item.Equals(_BFFHService.ActiveConnection);
}
@ -139,6 +152,8 @@ namespace Borepin.PageModel
{
IsConnected = false;
}
IsBusy = false;
}
#endregion
}

View File

@ -0,0 +1,54 @@
using Borepin.Base;
using Prism.Commands;
using Prism.Navigation;
using System.Threading.Tasks;
using System.Windows.Input;
namespace Borepin.PageModel.SetUpProcess
{
public class ScanPageModel : PageModelBase
{
#region Constructors
public ScanPageModel(INavigationService navigationService) : base(navigationService)
{
NextCommand = new DelegateCommand<object>(NextCommandCommandExecuted);
}
#endregion
#region Data
public override Task LoadData()
{
return Task.CompletedTask;
}
#endregion
#region Commands
private ICommand _NextCommand;
public ICommand NextCommand
{
get => _NextCommand;
set => SetProperty(ref _NextCommand, value);
}
private async void NextCommandCommandExecuted(object obj)
{
INavigationResult result = await _NavigationService.NavigateAsync("AddServerProcess_HostSelectPage");
if (!result.Success)
{
System.Diagnostics.Debugger.Break();
}
}
#endregion
#region INavigationAware
public override void OnNavigatedFrom(INavigationParameters parameters)
{
}
public override void OnNavigatedTo(INavigationParameters parameters)
{
}
#endregion
}
}

View File

@ -0,0 +1,54 @@
using Borepin.Base;
using Prism.Commands;
using Prism.Navigation;
using System.Threading.Tasks;
using System.Windows.Input;
namespace Borepin.PageModel.SetUpProcess
{
public class WelcomePageModel : PageModelBase
{
#region Constructors
public WelcomePageModel(INavigationService navigationService) : base(navigationService)
{
NextCommand = new DelegateCommand<object>(NextCommandCommandExecuted);
}
#endregion
#region Data
public override Task LoadData()
{
return Task.CompletedTask;
}
#endregion
#region Commands
private ICommand _NextCommand;
public ICommand NextCommand
{
get => _NextCommand;
set => SetProperty(ref _NextCommand, value);
}
private async void NextCommandCommandExecuted(object obj)
{
INavigationResult result = await _NavigationService.NavigateAsync("SetUpProcess_ScanPage");
if (!result.Success)
{
System.Diagnostics.Debugger.Break();
}
}
#endregion
#region INavigationAware
public override void OnNavigatedFrom(INavigationParameters parameters)
{
}
public override void OnNavigatedTo(INavigationParameters parameters)
{
}
#endregion
}
}

View File

@ -0,0 +1,39 @@
using Borepin.Base;
using Prism.Navigation;
using System.Threading.Tasks;
namespace Borepin.PageModel
{
class TestPageModel : PageModelBase
{
#region Contructors
public TestPageModel(INavigationService navigationService) : base(navigationService)
{
}
#endregion
#region Data
public override Task LoadData()
{
Task.Delay(3000);
IsBusy = false;
return Task.CompletedTask;
}
#endregion
#region INavigationService
public override void OnNavigatedFrom(INavigationParameters parameters)
{
}
public override void OnNavigatedTo(INavigationParameters parameters)
{
IsBusy = true;
Task.Run(LoadData);
}
#endregion
}
}

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,108 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Borepin.Resources.Text {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class TextResource {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal TextResource() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Borepin.Resources.Text.TextResource", typeof(TextResource).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to Login to your Space.
/// </summary>
internal static string SetUp_ScanPage_Button {
get {
return ResourceManager.GetString("SetUp_ScanPage_Button", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Wenn du dieses Logo siehst, dann kannst du es scannen.
/// </summary>
internal static string SetUp_ScanPage_Text {
get {
return ResourceManager.GetString("SetUp_ScanPage_Text", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Start working.
/// </summary>
internal static string SetUp_WelcomePage_Button {
get {
return ResourceManager.GetString("SetUp_WelcomePage_Button", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Hier muss ein kurzer Text hin was FabAccess ist und was man damit machen kann.
/// </summary>
internal static string SetUp_WelcomePage_Text {
get {
return ResourceManager.GetString("SetUp_WelcomePage_Text", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Welcome.
/// </summary>
internal static string SetUp_WelcomePage_Title {
get {
return ResourceManager.GetString("SetUp_WelcomePage_Title", resourceCulture);
}
}
}
}

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,63 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.42000
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Borepin.Resources.Text {
using System;
/// <summary>
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
/// </summary>
// Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class TextResource {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal TextResource() {
}
/// <summary>
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Borepin.Resources.Text.TextResource", typeof(TextResource).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@ -1,101 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="SetUp_ScanPage_Button" xml:space="preserve">
<value>Login to your Space</value>
</data>
<data name="SetUp_ScanPage_Text" xml:space="preserve">
<value>Wenn du dieses Logo siehst, dann kannst du es scannen</value>
</data>
<data name="SetUp_WelcomePage_Button" xml:space="preserve">
<value>Start working</value>
</data>
<data name="SetUp_WelcomePage_Text" xml:space="preserve">
<value>Hier muss ein kurzer Text hin was FabAccess ist und was man damit machen kann</value>
</data>
<data name="SetUp_WelcomePage_Title" xml:space="preserve">
<value>Welcome</value>
</data>
</root>

View File

@ -3,20 +3,28 @@ using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Xamarin.Essentials;
namespace Borepin.Service.Connections
{
public class ConnectionService : IConnectionService
{
#region Private Properties
private readonly IPreferenceService _PreferenceService;
#endregion
public ConnectionService(IPreferenceService preferenceService)
{
_PreferenceService = preferenceService;
}
public Task<List<Connection>> GetConnectionList()
{
return Task.FromResult(JsonConvert.DeserializeObject<List<Connection>>(Preferences.Get("connection_list", "[]")));
return Task.FromResult(JsonConvert.DeserializeObject<List<Connection>>(_PreferenceService.Get("connection_list", "[]")));
}
public Task<bool> AddConnection(Connection connection)
{
List<Connection> connection_list = JsonConvert.DeserializeObject<List<Connection>>(Preferences.Get("connection_list", "[]"));
List<Connection> connection_list = JsonConvert.DeserializeObject<List<Connection>>(_PreferenceService.Get("connection_list", "[]"));
if(connection_list.Contains(connection))
{
@ -25,14 +33,14 @@ namespace Borepin.Service.Connections
connection_list.Add(connection);
Preferences.Set("connection_list", JsonConvert.SerializeObject(connection_list));
_PreferenceService.Set("connection_list", JsonConvert.SerializeObject(connection_list));
return Task.FromResult(true);
}
public Task<bool> RemoveConnection(Connection connection)
{
List<Connection> connection_list = JsonConvert.DeserializeObject<List<Connection>>(Preferences.Get("connection_list", "[]"));
List<Connection> connection_list = JsonConvert.DeserializeObject<List<Connection>>(_PreferenceService.Get("connection_list", "[]"));
if (!connection_list.Contains(connection))
{
@ -41,14 +49,14 @@ namespace Borepin.Service.Connections
connection_list.RemoveAll(x => x.Equals(connection));
Preferences.Set("connection_list", JsonConvert.SerializeObject(connection_list));
_PreferenceService.Set("connection_list", JsonConvert.SerializeObject(connection_list));
return Task.FromResult(true);
}
public Task<bool> LogConnect(Connection connection)
{
List<Connection> connection_list = JsonConvert.DeserializeObject<List<Connection>>(Preferences.Get("connection_list", "[]"));
List<Connection> connection_list = JsonConvert.DeserializeObject<List<Connection>>(_PreferenceService.Get("connection_list", "[]"));
if (!connection_list.Contains(connection))
{
@ -60,7 +68,7 @@ namespace Borepin.Service.Connections
connection_update.LastTime = DateTime.UtcNow;
connection_list[index] = connection_update;
Preferences.Set("connection_list", JsonConvert.SerializeObject(connection_list));
_PreferenceService.Set("connection_list", JsonConvert.SerializeObject(connection_list));
return Task.FromResult(true);
}

View File

@ -1,12 +1,22 @@
using Borepin.Model;
using System;
using System.Threading.Tasks;
using Xamarin.Essentials;
namespace Borepin.Service.Credentials
{
public class CredentialService : ICredentialService
{
#region Private Properties
private readonly ISecretService _SecretService;
#endregion
#region Constructors
public CredentialService(ISecretService secretService)
{
_SecretService = secretService;
}
#endregion
public async Task<string> GetPasswordAsync(Connection connection)
{
if (connection.AuthenticationTyp != AuthenticationTyp.PLAIN)
@ -14,19 +24,19 @@ namespace Borepin.Service.Credentials
throw new ArgumentException("AuthenticationTyp is not PLAIN");
}
return await SecureStorage.GetAsync(string.Format("bffh_password_{0}_{1}", connection.Address.ToString(), connection.Username));
return await _SecretService.GetAsync(string.Format("bffh_password_{0}_{1}", connection.Address.ToString(), connection.Username));
}
public async Task<bool> AddCredentialsAsync(Connection connection, string password)
{
await SecureStorage.SetAsync(string.Format("bffh_password_{0}_{1}", connection.Address.ToString(), connection.Username), password);
await _SecretService.SetAsync(string.Format("bffh_password_{0}_{1}", connection.Address.ToString(), connection.Username), password);
return await Task.FromResult(true);
}
public async Task<bool> RemoveCredentialsAsync(Connection connection)
{
SecureStorage.Remove(string.Format("bffh_password_{0}_{1}", connection.Address.ToString(), connection.Username));
_SecretService.Remove(string.Format("bffh_password_{0}_{1}", connection.Address.ToString(), connection.Username));
return await Task.FromResult(true);
}

View File

@ -0,0 +1,15 @@
namespace Borepin.Service
{
public interface IPreferenceService
{
void Clear();
bool ContainsKey(string key);
string Get(string key, string defaultValue);
void Remove(string key);
void Set(string key, string value);
}
}

View File

@ -0,0 +1,15 @@
using System.Threading.Tasks;
namespace Borepin.Service
{
public interface ISecretService
{
Task<string> GetAsync(string key);
bool Remove(string key);
void RemoveAll();
Task SetAsync(string key, string value);
}
}

View File

@ -3,6 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Borepin.Styles.LightTheme">
<!-- General -->
<Color x:Key="FirstColor">#FF00D4AA</Color>
<Color x:Key="SecondColor">#FF3C474D</Color>
<Color x:Key="ThirdColor">#FF333333</Color>
@ -13,9 +14,61 @@
<Color x:Key="EighthColor">#FFF9F9F9</Color>
<Color x:Key="NinthColor">#FFC4C4C4</Color>
<Style x:Key="ButtonStyle_Primary" TargetType="Button">
<Style TargetType="NavigationPage">
<Setter Property="BarBackgroundColor" Value="{StaticResource SecondColor}"/>
<Setter Property="BarTextColor" Value="{StaticResource FirstColor}"/>
</Style>
<Style TargetType="MasterDetailPage">
<Setter Property="BackgroundColor" Value="{StaticResource EighthColor}"/>
</Style>
<Style TargetType="Label">
<Setter Property="FontFamily" Value="Roboto"/>
</Style>
<Style x:Key="NavigationSpacer" TargetType="BoxView">
<Setter Property="HorizontalOptions" Value="CenterAndExpand"/>
</Style>
<Style x:Key="Style_StackLayout_Content" TargetType="StackLayout">
<Setter Property="Padding" Value="30, 30, 30, 10"/>
</Style>
<!-- Header -->
<Style x:Key="Style_Label_Header" TargetType="Label">
<Setter Property="FontAttributes" Value="Bold"/>
<Setter Property="HorizontalOptions" Value="FillAndExpand"/>
<Setter Property="HorizontalTextAlignment" Value="Center"/>
<Setter Property="VerticalTextAlignment" Value="Center"/>
<Setter Property="VerticalOptions" Value="FillAndExpand"/>
<Setter Property="FontSize" Value="Medium"/>
<Setter Property="TextColor" Value="{StaticResource FirstColor}"/>
</Style>
<!-- Text -->
<Style x:Key="Style_Label_Title_Center" TargetType="Label">
<Setter Property="HorizontalOptions" Value="CenterAndExpand"/>
<Setter Property="FontAttributes" Value="Bold"/>
<Setter Property="FontSize" Value="Medium"/>
<Setter Property="Margin" Value="0, 0, 0, 10"/>
</Style>
<Style x:Key="Style_Label_Text" TargetType="Label">
<Setter Property="Margin" Value="0, 0, 0, 10"/>
<Setter Property="HorizontalOptions" Value="CenterAndExpand"/>
</Style>
<Style x:Key="Style_Label_Property_Title" TargetType="Label">
<Setter Property="FontSize" Value="Default"/>
<Setter Property="FontAttributes" Value="Bold"/>
</Style>
<!-- Button -->
<Style x:Key="Style_Button_Primary" TargetType="Button">
<Setter Property="TextColor" Value="#000000" />
<Setter Property="BackgroundColor" Value="{StaticResource FirstColor}" />
<Setter Property="VerticalOptions" Value="End"/>
</Style>
<Style x:Key="ButtonStyle_Admin" TargetType="Button">
@ -34,25 +87,12 @@
<Setter Property="VerticalTextAlignment" Value="Center"/>
</Style>
<Style TargetType="NavigationPage">
<Setter Property="BarBackgroundColor" Value="{StaticResource SeventhColor}"/>
<Setter Property="BarTextColor" Value="{StaticResource FirstColor}"/>
</Style>
<Style TargetType="MasterDetailPage">
<Setter Property="BackgroundColor" Value="{StaticResource EighthColor}"/>
</Style>
<Style x:Key="LabelStyle_Title" TargetType="Label">
<Setter Property="FontSize" Value="Medium"/>
<Setter Property="HorizontalTextAlignment" Value="Center"/>
<Setter Property="FontAttributes" Value="Bold"/>
</Style>
<Style x:Key="LabelStyle_PropertyTitle" TargetType="Label">
<Setter Property="FontSize" Value="Default"/>
<Setter Property="FontAttributes" Value="Bold"/>
</Style>
<Style x:Key="LabelStyle_PropertyText" TargetType="Label">
<Setter Property="FontSize" Value="Default"/>
</Style>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Borepin.View.IsBusyView">
<ContentView.Content>
<StackLayout>
<Label Text="IsBusy" />
</StackLayout>
</ContentView.Content>
</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 Borepin.View
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class IsBusyView : ContentView
{
public IsBusyView()
{
InitializeComponent();
}
}
}

View File

@ -25,7 +25,7 @@
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="1" Text="{Binding Name}" Style="{StaticResource LabelStyle_Primary}"/>
<Label Grid.Row="0" Grid.Column="2" Text="{Binding State, Converter={StaticResource MachineStateStringConverter}}" TextColor="{Binding State, Converter={StaticResource MachineStateColorConverter}}" Style="{StaticResource LabelStyle_Second}" HorizontalTextAlignment="End" />
<Button Grid.Row="0" Grid.Column="3" Margin="0, 3, 0, 3" Text="->" Command="{Binding Source={RelativeSource AncestorType={x:Type pagemodel:MachineListPageModel}}, Path=SelectInstanceCommand}" CommandParameter="{Binding .}" Style="{StaticResource ButtonStyle_Primary}"/>
<Button Grid.Row="0" Grid.Column="3" Margin="0, 3, 0, 3" Text="->" Command="{Binding Source={RelativeSource AncestorType={x:Type pagemodel:MachineListPageModel}}, Path=SelectInstanceCommand}" CommandParameter="{Binding .}" Style="{StaticResource Style_Button_Primary}"/>
<BoxView Grid.Row="1" Grid.ColumnSpan="5" BackgroundColor="{StaticResource FifthColor}"/>
</Grid>
</ContentView.Content>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Borepin.View.ScanView">
<ContentView.Content>
<Frame BackgroundColor="{StaticResource SecondColor}" CornerRadius="0" HeightRequest="200" Padding="10" Margin="0, 0, 0, 10">
<Frame BackgroundColor="{StaticResource FirstColor}" CornerRadius="5" Padding="7.5">
<Frame BackgroundColor="{StaticResource SecondColor}" CornerRadius="3">
</Frame>
</Frame>
</Frame>
</ContentView.Content>
</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 Borepin.View
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ScanView : ContentView
{
public ScanView()
{
InitializeComponent();
}
}
}

View File

@ -18,7 +18,7 @@
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="1" Text="{Binding Instance.Address, StringFormat='{0}'}" Style="{StaticResource LabelStyle_Primary}"/>
<Label Grid.Row="0" Grid.Column="2" Text="{Binding Instance.Username}" Style="{StaticResource LabelStyle_Second}" HorizontalTextAlignment="End" />
<Button Grid.Row="0" Grid.Column="3" Margin="0, 3, 0, 3" Text="->" Command="{Binding Source={RelativeSource AncestorType={x:Type pagemodel:ServerListPageModel}}, Path=SelectInstanceCommand}" CommandParameter="{Binding .}" Style="{StaticResource ButtonStyle_Primary}"/>
<Button Grid.Row="0" Grid.Column="3" Margin="0, 3, 0, 3" Text="->" Command="{Binding Source={RelativeSource AncestorType={x:Type pagemodel:ServerListPageModel}}, Path=SelectInstanceCommand}" CommandParameter="{Binding .}" Style="{StaticResource Style_Button_Primary}"/>
<BoxView Grid.Row="1" Grid.ColumnSpan="5" BackgroundColor="{StaticResource FifthColor}"/>
</Grid>
</ContentView.Content>

View File

@ -113,6 +113,22 @@ namespace FabAccessAPI
return writeCap.Use();
}
/// <summary>
/// Try to get a GiveBack capability for a machine.
/// </summary>
/// <returns>Capability to give back the machine or null</returns>
/// <exception cref="UnauthorizedException"></exception>
public Task<Schema.Machine.WriteInterface.IGiveBack> GetGiveBack()
{
var writeCap = _machine.Write;
if (writeCap == null)
{
throw new UnauthorizedException();
}
return writeCap.GetGiveBack();
}
/// <summary>
/// Try to reserve a machine. Throws a UnauthorizedException if the user does not have the required
/// permissions to use this machine.

@ -1 +1 @@
Subproject commit 4adb05341763b96a43440a6a96e0d9959ba71e89
Subproject commit 2dc488d13b2a8eaa743fb759b4929d50843ccb23

View File

@ -1,44 +0,0 @@
using System;
namespace NFC.Crypto
{
/// <summary>
/// CRC16 for DESFire Card
/// </summary>
public class CRC16
{
public UInt16 Polynomial { get; } = 0x8408;
public UInt16 InitValue { get; } = 0x6363;
public UInt16 Calculate(byte[] data, UInt16 crc16)
{
for (int i = 0; i < data.Length; i++)
{
crc16 ^= data[i];
for (int b = 0; b < 8; b++)
{
bool b_Bit = (crc16 & 0x01) > 0;
crc16 >>= 1;
if (b_Bit)
{
crc16 ^= Polynomial;
}
}
}
return crc16;
}
public byte[] Calculate(params byte[][] data)
{
UInt16 crc16 = InitValue;
foreach(byte[] d in data)
{
crc16 = Calculate(d, crc16);
}
return BitConverter.GetBytes(crc16);
}
}
}

View File

@ -1,44 +0,0 @@
using System;
namespace NFC.Crypto
{
/// <summary>
/// CRC32 for DESFire Card
/// </summary>
public class CRC32
{
public UInt32 Polynomial { get; } = 0xEDB88320;
public UInt32 InitValue { get; } = 0xFFFFFFFF;
public UInt32 Calculate(byte[] data, UInt32 crc32)
{
for (int i = 0; i < data.Length; i++)
{
crc32 ^= data[i];
for (int b = 0; b < 8; b++)
{
bool b_Bit = (crc32 & 0x01) > 0;
crc32 >>= 1;
if (b_Bit)
{
crc32 ^= Polynomial;
}
}
}
return crc32;
}
public byte[] Calculate(params byte[][] data)
{
UInt32 crc32 = InitValue;
foreach(byte[] d in data)
{
crc32 = Calculate(d, crc32);
}
return BitConverter.GetBytes(crc32);
}
}
}

View File

@ -1,48 +0,0 @@
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Engines;
using Org.BouncyCastle.Crypto.Modes;
using Org.BouncyCastle.Crypto.Parameters;
namespace NFC.Crypto
{
public class AES : ICipher
{
public uint BlockSize { get; } = 16;
public uint KeySize { get; } = 16;
public byte[] Encrypt(byte[] data, byte[] key, byte[] iv)
{
AesEngine engine = new AesEngine();
CbcBlockCipher blockCipher = new CbcBlockCipher(engine);
BufferedBlockCipher cipher = new BufferedBlockCipher(blockCipher);
KeyParameter keyParam = new KeyParameter(key);
ParametersWithIV keyParamWithIV = new ParametersWithIV(keyParam, iv);
// Encrypt
cipher.Init(true, keyParamWithIV);
byte[] outputBytes = new byte[cipher.GetOutputSize(data.Length)];
int length = cipher.ProcessBytes(data, outputBytes, 0);
cipher.DoFinal(outputBytes, length);
return outputBytes;
}
public byte[] Decrypt(byte[] data, byte[] key, byte[] iv)
{
AesEngine engine = new AesEngine();
CbcBlockCipher blockCipher = new CbcBlockCipher(engine);
BufferedBlockCipher cipher = new BufferedBlockCipher(blockCipher);
KeyParameter keyParam = new KeyParameter(key);
ParametersWithIV keyParamWithIV = new ParametersWithIV(keyParam, iv);
// Decrypt
cipher.Init(false, keyParamWithIV);
byte[] outputBytes = new byte[cipher.GetOutputSize(data.Length)];
int length = cipher.ProcessBytes(data, outputBytes, 0);
cipher.DoFinal(outputBytes, length);
return outputBytes;
}
}
}

View File

@ -1,49 +0,0 @@
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Engines;
using Org.BouncyCastle.Crypto.Modes;
using Org.BouncyCastle.Crypto.Parameters;
namespace NFC.Crypto
{
public class TDES : ICipher
{
public uint BlockSize { get; } = 8;
// Two times the DES Key
public uint KeySize { get; } = 16;
public byte[] Encrypt(byte[] data, byte[] key, byte[] iv)
{
DesEngine engine = new DesEdeEngine();
CbcBlockCipher blockCipher = new CbcBlockCipher(engine);
BufferedBlockCipher cipher = new BufferedBlockCipher(blockCipher);
KeyParameter keyParam = new KeyParameter(key);
ParametersWithIV keyParamWithIV = new ParametersWithIV(keyParam, iv);
// Encrypt
cipher.Init(true, keyParamWithIV);
byte[] outputBytes = new byte[cipher.GetOutputSize(data.Length)];
int length = cipher.ProcessBytes(data, outputBytes, 0);
cipher.DoFinal(outputBytes, length);
return outputBytes;
}
public byte[] Decrypt(byte[] data, byte[] key, byte[] iv)
{
DesEngine engine = new DesEdeEngine();
CbcBlockCipher blockCipher = new CbcBlockCipher(engine);
BufferedBlockCipher cipher = new BufferedBlockCipher(blockCipher);
KeyParameter keyParam = new KeyParameter(key);
ParametersWithIV keyParamWithIV = new ParametersWithIV(keyParam, iv);
// Decrypt
cipher.Init(false, keyParamWithIV);
byte[] outputBytes = new byte[cipher.GetOutputSize(data.Length)];
int length = cipher.ProcessBytes(data, outputBytes, 0);
cipher.DoFinal(outputBytes, length);
return outputBytes;
}
}
}

View File

@ -1,48 +0,0 @@
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Engines;
using Org.BouncyCastle.Crypto.Modes;
using Org.BouncyCastle.Crypto.Parameters;
namespace NFC.Crypto
{
public class TDES_2K : ICipher
{
public uint BlockSize { get; } = 8;
public uint KeySize { get; } = 16;
public byte[] Encrypt(byte[] data, byte[] key, byte[] iv)
{
DesEngine engine = new DesEdeEngine();
CbcBlockCipher blockCipher = new CbcBlockCipher(engine);
BufferedBlockCipher cipher = new BufferedBlockCipher(blockCipher);
KeyParameter keyParam = new KeyParameter(key);
ParametersWithIV keyParamWithIV = new ParametersWithIV(keyParam, iv);
// Encrypt
cipher.Init(true, keyParamWithIV);
byte[] outputBytes = new byte[cipher.GetOutputSize(data.Length)];
int length = cipher.ProcessBytes(data, outputBytes, 0);
cipher.DoFinal(outputBytes, length);
return outputBytes;
}
public byte[] Decrypt(byte[] data, byte[] key, byte[] iv)
{
DesEngine engine = new DesEdeEngine();
CbcBlockCipher blockCipher = new CbcBlockCipher(engine);
BufferedBlockCipher cipher = new BufferedBlockCipher(blockCipher);
KeyParameter keyParam = new KeyParameter(key);
ParametersWithIV keyParamWithIV = new ParametersWithIV(keyParam, iv);
// Decrypt
cipher.Init(false, keyParamWithIV);
byte[] outputBytes = new byte[cipher.GetOutputSize(data.Length)];
int length = cipher.ProcessBytes(data, outputBytes, 0);
cipher.DoFinal(outputBytes, length);
return outputBytes;
}
}
}

View File

@ -1,48 +0,0 @@
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Engines;
using Org.BouncyCastle.Crypto.Modes;
using Org.BouncyCastle.Crypto.Parameters;
namespace NFC.Crypto
{
public class TDES_3K : ICipher
{
public uint BlockSize { get; } = 8;
public uint KeySize { get; } = 24;
public byte[] Encrypt(byte[] data, byte[] key, byte[] iv)
{
DesEngine engine = new DesEdeEngine();
CbcBlockCipher blockCipher = new CbcBlockCipher(engine);
BufferedBlockCipher cipher = new BufferedBlockCipher(blockCipher);
KeyParameter keyParam = new KeyParameter(key);
ParametersWithIV keyParamWithIV = new ParametersWithIV(keyParam, iv);
// Encrypt
cipher.Init(true, keyParamWithIV);
byte[] outputBytes = new byte[cipher.GetOutputSize(data.Length)];
int length = cipher.ProcessBytes(data, outputBytes, 0);
cipher.DoFinal(outputBytes, length);
return outputBytes;
}
public byte[] Decrypt(byte[] data, byte[] key, byte[] iv)
{
DesEngine engine = new DesEdeEngine();
CbcBlockCipher blockCipher = new CbcBlockCipher(engine);
BufferedBlockCipher cipher = new BufferedBlockCipher(blockCipher);
KeyParameter keyParam = new KeyParameter(key);
ParametersWithIV keyParamWithIV = new ParametersWithIV(keyParam, iv);
// Decrypt
cipher.Init(false, keyParamWithIV);
byte[] outputBytes = new byte[cipher.GetOutputSize(data.Length)];
int length = cipher.ProcessBytes(data, outputBytes, 0);
cipher.DoFinal(outputBytes, length);
return outputBytes;
}
}
}

View File

@ -1,182 +0,0 @@
using System;
namespace NFC.Crypto
{
/// <summary>
/// Key for DESFire Card
/// </summary>
public class CipherKey
{
#region Constructors
/// <summary>
/// Creates Key from Array
/// </summary>
/// <param name="key">Key</param>
/// <param name="cipher">Cipher for Key</param>
/// <param name="keyVersion">Version of Key</param>
public CipherKey(byte[] key, CipherType cipher, byte keyVersion)
{
_Cipher = cipher;
if (cipher == CipherType.AES && keyVersion < 0x10)
{
throw new ArgumentOutOfRangeException("KeyVersion is to low for AES Key (Minimum = 0x10)");
}
_KeyVersion = keyVersion;
if (!CheckKey(key, cipher))
{
throw new ArgumentException("Key is not vaild for CipherType");
}
if (cipher == CipherType.TDES || cipher == CipherType.TDES_2K || cipher == CipherType.TDES_3K)
{
_Key = SetKeyVersion(key, keyVersion);
}
else
{
_Key = key;
}
}
/// <summary>
/// Creates Key from String
/// </summary>
/// <param name="key">Key</param>
/// <param name="cipher">Cipher for Key</param>
/// <param name="keyVersion">Version of Key</param>
public CipherKey(string key, CipherType cipher, byte keyVersion) : this(HexConverter.ConvertFromHexString(key), cipher, keyVersion)
{
}
/// <summary>
/// Generates Empty Key
/// </summary>
/// <param name="cipher">Cipher for Key</param>
/// <param name="keyVerion"></param>
public CipherKey(CipherType cipher)
{
_Cipher = cipher;
_Key = GenerateEmptyKey(cipher);
if (cipher == CipherType.AES)
{
_KeyVersion = 0x10;
}
else
{
_KeyVersion = 0x00;
}
}
#endregion
#region Properties
/// <summary>
/// Key as Array
/// </summary>
public byte[] _Key { get; private set; }
/// <summary>
/// CipherType of Key
/// </summary>
public CipherType _Cipher { get; private set; }
/// <summary>
/// KeyVersion of Key
/// For AES 0x10 is minimum
/// </summary>
public byte _KeyVersion { get; private set; }
#endregion
#region Methods
/// <summary>
/// Generate Empty Key for CipherType
/// </summary>
/// <param name="cipher">Type of Cipher</param>
public byte[] GenerateEmptyKey(CipherType cipher)
{
uint size = GetKeySize(cipher);
byte[] key = new byte[size];
for (int i = 0; i < size; i++)
{
key[i] = 0;
}
return key;
}
/// <summary>
/// Check Key Array
/// </summary>
/// <param name="key">Key</param>
/// <param name="cipher">Cipher Type of Key</param>
public bool CheckKey(byte[] key, CipherType cipher)
{
if (key.Length != GetKeySize(cipher))
{
return false;
}
else
{
return true;
}
}
/// <summary>
/// Get KeySize for CipherType
/// </summary>
/// <param name="cipher">Type of Cipher</param>
public uint GetKeySize(CipherType cipher)
{
switch (cipher)
{
case CipherType.TDES:
return 16;
case CipherType.TDES_2K:
return 16;
case CipherType.TDES_3K:
return 24;
case CipherType.AES:
return 16;
default:
throw new ArgumentOutOfRangeException("Unknown CipherType.");
}
}
/// <summary>
/// Set Key Version for DES/TDES Keys
/// KeyVersion is stored in the LSBits of the first 8 Bytes
/// Parity Bits are not used from DESFire Cars
/// </summary>
/// <param name="key"></param>
/// <param name="version"></param>
/// <returns></returns>
public byte[] SetKeyVersion(byte[] key, byte version)
{
byte[] pow2 = new byte[]
{
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80
};
byte[] new_key = new byte[key.Length];
key.CopyTo(new_key, 0);
for (int i = 0; i < 8; i++)
{
if ((version & pow2[i]) > 0)
{
new_key[i] = (byte)(new_key[5] | 0x01);
}
else
{
new_key[i] = (byte)(new_key[5] & 0x7F);
}
}
return new_key;
}
#endregion
}
}

View File

@ -1,25 +0,0 @@
namespace NFC.Crypto
{
public enum CipherType
{
/// <summary>
/// DES / Triple DES
/// </summary>
TDES,
/// <summary>
/// Triple DES with 2 DES Keys
/// </summary>
TDES_2K,
/// <summary>
/// Triple DES with 3 DES Keys
/// </summary>
TDES_3K,
/// <summary>
/// AES
/// </summary>
AES
}
}

View File

@ -1,32 +0,0 @@
namespace NFC.Crypto
{
public interface ICipher
{
/// <summary>
/// Size of Cipher Block in Byte
/// </summary>
public uint BlockSize { get; }
/// <summary>
/// Size of Key in Byte
/// </summary>
public uint KeySize { get; }
/// <summary>
/// Encrypt Data
/// </summary>
/// <param name="data">Data in BlockSize</param>
/// <param name="key">Key</param>
/// <param name="IV">Initialisation Vector</param>
/// <returns></returns>
public byte[] Encrypt(byte[] data, byte[] key, byte[] IV);
/// <summary>
/// Decrypt Data
/// </summary>
/// <param name="data">Data in BlockSize</param>
/// <param name="key">Key</param>
/// <param name="IV">Initialisation Vector</param>
public byte[] Decrypt(byte[] data, byte[] key, byte[] IV);
}
}

View File

@ -1,51 +0,0 @@
using System;
namespace NFC
{
/// <summary>
/// Converts to and from Byte Array from and to String
/// </summary>
public static class HexConverter
{
/// <summary>
/// Converts byte[] to string with HEX Code
/// No 0x is created
/// </summary>
/// <param name="data">Data</param>
public static string ConvertToHexString(byte[] data)
{
return BitConverter.ToString(data).Replace("-", "").ToLower();
}
/// <summary>
/// Converts string with HEX Code to byte[]
/// No 0x is requiered
/// </summary>
/// <param name="data">Data</param>
public static byte[] ConvertFromHexString(string data)
{
if (data.Length % 2 == 1)
throw new Exception("Data Length is uneven.");
byte[] arr = new byte[data.Length >> 1];
for (int i = 0; i < data.Length >> 1; ++i)
{
arr[i] = (byte)((GetHexVal(data[i << 1]) << 4) + (GetHexVal(data[(i << 1) + 1])));
}
return arr;
}
private static int GetHexVal(char hex)
{
int val = (int)hex;
//For uppercase A-F letters:
//return val - (val < 58 ? 48 : 55);
//For lowercase a-f letters:
//return val - (val < 58 ? 48 : 87);
//Or the two combined, but a bit slower:
return val - (val < 58 ? 48 : (val < 97 ? 55 : 87));
}
}
}

View File

@ -1,77 +0,0 @@
using System;
using NFC.ISO7816_4;
namespace NFC
{
/// <summary>
/// Abstract representation of the platform specific NFC Hardware.
/// </summary>
public interface IHardware
{
/// <summary>
/// Check if the device has nfc support.
/// </summary>
/// <returns>Returns true if the device supports NFC.</returns>
bool IsAvailable();
/// <returns>Returns all available readers.</returns>
string[] GetReaders();
/// <summary>
/// Create a new reader instance from the specified id.
/// </summary>
/// <returns>Returns the spatform specific reader that corresponds to the id.</returns>
/// <exception cref="ArgumentException">Invalid reader id.</exception>
IReader OpenReader(string readerID);
}
public delegate void ReaderEventHandler(object sender, ICard card);
/// <summary>
/// Abstraction of a platform-specifc reader that can communicate with NFC cards.
/// </summary>
public interface IReader
{
/// <summary>
/// Event that will be called when a new tag was discovered.
/// </summary>
event ReaderEventHandler CardDiscovered;
/// <summary>
/// Event that will be called when a tag that is in use gets disconnected.
/// </summary>
event ReaderEventHandler CardLost;
void Start();
void Stop();
}
public interface ICard
{
/// <summary>
/// Connect to Smartcard
/// </summary>
void Connect();
/// <summary>
/// Disconnect from Smartcard
/// </summary>
void Disconnect();
/// <summary>
/// Transmit APDU Command to Smartcard
/// </summary>
/// <param name="apdu_cmd">Application Protocol Data Unit Command - ISO 7816</param>
/// <returns>Application Protocol Data Unit Response - ISO 7816</returns>
APDUResponse Transmit(APDUCommand apdu_cmd);
}
public class ReaderUnavailableException : Exception { }
public class CardUnavailableException : Exception { }
public class APDUException : Exception {
public readonly byte ResponseCode;
}
}

View File

@ -1,83 +0,0 @@
using PCSC;
using PCSC.Iso7816;
using System;
using System.Linq;
namespace NFC.ISO7816_4
{
public class APDUCommand : CommandApdu
{
public APDUCommand(IsoCase isoCase) : base(isoCase, SCardProtocol.Any)
{
}
public override bool Equals(object obj)
{
return obj is APDUCommand command &&
Case == command.Case &&
Protocol == command.Protocol &&
CLA == command.CLA &&
INS == command.INS &&
P1 == command.P1 &&
P2 == command.P2 &&
Data.SequenceEqual(command.Data) &&
Le == command.Le;
}
public override int GetHashCode()
{
HashCode hash = new HashCode();
hash.Add(Case);
hash.Add(Protocol);
hash.Add(IsValid);
hash.Add(CLA);
hash.Add(INS);
hash.Add(P1);
hash.Add(P2);
hash.Add(P1P2);
hash.Add(Data);
hash.Add(Lc);
hash.Add(P3);
hash.Add(Le);
hash.Add(ExpectedResponseLength);
hash.Add(IsValid);
return hash.ToHashCode();
}
public static bool operator ==(APDUCommand obj1, APDUCommand obj2)
{
return obj1.Equals(obj2);
}
public static bool operator !=(APDUCommand obj1, APDUCommand obj2)
{
return !(obj1.Equals(obj2));
}
public override string ToString()
{
string pattern_case1 = "(CASE: 1) CLA: 0x{0:x} | INS: 0x{1:x} | P1: 0x{2:x} | P2: 0x{3:x}";
string pattern_case2 = "(CASE: 2) CLA: 0x{0:x} | INS: 0x{1:x} | P1: 0x{2:x} | P2: 0x{3:x} | LE: 0x{4:x} |";
string pattern_case3 = "(CASE: 3) CLA: 0x{0:x} | INS: 0x{1:x} | P1: 0x{2:x} | P2: 0x{3:x} | LC: 0x{4:x} | Data: {5:x}";
string pattern_case4 = "(CASE: 4) CLA: 0x{0:x} | INS: 0x{1:x} | P1: 0x{2:x} | P2: 0x{3:x} | LC: 0x{4:x} | Data: {5:x} | LE: 0x{6:x} |";
switch (Case)
{
case IsoCase.Case1:
return string.Format(pattern_case1, CLA, INS, P1, P2);
case IsoCase.Case2Short:
case IsoCase.Case2Extended:
return string.Format(pattern_case2, CLA, INS, P1, P2, Le);
case IsoCase.Case3Short:
case IsoCase.Case3Extended:
return string.Format(pattern_case3, CLA, INS, P1, P2, Lc, BitConverter.ToString(Data).Replace("-", "").ToLower());
case IsoCase.Case4Short:
case IsoCase.Case4Extended:
return string.Format(pattern_case4, CLA, INS, P1, P2, Lc, BitConverter.ToString(Data).Replace("-", "").ToLower(), Le);
default:
throw new Exception("Unknown IsoCase");
}
}
}
}

View File

@ -1,161 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using NFC.Mifare_DESFire;
namespace NFC.ISO7816_4
{
public class APDUResponse
{
#region constructor
public APDUResponse()
{
}
/// <summary>
/// Creates a new APDUResponse from the raw received data.
/// </summary>
public APDUResponse(byte[] raw)
{
Body = raw.Take(raw.Length - 1).ToArray();
SW1 = raw[raw.Length - 2];
SW2 = raw[raw.Length - 3];
}
#endregion
#region Properties
/// <summary>
/// ISO 7816-4-4 - Body - Body
/// </summary>
public byte[] Body { get; set; }
/// <summary>
/// ISO 7816-4 - SW1 - Status Word 1
/// </summary>
public byte SW1 { get; set; }
/// <summary>
/// ISO 7816-4 - SW2 - Status Word 2
/// </summary>
public byte SW2 { get; set; }
public APDUStatusWords StatusWord
{
get
{
// Some status words only require a specific first byte
// and in some cases SW2 contains additional information.
// This will filter out those errors. When there is more information separate methods for getting those are available.
switch(SW1) {
case 0x61:
// Kommando erfolgreich ausgeführt. xx Datenbytes können mit dem GET RESPONSE-Kommando abgeholt werden. Statuswort zur Steuerung des T=0-Protokolls
return APDUStatusWords.DATA_READY;
case 0x62:
// Warnung; Zustand des nichtflüchtigen Speichers nicht verändert
return APDUStatusWords.STORAGE_NOT_CHANGED;
case 0x63:
if((SW2 & 0xF0) == 0xC0) {
// Zähler hat den Wert x erreicht (die genaue Bedeutung ist vom Kommando abhängig)
return APDUStatusWords.COUNTER_REACHED;
}
// Warnung; Zustand des nichtflüchtigen Speichers verändert
return APDUStatusWords.STORAGE_CHANGED;
case 0x64:
// Ausführungsfehler; Zustand des nichtflüchtigen Speichers nicht verändert
return APDUStatusWords.EXECUTION_ERROR_WITHOUT_CHANGE;
case 0x65:
// Ausführungsfehler; Zustand des nichtflüchtigen Speichers verändert
return APDUStatusWords.EXECUTION_ERROR_WITH_CHANGE;
case 0x6C:
// Falsche Länge Le; xx gibt die korrekte Länge an Statuswort zur Steuerung des T=0-Protokolls
return APDUStatusWords.INVALID_LE;
}
return (APDUStatusWords) (((UInt16) SW1) << 8 | ((UInt16) SW2));
}
}
/// <summary>
/// If the reponse status is DATA_READY this method can be used to get the amount of data that can be read from the card.
/// </summary>
public byte DataLength
{
get
{
return SW2;
}
}
/// <summary>
/// If the reponse status is COUNTER_REACHED this method can be used to get the value that the counter reached.
/// </summary>
public byte Counter
{
get
{
return (byte)(SW2 & 0x0F);
}
}
/// <summary>
/// If the reponse status is INVALID_LE this method can be used to get the correct LE.
/// </summary>
public byte CorrectLE
{
get
{
return SW2;
}
}
#endregion
#region Methodes
public byte[] ToArray()
{
byte[] array = null;
if (Body != null)
{
array = new byte[Body.Length + 2];
Body.CopyTo(array, 0);
array[Body.Length] = SW1;
array[Body.Length + 1] = SW2;
}
else
{
array = new byte[2];
array[0] = SW1;
array[1] = SW2;
}
return array;
}
public override bool Equals(object obj)
{
return obj is APDUResponse response &&
EqualityComparer<byte[]>.Default.Equals(Body, response.Body) &&
SW1 == response.SW1 &&
SW2 == response.SW2;
}
public override int GetHashCode()
{
return HashCode.Combine(Body, SW1, SW2);
}
public override string ToString()
{
if(Body == null)
{
return string.Format("SW1: 0x{0:x} | SW2: 0x{1:x}", SW1, SW2);
}
else
{
return string.Format("SW1: 0x{0:x} | SW2: 0x{1:x} | Body: {2:x}", SW1, SW2, BitConverter.ToString(Body).Replace("-", "").ToLower());
}
}
#endregion
}
}

View File

@ -1,212 +0,0 @@
using System;
namespace NFC.Mifare_DESFire
{
public enum APDUStatusWords : UInt16
{
/// <summary>
/// Kommando erfolgreich ausgeführt. xx Datenbytes können mit dem GET RESPONSE-Kommando abgeholt werden. Statuswort zur Steuerung des T=0-Protokolls
/// </summary>
DATA_READY = 0x6100,
/// <summary>
/// Die zurückgegebenen Daten können fehlerhaft sein.
/// </summary>
FAULTY_DATA = 0x6281,
/// <summary>
/// Da das Dateiende vorher erreicht wurde, konnten nur weniger als Le Bytes gelesen werden.
/// </summary>
UNEXPECTED_END_OF_FILE = 0x6282,
/// <summary>
/// Die ausgewählte Datei ist gesperrt (englisch invalidated, wörtlich „ungültig“).
/// </summary>
INVALIDATED_FILE = 0x6283,
/// <summary>
/// Die File Control Information (FCI) ist inkonform zu ISO 7816-4.
/// </summary>
FCI_NOT_CONFORM = 0x6284,
/// <summary>
/// Warnung; Zustand des nichtflüchtigen Speichers nicht verändert
/// </summary>
STORAGE_NOT_CHANGED = 0x6200,
/// <summary>
/// Zähler hat den Wert x erreicht (die genaue Bedeutung ist vom Kommando abhängig)
/// </summary>
COUNTER_REACHED = 0x63C0,
/// <summary>
/// Warnung; Zustand des nichtflüchtigen Speichers verändert
/// </summary>
STORAGE_CHANGED = 0x6300,
/// <summary>
/// Ausführungsfehler; Zustand des nichtflüchtigen Speichers nicht verändert
/// </summary>
EXECUTION_ERROR_WITHOUT_CHANGE = 0x6400,
/// <summary>
/// Speicherfehler
/// </summary>
MEMORY_ERROR = 0x6581,
/// <summary>
/// Ausführungsfehler; Zustand des nichtflüchtigen Speichers verändert
/// </summary>
EXECUTION_ERROR_WITH_CHANGE = 0x6500,
/// <summary>
/// Befehlslänge (Lc) oder erwartete Antwortlänge (Le) falsch
/// </summary>
INVALID_LC_LE = 0x6700,
/// <summary>
/// Funktionen im Class-Byte werden nicht unterstützt
/// </summary>
CLASS_FEATURE_NOT_SUPPORTED = 0x6800,
/// <summary>
/// Logische Kanäle werden nicht unterstützt
/// </summary>
LOGIC_CHANNEL_NOT_SUPPORTED = 0x6881,
/// <summary>
/// Secure Messaging wird nicht unterstützt
/// </summary>
SECURE_MESSAGING_NOT_SUPPORTED = 0x6882,
/// <summary>
/// Kommando nicht erlaubt
/// </summary>
COMMAND_NOT_ALLOWED = 0x6900,
/// <summary>
/// Kommando inkompatibel zur Dateistruktur
/// </summary>
COMMAND_INCOMPATIBLE = 0x6981,
/// <summary>
/// Sicherheitszustand nicht erfüllt
/// </summary>
SAFETY_STATUS_NOT_FULFILLED = 0x6982,
/// <summary>
/// Authentisierungsmethode ist gesperrt
/// </summary>
AUTHENTICATION_METHOD_LOCKED = 0x6983,
/// <summary>
/// Referenzierte Daten sind gesperrt
/// </summary>
REFERENCED_FILE_LOCKED = 0x6984,
/// <summary>
/// Nutzungsbedingungen sind nicht erfüllt
/// </summary>
TERMS_OF_SERVICE_NOT_FULFILLED = 0x6985,
/// <summary>
/// Kommando nicht erlaubt (kein EF selektiert)
/// </summary>
COMMAND_NOT_ALLOWED_NO_EF_SELECTED = 0x6986,
/// <summary>
/// Erwartete Secure-Messaging-Objekte nicht gefunden
/// </summary>
EXPECTED_SECURE_MESSAGING_OBJECTS_NOT_FOUND = 0x6987,
/// <summary>
/// Secure-Messaging-Datenobjekte sind inkorrekt
/// </summary>
INVALID_SECURE_MESSAGING_OBJECTS = 0x6988,
/// <summary>
/// Falsche Parameter P1/P2
/// </summary>
WRONG_PARAMETERS = 0x6A00,
/// <summary>
/// Falsche Daten
/// </summary>
WRONG_DATA = 0x6A80,
/// <summary>
/// Funktion wird nicht unterstützt
/// </summary>
FEATURE_NOT_SUPPORTED = 0x6A81,
/// <summary>
/// Datei wurde nicht gefunden
/// </summary>
FILE_NOT_FOUND = 0x6A82,
/// <summary>
/// Datensatz (engl. record) der Datei nicht gefunden
/// </summary>
RECORD_NOT_FOUND = 0x6A83,
/// <summary>
/// Nicht genügend Speicherplatz in der Datei
/// </summary>
INSUFFICIENT_SPACE = 0x6A84,
/// <summary>
/// Lc nicht konsistent mit der TLV-Struktur
/// </summary>
LC_TLV_INCONSISTENT = 0x6A85,
/// <summary>
/// Inkorrekte Parameter P1/P2
/// </summary>
INCORRECT_PARAMETERs = 0x6A86,
/// <summary>
/// Lc inkonsistent mit P1/P2
/// </summary>
LC_PARAMETERS_INCONSISTENT = 0x6A87,
/// <summary>
/// Referenzierte Daten nicht gefunden
/// </summary>
REFERENCED_FILE_NOT_FOUND = 0x6A88,
/// <summary>
/// Parameter P1/P2 falsch
/// </summary>
WRONG_PARAMETERS_2 = 0x6B00,
/// <summary>
/// Falsche Länge Le; xx gibt die korrekte Länge an Statuswort zur Steuerung des T=0-Protokolls
/// </summary>
INVALID_LE = 0x6C00,
/// <summary>
/// Das Kommando (INS) wird nicht unterstützt
/// </summary>
INSTRUCTION_NOT_SUPPORTED = 0x6D00,
/// <summary>
/// Die Kommandoklasse (CLA) wird nicht unterstützt
/// </summary>
CLASS_NOT_SUPPORTED = 0x6E00,
/// <summary>
/// Kommando wurde mit unbekanntem Fehler abgebrochen
/// </summary>
UNKNOWN_ERROR = 0x6F00,
/// <summary>
/// Kommando erfolgreich ausgeführt
/// </summary>
SUCCESS = 0x9000,
/// <summary>
/// OK
/// </summary>
OK = 0x9100,
}
}

View File

@ -1,13 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="log4net" Version="2.0.12" />
<PackageReference Include="PCSC" Version="5.0.0" />
<PackageReference Include="PCSC.Iso7816" Version="5.0.0" />
<PackageReference Include="Portable.BouncyCastle" Version="1.8.9" />
</ItemGroup>
</Project>

Some files were not shown because too many files have changed in this diff Show More