How to read QR code in windows phone 8.1 app development? - c#

I want to scan QR code in windows phone app 8.1.I am tried lot of examples but no one is work for me.
Below code I tried but no use
xmlns:jwqr="clr-namespace:JeffWilcox.Controls;assembly=JeffWilcox.Controls.QR"
in xaml
<jwqr:QRCodeScanner
ScanComplete="QRCodeScanner_ScanComplete"
Error="QRCodeScanner_Error"
Width="400"
Height="400"/>
It showing error like:
The name "QRCodeScanner" does not exist in the namespace
"clr-namespace:JeffWilcox.Controls;assembly=JeffWilcox.Controls.QR"
And tried the link this one also not working for me. But in this camera not scan the code. Please anyone help me. If you have any other links. I am trying this last 3 days but till now I am not getting any answer correctly. Plase help me.......

I'm not recommending but i've used Zxing Library for Barcode/QR code scanning and that worked for me.
here's a sample how to use this library:
// create a barcode reader instance
IBarcodeReader reader = new BarcodeReader();
// load a bitmap
var barcodeBitmap = (Bitmap)Bitmap.LoadFrom("C:\\sample-barcode-image.png");
// detect and decode the barcode inside the bitmap
var result = reader.Decode(barcodeBitmap);
// do something with the result
if (result != null)
{
txtDecoderType.Text = result.BarcodeFormat.ToString();
txtDecoderContent.Text = result.Text;
}
Documentation and other demoClient is available here
Ask if you require more code. Hope that helps..!

Related

Playing an HDHomeRun stream on a Tizen.NET Xamarin App

I'm trying to play a HDHomeRun Connect Video source from a url in the following format: http://x.x.x.x:xxxx/auto/v4.1. This video source is an MPEG2 video encoding and AC3 audio encoding.
I've tried using the Samsung Tizen.TV .NET sample with the following source but the video never plays.
_player = new Tizen.Multimedia.Player();
var mediaSource = new Multimedia.MediaUriSource(uri);
_player.SetSource(mediaSource);
var display = new Multimedia.Display(Window.Instance);
_player.Display = display;
await _player.PrepareAsync();
The player state gets stuck in preparing, and the await _player.PrepareAsync() call never finishes. It is worth noting that I'm using the Tizen Samsung TV Emulator. Do I need to transcode the stream from the HDHomeRun to be playable? Are there any other measures I might be missing for the Video to play?
Ultimately, the Display property of the player wasn't being set correctly. The property that worked for me (found from investigating the JuvoPlayer code was this:
var display = new Multimedia.Display(((FormsApplication)Forms.Context).MainWindow);
_player.Display = display;
When you are to develop a Tizen .NET application, please be aware of which UI framework your project is targetted for among 3 different types: Xamarin.Forms, (pure) ElmSharp, and Tizen.NUI.
Unless your project is based on the Tizen.NUI framework, you shouldn't use Tizen.NUI.Window.Instance and types in Tizen.NUI namespace in any case. Instead, you will have to use types of ElmSharp or Xamarin.Forms.Platform.Tizen namespace for platform-specific code in your application.
Since the internal implementation of Xamarin.Forms for Tizen is based on ElmSharp, FormsApplication.MainWindow will return a ElmSharp.Window instance which can be used to instantiate a Tizen.Multimedia.Display object. That's why the code in your answer worked.

Read data via bluetooth using c#

I am using Lecia Disto e7100i which basically measures distance and area using laser. This device has bluetooth and can be paired with windows.
I am trying to develop an wpf app that reads the mesaured data using c#
There is no sdk that comes along with the device.
I have tried to use 32feet.Net but since there is no proper documentation I don't know where to start.
Is there any way that I can do to solve my problem?
This is not a full response, instead its more of a guideline on how to resolve your issue:
Pair the device with your Computer
Run the included software that displays the data somehow
Use WireShark to analyze the traffic
see if it is a standard protocol type or something custom
understand the protocol and reimplement it using c# and BluetoothSockets
To get started, you can try:
var client = new BluetoothClient();
// Select the bluetooth device
var dlg = new SelectBluetoothDeviceDialog();
DialogResult result = dlg.ShowDialog(this);
if (result != DialogResult.OK)
{
return;
}
BluetoothDeviceInfo device = dlg.SelectedDevice;
BluetoothAddress addr = device.DeviceAddress;
Console.WriteLine(device.DeviceName);
BluetoothSecurity.PairRequest(addr, "PIN"); // set the pin here or take user input
device.SetServiceState(BluetoothService.HumanInterfaceDevice, true);
Thread.Sleep(100); // Precautionary
if (device.InstalledServices.Length == 0)
{
// handle appropriately
}
client.Connect(addr, BluetoothService.HumanInterfaceDevice);
Also make sure that
Device appears in "Bluetooth devices" in the "Control panel".
Device is HID or change code accordingly.
Hope it helps. Cheers!
Try this demo project, and the following articles after that one.
Try to follow this tutorial
Here you can see a direct answer by the mantainer of 32feet, with which you can get in touch
Check also this answer

Retrieving AVPlayerItem from Gallery Asset

I'm trying to play a video using the AVPlayer and an AVPlayerItem.
Im using following code:
asset = AVAsset.FromUrl(new NSUrl(GalleryURL));
playerItem = new AVPlayerItem(asset);
playerItem.AddObserver(this, (NSString)"status", NSKeyValueObservingOptions.OldNew, IntPtr.Zero);
player = new AVPlayer(playerItem);
the property GalleryURL is one of the following:
1.) When saving a video to the gallery, i get this url from the ALAssetsLibrary instance call: WriteVideoToSavedPhotosAlbum(url, (galleryPath, error) => { ... });
where "galleryPath" is something like this:
file:///var/mobile/Containers/Data/Application/0D510365-4A63-425B-840C-A4E18BD870A8/Documents/...
this works fine, I can create the AVAsset and retrieve the AVPlayerItemStatus, especially the status "ReadyToPlay", via the added Observer.
2.) However when I retrieve a Video from the gallery, the url looks different:
assets-library://asset/asset.MOV?id=EB9FC214...
and in this case I'm not able to retrieve a working AVAsset
How can I get part 2 to create a working AVAsset, which I can use for video playback? I believe this works in iOS versions prior to iOS 11.
Landu Lu - MSFT helped me to find the answer:
He told me that there are 2 paths that I receive from the UIImagePickerController:
The asset-library path could not be used, maybe I have to remove the "assets-library:" part? but the path beginning with "file://" could be used. The problem of the plugin was, that the start of the url was cut off, there was no "file://" at the beginning. I manually added this string and it works! Thanks alot!

Veridis Biometric SDK: Get ANSI378 template from fingerprint image file

I have been fiddling with the Veridis sdk 5.0. I need to get the ANSI 378 template from a fingerprint image file. Here is a sample code for that.
var r = VeridisLicense.InstallLicense(myKey, string.Empty);
var bitmap = Bitmap.FromFile(imagePath) as Bitmap;
var sample = new BiometricSample(bitmap, 500);
var bioTemplate = new BiometricTemplate(sample, BiometricTemplateFormat.Ansi);
var data = bioTemplate.GetData();
However, the app crashes with ntdll heap corruption error after executing the InstallLicense line. If I omit that, I get Veridis.Biometric.BiometricException "Not started (Error #-4)" from BiometricTemplate constructor.
Can someone tell me what is going on here? I have the same problem while installing license with the dot net sample that comes with it. However, the demo application inside veridis sdk package does not give any error while installing the license.
I believe you forgot to call the static function BiometricCapture.StartSDK(eventListener)
You also will need a class that inherit from ICaptureListener. That new class will be your Event listener.

c# scanner scan barcode

I'm now trying to create an web application or software, whatever, by c# to achieve a process -- when I scan a piece of paper(contains barcode) using my office scanner, the software or web application will automatically get the the barcode content.
I'm now a bit confusing of how to achieve this. Anyone has idea about this? Do I need to call the Scanner's API or something? My scanner brand is EPSON.
Thanks in advance.
This will give you a general idea on creating your desired application
At first you have to capture the image from the scanner using TWAIN or using Windows image Acquistion
Then you have to read the bar code from the image.You can use some third party libraries to read the barcode.
Some of the articles that will help you..
http://www.codeproject.com/Articles/1376/NET-TWAIN-image-scanner
Using a scanner without dialogs in C#
http://www.codeproject.com/Articles/10734/Reading-Barcodes-from-an-Image-II
Barcode scanners automatically decode the Bars and return a string! Try using in Ms-Word or Notepad. The string is followed by return in some barcode readers.
Actually we do not normally do it coz it will dramatically reduce application performance. Let's say for example, if you scan two files at the same time, the time gap is too short, scanner won't have the mechanism to separate two files.
Thus my suggestion of this would be create a web app, manually upload the document and process.
With Asprise C# VB.NET Scanning & Imaging SDK, you can acquires images from TWAIN WIA scanners and extract barcodes at the same time - even if your scanner doesn't support reading barcode natively.
The code snippet below saves the scanned images into a multi-page PDF file at the current working directory and prints the barcodes recognized:
Result result = new AspriseImaging().Scan(new Request()
.SetTwainCap(TwainConstants.ICAP_PIXELTYPE, TwainConstants.TWPT_RGB) // color mode
.SetTwainCap(TwainConstants.ICAP_SUPPORTEDSIZES, TwainConstants.TWSS_USLETTER) // paper size
.SetRecognizeBarcodes(true)
.AddOutputItem(new RequestOutputItem(AspriseImaging.OUTPUT_SAVE, AspriseImaging.FORMAT_PDF).SetSavePath(".\\${TMS}${EXT}")),
"select", true, true);
List<string> barcodes = result == null ? null : result.GetBarcodes();
Console.WriteLine("Barcodes: " + string.Join(";\n", barcodes == null ? new string[0] : barcodes.ToArray()));
// Alternatively, request can be specified using the following JSON:
{
"twain_cap_setting" :
{
"ICAP_PIXEXELTYPE" : "TWPT_RGB",
"ICAP_SUPPORPORTEDSIZES" : "TWSS_USLESLETTER"
},
"recognize_barcodes" : true,
"output_settings" : [ {
"type" : "save",
"format" : "pdf",
"save_path" : ".\\${TMS}${EXT}" } ]
}
Download and run the reading barcodes while scanning from TWAIN scanners demos here.
Refer to the developer's guide to C# VB.NET scanning and imaging API for more details.

Categories