mirror of
https://github.com/NecroticBamboo/QRBee.git
synced 2025-12-21 12:11:53 +00:00
ZXing reference added. Xamarin updated. Initial QR scanner service added.
This commit is contained in:
parent
e63435665c
commit
d1720589e2
2
QRBee.sln.DotSettings
Normal file
2
QRBee.sln.DotSettings
Normal file
@ -0,0 +1,2 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=QR/@EntryIndexedValue">QR</s:String></wpf:ResourceDictionary>
|
||||
@ -59,13 +59,17 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2012" />
|
||||
<PackageReference Include="Xamarin.Essentials" Version="1.6.1" />
|
||||
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2244" />
|
||||
<PackageReference Include="Xamarin.Essentials" Version="1.7.0" />
|
||||
<PackageReference Include="ZXing.Net.Mobile">
|
||||
<Version>2.4.1</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MainActivity.cs" />
|
||||
<Compile Include="Resources\Resource.designer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\QRScannerService.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\AboutResources.txt" />
|
||||
@ -97,5 +101,6 @@
|
||||
<Name>QRBee</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
</Project>
|
||||
18682
QRBee/QRBee.Android/Resources/Resource.designer.cs
generated
18682
QRBee/QRBee.Android/Resources/Resource.designer.cs
generated
File diff suppressed because it is too large
Load Diff
28
QRBee/QRBee.Android/Services/QRScannerService.cs
Normal file
28
QRBee/QRBee.Android/Services/QRScannerService.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System.Threading.Tasks;
|
||||
using QRBee.Services;
|
||||
using Xamarin.Forms;
|
||||
using ZXing.Mobile;
|
||||
|
||||
|
||||
[assembly: Dependency(typeof(QRBee.Droid.Services.QRScannerService))]
|
||||
|
||||
namespace QRBee.Droid.Services
|
||||
{
|
||||
public class QRScannerService : IQRScanner
|
||||
{
|
||||
public async Task<string> ScanQR()
|
||||
{
|
||||
|
||||
var optionsCustom = new MobileBarcodeScanningOptions();
|
||||
|
||||
var scanner = new MobileBarcodeScanner()
|
||||
{
|
||||
TopText = "Scan the QR Code",
|
||||
BottomText = "Please Wait",
|
||||
};
|
||||
|
||||
var scanResult = await scanner.Scan(optionsCustom);
|
||||
return scanResult.Text;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -132,8 +132,11 @@
|
||||
<Reference Include="System.Numerics.Vectors" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2012" />
|
||||
<PackageReference Include="Xamarin.Essentials" Version="1.6.1" />
|
||||
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2244" />
|
||||
<PackageReference Include="Xamarin.Essentials" Version="1.7.0" />
|
||||
<PackageReference Include="ZXing.Net.Mobile">
|
||||
<Version>2.4.1</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
|
||||
@ -30,8 +30,9 @@
|
||||
</Shell.Resources>
|
||||
|
||||
<TabBar>
|
||||
<ShellContent Title="About" Icon="icon_about.png" Route="AboutPage" ContentTemplate="{DataTemplate local:AboutPage}" />
|
||||
<ShellContent Title="Browse" Icon="icon_feed.png" ContentTemplate="{DataTemplate local:ItemsPage}" />
|
||||
<!-- <ShellContent Title="About" Icon="icon_about.png" Route="AboutPage" ContentTemplate="{DataTemplate local:AboutPage}" /> -->
|
||||
<!-- <ShellContent Title="Browse" Icon="icon_feed.png" ContentTemplate="{DataTemplate local:ItemsPage}" /> -->
|
||||
<ShellContent Title="MainPage" ContentTemplate="{DataTemplate local:MainPage}"/>
|
||||
</TabBar>
|
||||
|
||||
<!--
|
||||
|
||||
@ -6,7 +6,20 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2012" />
|
||||
<PackageReference Include="Xamarin.Essentials" Version="1.6.1" />
|
||||
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2244" />
|
||||
<PackageReference Include="Xamarin.Essentials" Version="1.7.0" />
|
||||
<PackageReference Include="ZXing.Net.Mobile" Version="2.4.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Views\MainPage.xaml.cs">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Views\MainPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
12
QRBee/QRBee/Services/IQRScanner.cs
Normal file
12
QRBee/QRBee/Services/IQRScanner.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace QRBee.Services
|
||||
{
|
||||
public interface IQRScanner
|
||||
{
|
||||
Task<string> ScanQR();
|
||||
}
|
||||
}
|
||||
15
QRBee/QRBee/Views/MainPage.xaml
Normal file
15
QRBee/QRBee/Views/MainPage.xaml
Normal 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="QRBee.Views.MainPage">
|
||||
<ContentPage.Content>
|
||||
<StackLayout>
|
||||
<!-- <Label Text="Hello this is a test page." -->
|
||||
<!-- VerticalOptions="CenterAndExpand" -->
|
||||
<!-- HorizontalOptions="CenterAndExpand" /> -->
|
||||
<Entry x:Name="QrCodeScanner" Placeholder="Text to scan"/>
|
||||
<Button Text="Scan me" HorizontalOptions="Center" BackgroundColor="Aqua" TextColor="Red" Clicked="OnButtonClicked"/>
|
||||
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
||||
38
QRBee/QRBee/Views/MainPage.xaml.cs
Normal file
38
QRBee/QRBee/Views/MainPage.xaml.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using QRBee.Services;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Xaml;
|
||||
|
||||
namespace QRBee.Views
|
||||
{
|
||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
public partial class MainPage : ContentPage
|
||||
{
|
||||
public MainPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private async void OnButtonClicked(object sender, EventArgs args)
|
||||
{
|
||||
try
|
||||
{
|
||||
var scanner = DependencyService.Get<IQRScanner>();
|
||||
var result = await scanner.ScanQR();
|
||||
if (result != null)
|
||||
{
|
||||
QrCodeScanner.Text = result;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user