mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-03-12 14:51:44 +01:00
Updated QR-Code Scanning
This commit is contained in:
parent
2ce8113644
commit
1e2604486c
@ -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>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user