mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-03-12 14:51:44 +01:00
Merge branch 'main' into feature/NFC
This commit is contained in:
commit
0e92447a3e
@ -76,11 +76,7 @@
|
|||||||
<Compile Include="PlatformInitializer.cs" />
|
<Compile Include="PlatformInitializer.cs" />
|
||||||
<Compile Include="Resources\Resource.designer.cs" />
|
<Compile Include="Resources\Resource.designer.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Services\APIBinder.cs" />
|
|
||||||
<Compile Include="Services\APIBindedService.cs" />
|
|
||||||
<Compile Include="Services\APIService.cs" />
|
<Compile Include="Services\APIService.cs" />
|
||||||
<Compile Include="Services\APIService_New.cs" />
|
|
||||||
<Compile Include="Services\APIServiceConnection.cs" />
|
|
||||||
<Compile Include="Services\BrowserService.cs" />
|
<Compile Include="Services\BrowserService.cs" />
|
||||||
<Compile Include="Services\PreferenceStorageService.cs" />
|
<Compile Include="Services\PreferenceStorageService.cs" />
|
||||||
<Compile Include="Services\SecretStorage.cs" />
|
<Compile Include="Services\SecretStorage.cs" />
|
||||||
|
@ -1,50 +0,0 @@
|
|||||||
using Android.App;
|
|
||||||
using Android.Content;
|
|
||||||
using Android.OS;
|
|
||||||
using FabAccessAPI;
|
|
||||||
|
|
||||||
namespace Borepin.Droid.Services
|
|
||||||
{
|
|
||||||
[Service(Name= "org.fab_infra.fabaccess.APIService")]
|
|
||||||
public class APIBindedService : Android.App.Service
|
|
||||||
{
|
|
||||||
#region Private Members
|
|
||||||
private IAPI _API;
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Members
|
|
||||||
public IBinder Binder { get; private set; }
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
public IAPI GetAPI()
|
|
||||||
{
|
|
||||||
return _API;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnCreate()
|
|
||||||
{
|
|
||||||
base.OnCreate();
|
|
||||||
_API = new API();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override IBinder OnBind(Intent intent)
|
|
||||||
{
|
|
||||||
Binder = new APIBinder(this);
|
|
||||||
return Binder;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool OnUnbind(Intent intent)
|
|
||||||
{
|
|
||||||
return base.OnUnbind(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnDestroy()
|
|
||||||
{
|
|
||||||
Binder = null;
|
|
||||||
_API = null;
|
|
||||||
base.OnDestroy();
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
using Android.OS;
|
|
||||||
|
|
||||||
namespace Borepin.Droid.Services
|
|
||||||
{
|
|
||||||
public class APIBinder : Binder
|
|
||||||
{
|
|
||||||
#region Constructors
|
|
||||||
public APIBinder(APIBindedService service)
|
|
||||||
{
|
|
||||||
Service = service;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Members
|
|
||||||
public APIBindedService Service { get; private set; }
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
using Android.Content;
|
|
||||||
using Android.OS;
|
|
||||||
using FabAccessAPI;
|
|
||||||
|
|
||||||
namespace Borepin.Droid.Services
|
|
||||||
{
|
|
||||||
class APIServiceConnection : Java.Lang.Object, IServiceConnection
|
|
||||||
{
|
|
||||||
#region Members
|
|
||||||
public bool IsConnected
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Binder != null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public APIBinder Binder { get; private set; } = null;
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
public void OnServiceConnected(ComponentName name, IBinder service)
|
|
||||||
{
|
|
||||||
Binder = service as APIBinder;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnServiceDisconnected(ComponentName name)
|
|
||||||
{
|
|
||||||
Binder = null;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
using Android.App;
|
|
||||||
using Android.Content;
|
|
||||||
using Borepin.Service;
|
|
||||||
using FabAccessAPI;
|
|
||||||
|
|
||||||
namespace Borepin.Droid.Services
|
|
||||||
{
|
|
||||||
public class APIService_New : IAPIService
|
|
||||||
{
|
|
||||||
#region Private Members
|
|
||||||
private readonly APIServiceConnection _APIServiceConnection;
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
public APIService_New()
|
|
||||||
{
|
|
||||||
Context context = Application.Context;
|
|
||||||
Intent service = new Intent(context, typeof(APIBindedService));
|
|
||||||
context.BindService(service, _APIServiceConnection, Bind.AutoCreate);
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
public IAPI GetAPI()
|
|
||||||
{
|
|
||||||
return _APIServiceConnection?.Binder?.Service?.GetAPI();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -65,7 +65,6 @@ namespace Borepin
|
|||||||
|
|
||||||
#region Register Dialog
|
#region Register Dialog
|
||||||
containerRegistry.RegisterDialog<ConfirmDialog, ConfirmDialogModel>();
|
containerRegistry.RegisterDialog<ConfirmDialog, ConfirmDialogModel>();
|
||||||
containerRegistry.RegisterDialog<ScanDialog, ScanDialogModel>();
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Register Service
|
#region Register Service
|
||||||
|
@ -99,9 +99,6 @@
|
|||||||
<EmbeddedResource Update="Dialog\ConfirmDialog.xaml">
|
<EmbeddedResource Update="Dialog\ConfirmDialog.xaml">
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Update="Dialog\ScanDialog.xaml">
|
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<EmbeddedResource Update="Page\AddServerProcess\SelectServerPage.xaml">
|
<EmbeddedResource Update="Page\AddServerProcess\SelectServerPage.xaml">
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
|
||||||
xmlns:zxing="clr-namespace:ZXing.Net.Mobile.Forms;assembly=ZXing.Net.Mobile.Forms"
|
|
||||||
x:Class="Borepin.Dialog.ScanDialog"
|
|
||||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text">
|
|
||||||
<ContentView.Content>
|
|
||||||
<StackLayout IsVisible="{Binding IsVisible}">
|
|
||||||
<zxing:ZXingScannerView Result="{Binding ScanResult, Mode=TwoWay}" ScanResultCommand="{Binding ScannedCommand}" IsScanning="{Binding IsScanning}" WidthRequest="300" HeightRequest="500" VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand"/>
|
|
||||||
<Button Text="{x:Static resource_text:TextResource.CANCEL}" Command="{Binding AbortCommand}"/>
|
|
||||||
</StackLayout>
|
|
||||||
</ContentView.Content>
|
|
||||||
</ContentView>
|
|
@ -1,20 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
using Xamarin.Forms;
|
|
||||||
using Xamarin.Forms.Xaml;
|
|
||||||
|
|
||||||
namespace Borepin.Dialog
|
|
||||||
{
|
|
||||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
|
||||||
public partial class ScanDialog : ContentView
|
|
||||||
{
|
|
||||||
public ScanDialog()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,111 +0,0 @@
|
|||||||
using Prism.Commands;
|
|
||||||
using Prism.Mvvm;
|
|
||||||
using Prism.Services.Dialogs;
|
|
||||||
using System;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using ZXing;
|
|
||||||
|
|
||||||
namespace Borepin.DialogModel
|
|
||||||
{
|
|
||||||
public class ScanDialogModel : BindableBase, IDialogAware
|
|
||||||
{
|
|
||||||
#region Private Fields
|
|
||||||
private object _Instance;
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
public ScanDialogModel()
|
|
||||||
{
|
|
||||||
AbortCommand = new DelegateCommand(AbortCommandExecute);
|
|
||||||
ScannedCommand = new DelegateCommand(ScannedCommandExecute);
|
|
||||||
|
|
||||||
IsVisible = true;
|
|
||||||
IsScanning = true;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Fields
|
|
||||||
public event Action<IDialogParameters> RequestClose;
|
|
||||||
|
|
||||||
public bool CanCloseDialog()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Result _ScanResult;
|
|
||||||
public Result ScanResult
|
|
||||||
{
|
|
||||||
get => _ScanResult;
|
|
||||||
set => SetProperty(ref _ScanResult, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool _IsScanning;
|
|
||||||
public bool IsScanning
|
|
||||||
{
|
|
||||||
get => _IsScanning;
|
|
||||||
set => SetProperty(ref _IsScanning, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool _IsVisible;
|
|
||||||
public bool IsVisible
|
|
||||||
{
|
|
||||||
get => _IsVisible;
|
|
||||||
set => SetProperty(ref _IsVisible, value);
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Commands
|
|
||||||
private ICommand _ScannedCommand;
|
|
||||||
|
|
||||||
public ICommand ScannedCommand
|
|
||||||
{
|
|
||||||
get => _ScannedCommand;
|
|
||||||
set => SetProperty(ref _ScannedCommand, value);
|
|
||||||
}
|
|
||||||
public void ScannedCommandExecute()
|
|
||||||
{
|
|
||||||
IsScanning = false;
|
|
||||||
IsVisible = false;
|
|
||||||
|
|
||||||
IDialogParameters parameters = new DialogParameters()
|
|
||||||
{
|
|
||||||
{ "result", "scanned" },
|
|
||||||
{ "value", ScanResult.Text },
|
|
||||||
{ "instance", _Instance },
|
|
||||||
};
|
|
||||||
RequestClose(parameters);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ICommand _AbortCommand;
|
|
||||||
public ICommand AbortCommand
|
|
||||||
{
|
|
||||||
get => _AbortCommand;
|
|
||||||
set => SetProperty(ref _AbortCommand, value);
|
|
||||||
}
|
|
||||||
public void AbortCommandExecute()
|
|
||||||
{
|
|
||||||
IsScanning = false;
|
|
||||||
IsVisible = false;
|
|
||||||
|
|
||||||
IDialogParameters parameters = new DialogParameters()
|
|
||||||
{
|
|
||||||
{ "result", "abort" },
|
|
||||||
{ "instance", _Instance },
|
|
||||||
};
|
|
||||||
RequestClose(parameters);
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region IDialogAware
|
|
||||||
public void OnDialogClosed()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnDialogOpened(IDialogParameters parameters)
|
|
||||||
{
|
|
||||||
_Instance = parameters.GetValue<object>("instance");
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,7 +6,15 @@
|
|||||||
x:Class="Borepin.Page.ScanPage">
|
x:Class="Borepin.Page.ScanPage">
|
||||||
<ContentPage.Content>
|
<ContentPage.Content>
|
||||||
<StackLayout IsVisible="{Binding IsVisible}">
|
<StackLayout IsVisible="{Binding IsVisible}">
|
||||||
<zxing:ZXingScannerView Result="{Binding ScanResult, Mode=TwoWay}" ScanResultCommand="{Binding ScannedCommand}" IsScanning="{Binding IsScanning}" WidthRequest="300" HeightRequest="500" VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand" Options="{Binding ScanOptions}"/>
|
<zxing:ZXingScannerView
|
||||||
|
Result="{Binding ScanResult, Mode=TwoWay}"
|
||||||
|
ScanResultCommand="{Binding ScannedCommand}"
|
||||||
|
IsScanning="{Binding IsScanning}"
|
||||||
|
Options="{Binding ScanOptions}"
|
||||||
|
WidthRequest="300"
|
||||||
|
HeightRequest="500"
|
||||||
|
VerticalOptions="CenterAndExpand"
|
||||||
|
HorizontalOptions="CenterAndExpand"/>
|
||||||
<Button Text="{x:Static resource_text:TextResource.CANCEL}" Command="{Binding CancelCommand}"/>
|
<Button Text="{x:Static resource_text:TextResource.CANCEL}" Command="{Binding CancelCommand}"/>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ContentPage.Content>
|
</ContentPage.Content>
|
||||||
|
@ -6,7 +6,15 @@
|
|||||||
x:Class="Borepin.Page.ScanURNPage">
|
x:Class="Borepin.Page.ScanURNPage">
|
||||||
<ContentPage.Content>
|
<ContentPage.Content>
|
||||||
<StackLayout IsVisible="{Binding IsVisible}">
|
<StackLayout IsVisible="{Binding IsVisible}">
|
||||||
<zxing:ZXingScannerView Result="{Binding ScanResult, Mode=TwoWay}" ScanResultCommand="{Binding ScannedCommand}" IsScanning="{Binding IsScanning}" WidthRequest="300" HeightRequest="500" VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand" Options="{Binding ScanOptions}"/>
|
<zxing:ZXingScannerView
|
||||||
|
Result="{Binding ScanResult, Mode=TwoWay}"
|
||||||
|
ScanResultCommand="{Binding ScannedCommand}"
|
||||||
|
IsScanning="{Binding IsScanning}"
|
||||||
|
Options="{Binding ScanOptions}"
|
||||||
|
WidthRequest="300"
|
||||||
|
HeightRequest="500"
|
||||||
|
VerticalOptions="CenterAndExpand"
|
||||||
|
HorizontalOptions="CenterAndExpand"/>
|
||||||
<Button Text="{x:Static resource_text:TextResource.CANCEL}" Command="{Binding CancelCommand}"/>
|
<Button Text="{x:Static resource_text:TextResource.CANCEL}" Command="{Binding CancelCommand}"/>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ContentPage.Content>
|
</ContentPage.Content>
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
<ActivityIndicator IsRunning="{Binding IsBusy}"/>
|
<ActivityIndicator IsRunning="{Binding IsBusy}"/>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<ActivityIndicator IsRunning="{Binding IsBusy}"/>
|
<ActivityIndicator IsRunning="{Binding IsBusy}"/>
|
||||||
<StackLayout IsVisible="{Binding IsConnecting}" VerticalOptions="CenterAndExpand">
|
<StackLayout IsVisible="{Binding RunConnecting}" VerticalOptions="CenterAndExpand">
|
||||||
<Label Text="{x:Static resource_text:TextResource.StartPage_Connecting}" Style="{StaticResource Style_Label_Text_Center}"/>
|
<Label Text="{x:Static resource_text:TextResource.StartPage_Connecting}" Style="{StaticResource Style_Label_Text_Center}"/>
|
||||||
<ActivityIndicator IsRunning="{Binding IsConnecting}"/>
|
<ActivityIndicator IsRunning="{Binding RunConnecting}"/>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ContentPage.Content>
|
</ContentPage.Content>
|
||||||
|
@ -5,6 +5,7 @@ using System.Windows.Input;
|
|||||||
using Borepin.Base;
|
using Borepin.Base;
|
||||||
using Borepin.Base.Exceptions;
|
using Borepin.Base.Exceptions;
|
||||||
using Borepin.Service;
|
using Borepin.Service;
|
||||||
|
using Borepin.Service.ErrorMessage;
|
||||||
using Borepin.Service.Storage;
|
using Borepin.Service.Storage;
|
||||||
using FabAccessAPI;
|
using FabAccessAPI;
|
||||||
using FabAccessAPI.Exceptions;
|
using FabAccessAPI.Exceptions;
|
||||||
@ -21,12 +22,14 @@ namespace Borepin.PageModel.AddServerProcess
|
|||||||
#region Private Fields
|
#region Private Fields
|
||||||
private ConnectionData _ConnectionData;
|
private ConnectionData _ConnectionData;
|
||||||
private readonly ILoginStorageService _LoginStorageService;
|
private readonly ILoginStorageService _LoginStorageService;
|
||||||
|
private readonly IErrorMessageService _ErrorMessageService;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
public AuthPlainPageModel(INavigationService navigationService, IAPIService apiService, IPageDialogService pageDialogService, ILoginStorageService loginStorageService) : base(navigationService, pageDialogService, apiService)
|
public AuthPlainPageModel(INavigationService navigationService, IAPIService apiService, IPageDialogService pageDialogService, ILoginStorageService loginStorageService, IErrorMessageService errorMessageService) : base(navigationService, pageDialogService, apiService)
|
||||||
{
|
{
|
||||||
_LoginStorageService = loginStorageService;
|
_LoginStorageService = loginStorageService;
|
||||||
|
_ErrorMessageService = errorMessageService;
|
||||||
|
|
||||||
AuthenticateCommand = new DelegateCommand(async () => await AuthenticateCommandExecute().ConfigureAwait(false));
|
AuthenticateCommand = new DelegateCommand(async () => await AuthenticateCommandExecute().ConfigureAwait(false));
|
||||||
}
|
}
|
||||||
@ -113,46 +116,13 @@ namespace Borepin.PageModel.AddServerProcess
|
|||||||
{
|
{
|
||||||
await _API.Connect(_ConnectionData).ConfigureAwait(false);
|
await _API.Connect(_ConnectionData).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (ConnectionException)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
Device.BeginInvokeOnMainThread(async () =>
|
_ErrorMessageService.DisplayConnectFailedMessage(exception);
|
||||||
{
|
|
||||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_UnableServer, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
|
||||||
|
|
||||||
IsBusy = false;
|
IsBusy = false;
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (InvalidCredentialsException)
|
|
||||||
{
|
|
||||||
Device.BeginInvokeOnMainThread(async () =>
|
|
||||||
{
|
|
||||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_CredentialsInvalid, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
|
||||||
|
|
||||||
IsBusy = false;
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
catch (AuthenticationFailedException)
|
|
||||||
{
|
|
||||||
Device.BeginInvokeOnMainThread(async () =>
|
|
||||||
{
|
|
||||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_AuthServer, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
|
||||||
|
|
||||||
IsBusy = false;
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
catch(Exception ex)
|
|
||||||
{
|
|
||||||
Device.BeginInvokeOnMainThread(async () =>
|
|
||||||
{
|
|
||||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_UnexpectedError, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
|
||||||
|
|
||||||
IsBusy = false;
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await _LoginStorageService.Add(_ConnectionData).ConfigureAwait(false);
|
await _LoginStorageService.Add(_ConnectionData).ConfigureAwait(false);
|
||||||
await _LoginStorageService.UpdateTimestamp(_ConnectionData).ConfigureAwait(false);
|
await _LoginStorageService.UpdateTimestamp(_ConnectionData).ConfigureAwait(false);
|
||||||
|
|
||||||
|
@ -2,10 +2,12 @@
|
|||||||
using Prism.Commands;
|
using Prism.Commands;
|
||||||
using Prism.Navigation;
|
using Prism.Navigation;
|
||||||
using Prism.Services;
|
using Prism.Services;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
using ZXing;
|
using ZXing;
|
||||||
|
using ZXing.Mobile;
|
||||||
|
|
||||||
namespace Borepin.PageModel
|
namespace Borepin.PageModel
|
||||||
{
|
{
|
||||||
@ -40,6 +42,23 @@ namespace Borepin.PageModel
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
|
public MobileBarcodeScanningOptions ScanOptions
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return new MobileBarcodeScanningOptions()
|
||||||
|
{
|
||||||
|
PossibleFormats = new List<BarcodeFormat>()
|
||||||
|
{
|
||||||
|
BarcodeFormat.QR_CODE,
|
||||||
|
BarcodeFormat.EAN_13,
|
||||||
|
},
|
||||||
|
AutoRotate = true,
|
||||||
|
DelayBetweenContinuousScans = 300,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Result _ScanResult;
|
private Result _ScanResult;
|
||||||
public Result ScanResult
|
public Result ScanResult
|
||||||
{
|
{
|
||||||
@ -73,7 +92,6 @@ namespace Borepin.PageModel
|
|||||||
public void ScannedCommandExecute()
|
public void ScannedCommandExecute()
|
||||||
{
|
{
|
||||||
IsScanning = false;
|
IsScanning = false;
|
||||||
IsVisible = false;
|
|
||||||
|
|
||||||
INavigationParameters parameters = new NavigationParameters()
|
INavigationParameters parameters = new NavigationParameters()
|
||||||
{
|
{
|
||||||
@ -96,7 +114,6 @@ namespace Borepin.PageModel
|
|||||||
public async Task CancelCommandExecute()
|
public async Task CancelCommandExecute()
|
||||||
{
|
{
|
||||||
IsScanning = false;
|
IsScanning = false;
|
||||||
IsVisible = false;
|
|
||||||
|
|
||||||
INavigationParameters parameters = new NavigationParameters()
|
INavigationParameters parameters = new NavigationParameters()
|
||||||
{
|
{
|
||||||
|
@ -37,11 +37,11 @@ namespace Borepin.PageModel
|
|||||||
{
|
{
|
||||||
BarcodeFormat.QR_CODE,
|
BarcodeFormat.QR_CODE,
|
||||||
BarcodeFormat.EAN_13,
|
BarcodeFormat.EAN_13,
|
||||||
// TODO add more Barcode Formats if needed
|
|
||||||
},
|
},
|
||||||
|
AutoRotate = true,
|
||||||
|
DelayBetweenContinuousScans = 300,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
//set => SetProperty(ref _ScanOptions, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Result _ScanResult;
|
private Result _ScanResult;
|
||||||
@ -146,7 +146,6 @@ namespace Borepin.PageModel
|
|||||||
public async Task CancelCommandExecute()
|
public async Task CancelCommandExecute()
|
||||||
{
|
{
|
||||||
IsScanning = false;
|
IsScanning = false;
|
||||||
IsVisible = false;
|
|
||||||
|
|
||||||
await _NavigationService.GoBackAsync().ConfigureAwait(false);
|
await _NavigationService.GoBackAsync().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
@ -32,11 +32,11 @@ namespace Borepin.PageModel
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
private bool _IsConnecting;
|
private bool _RunConnecting;
|
||||||
public bool IsConnecting
|
public bool RunConnecting
|
||||||
{
|
{
|
||||||
get => _IsConnecting;
|
get => _RunConnecting;
|
||||||
set => SetProperty(ref _IsConnecting, value);
|
set => SetProperty(ref _RunConnecting, value);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ namespace Borepin.PageModel
|
|||||||
else if(connectionData_Default != null)
|
else if(connectionData_Default != null)
|
||||||
{
|
{
|
||||||
IsBusy = false;
|
IsBusy = false;
|
||||||
IsConnecting = true;
|
RunConnecting = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _API.Connect(connectionData_Default).ConfigureAwait(false);
|
await _API.Connect(connectionData_Default).ConfigureAwait(false);
|
||||||
|
@ -6,6 +6,7 @@ using NLog;
|
|||||||
using S22.Sasl;
|
using S22.Sasl;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Security;
|
using System.Net.Security;
|
||||||
using System.Security.Cryptography.X509Certificates;
|
using System.Security.Cryptography.X509Certificates;
|
||||||
@ -337,17 +338,18 @@ namespace FabAccessAPI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Connect async to a server with ConnectionData
|
/// Injects SSL as Midlayer in TCPRPCConnection
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <exception cref="ConnectionException">Based on RPC Exception</exception>
|
/// <exception cref="ConnectionException"></exception>
|
||||||
private async Task _ConnectAsync(TcpRpcClient tcprpcClient, ConnectionData connectionData)
|
private Stream InjectSSL(Stream tcpstream)
|
||||||
{
|
{
|
||||||
tcprpcClient.InjectMidlayer((tcpstream) =>
|
SslStream sslStream = new SslStream(tcpstream, false, new RemoteCertificateValidationCallback(_RemoteCertificateValidationCallback));
|
||||||
{
|
|
||||||
var sslStream = new SslStream(tcpstream, false, new RemoteCertificateValidationCallback(_RemoteCertificateValidationCallback));
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
sslStream.ReadTimeout = 2000;
|
||||||
sslStream.AuthenticateAsClient("bffhd");
|
sslStream.AuthenticateAsClient("bffhd");
|
||||||
|
sslStream.ReadTimeout = -1;
|
||||||
|
|
||||||
return sslStream;
|
return sslStream;
|
||||||
}
|
}
|
||||||
catch (System.Security.Authentication.AuthenticationException exception)
|
catch (System.Security.Authentication.AuthenticationException exception)
|
||||||
@ -356,7 +358,21 @@ namespace FabAccessAPI
|
|||||||
Log.Warn(exception);
|
Log.Warn(exception);
|
||||||
throw new ConnectionException("TLS failed", exception);
|
throw new ConnectionException("TLS failed", exception);
|
||||||
}
|
}
|
||||||
});
|
catch(IOException exception)
|
||||||
|
{
|
||||||
|
sslStream.Close();
|
||||||
|
Log.Warn(exception);
|
||||||
|
throw new ConnectionException("TLS failed", new Exceptions.TimeoutException("TLS timeout", exception));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Connect async to a server with ConnectionData
|
||||||
|
/// </summary>
|
||||||
|
/// <exception cref="ConnectionException">Based on RPC Exception</exception>
|
||||||
|
private async Task _ConnectAsync(TcpRpcClient tcprpcClient, ConnectionData connectionData)
|
||||||
|
{
|
||||||
|
tcprpcClient.InjectMidlayer(InjectSSL);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
2
external/capnproto-dotnetcore
vendored
2
external/capnproto-dotnetcore
vendored
@ -1 +1 @@
|
|||||||
Subproject commit a70eecd99112b16902128b8b4b2c95b2721fdf0e
|
Subproject commit 1be9ffbf8acbc9770f2d5b67c961fb60e49e5ec5
|
Loading…
x
Reference in New Issue
Block a user