本文整理汇总了C#中ZXing类的典型用法代码示例。如果您正苦于以下问题:C# ZXing类的具体用法?C# ZXing怎么用?C# ZXing使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ZXing类属于命名空间,在下文中一共展示了ZXing类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: HandleScanResult
void HandleScanResult(ZXing.Result result)
{
string msg = "";
if (result != null && !string.IsNullOrEmpty (result.Text)) {
SystemSound.Vibrate.PlayAlertSound ();
SystemSound.Vibrate.PlaySystemSound ();
PersonDetailViewController personVC = Storyboard.InstantiateViewController
("PersonDetailViewController") as PersonDetailViewController;
personVC.SetTask (this, result.Text);
NavigationController.PushViewController (personVC, true);
//msg = "Found Barcode: " + result.Text;
} else {
msg = "Scanning Canceled!";
PersonDetailViewController personVC = Storyboard.InstantiateViewController
("PersonDetailViewController") as PersonDetailViewController;
personVC.SetTask (this, msg);
NavigationController.PushViewController (personVC, true);
}
// this.InvokeOnMainThread(() => {
// var av = new UIAlertView("Barcode Result", msg, null, "OK", null);
// av.Show();
// });
}
开发者ID:meetdpanda,项目名称:Gala,代码行数:26,代码来源:ViewController.cs
示例2: parse
// Treat all UPC and EAN variants as UPCs, in the sense that they are all product barcodes.
public override ParsedResult parse(ZXing.Result result)
{
BarcodeFormat format = result.BarcodeFormat;
if (!(format == BarcodeFormat.UPC_A || format == BarcodeFormat.UPC_E ||
format == BarcodeFormat.EAN_8 || format == BarcodeFormat.EAN_13))
{
return null;
}
// Really neither of these should happen:
String rawText = result.Text;
if (rawText == null)
{
return null;
}
if (!isStringOfDigits(rawText, rawText.Length))
{
return null;
}
// Not actually checking the checksum again here
String normalizedProductID;
// Expand UPC-E for purposes of searching
if (format == BarcodeFormat.UPC_E && rawText.Length == 8)
{
normalizedProductID = UPCEReader.convertUPCEtoUPCA(rawText);
}
else
{
normalizedProductID = rawText;
}
return new ProductParsedResult(rawText, normalizedProductID);
}
开发者ID:Binjaaa,项目名称:ZXing.Net.Mobile,代码行数:35,代码来源:ProductResultParser.cs
示例3: parse
/// <summary>
/// parse()
/// </summary>
/// <param name="result"></param>
/// <returns></returns>
override public ParsedResult parse(ZXing.Result result)
{
String rawText = result.Text;
if (!(rawText.StartsWith("smtp:") || rawText.StartsWith("SMTP:")))
{
return null;
}
String emailAddress = rawText.Substring(5);
String subject = null;
String body = null;
int colon = emailAddress.IndexOf(':');
if (colon >= 0)
{
subject = emailAddress.Substring(colon + 1);
emailAddress = emailAddress.Substring(0, colon);
colon = subject.IndexOf(':');
if (colon >= 0)
{
body = subject.Substring(colon + 1);
subject = subject.Substring(0, colon);
}
}
return new EmailAddressParsedResult(new[] { emailAddress },
null,
null,
subject,
body);
}
开发者ID:hydrayu,项目名称:imobile-src,代码行数:33,代码来源:SMTPResultParser.cs
示例4: parse
override public ParsedResult parse(ZXing.Result result)
{
var rawText = result.Text;
// MEMORY is mandatory; seems like a decent indicator, as does end-of-record separator CR/LF
if (rawText == null || rawText.IndexOf("MEMORY") < 0 || rawText.IndexOf("\r\n") < 0)
{
return null;
}
// NAME1 and NAME2 have specific uses, namely written name and pronunciation, respectively.
// Therefore we treat them specially instead of as an array of names.
var name = matchSinglePrefixedField("NAME1:", rawText, '\r', true);
var pronunciation = matchSinglePrefixedField("NAME2:", rawText, '\r', true);
var phoneNumbers = matchMultipleValuePrefix("TEL", 3, rawText, true);
var emails = matchMultipleValuePrefix("MAIL", 3, rawText, true);
var note = matchSinglePrefixedField("MEMORY:", rawText, '\r', false);
var address = matchSinglePrefixedField("ADD:", rawText, '\r', true);
var addresses = address == null ? null : new [] { address };
return new AddressBookParsedResult(maybeWrap(name),
pronunciation,
phoneNumbers,
null,
emails,
null,
null,
note,
addresses,
null,
null,
null,
null,
null);
}
开发者ID:GSerjo,项目名称:Seminars,代码行数:34,代码来源:AddressBookAUResultParser.cs
示例5: parse
// Yes, we extend AbstractDoCoMoResultParser since the format is very much
// like the DoCoMo MECARD format, but this is not technically one of
// DoCoMo's proposed formats
override public ParsedResult parse(ZXing.Result result)
{
String rawText = result.Text;
if (rawText == null || !rawText.StartsWith("BIZCARD:"))
{
return null;
}
String firstName = matchSingleDoCoMoPrefixedField("N:", rawText, true);
String lastName = matchSingleDoCoMoPrefixedField("X:", rawText, true);
String fullName = buildName(firstName, lastName);
String title = matchSingleDoCoMoPrefixedField("T:", rawText, true);
String org = matchSingleDoCoMoPrefixedField("C:", rawText, true);
String[] addresses = matchDoCoMoPrefixedField("A:", rawText, true);
String phoneNumber1 = matchSingleDoCoMoPrefixedField("B:", rawText, true);
String phoneNumber2 = matchSingleDoCoMoPrefixedField("M:", rawText, true);
String phoneNumber3 = matchSingleDoCoMoPrefixedField("F:", rawText, true);
String email = matchSingleDoCoMoPrefixedField("E:", rawText, true);
return new AddressBookParsedResult(maybeWrap(fullName),
null,
null,
buildPhoneNumbers(phoneNumber1, phoneNumber2, phoneNumber3),
null,
maybeWrap(email),
null,
null,
null,
addresses,
null,
org,
null,
title,
null,
null);
}
开发者ID:Binjaaa,项目名称:ZXing.Net.Mobile,代码行数:39,代码来源:BizcardResultParser.cs
示例6: HandleScanResult
//
public void HandleScanResult(ZXing.Result result)
{
//The logic for settings
string msg = "";
if (result != null && !string.IsNullOrEmpty (result.Text)) {
if (result.Text.Contains (".json")) {
JSONParser.ParseDataCompleteURL (result.Text);
}
else {
JSONParser.ParseData (result.Text);
}
msg = "QR Code Settings are set!";
}
else
msg="Scanning Canceled!";
this.RunOnUiThread (()=>Toast.MakeText(this,msg,ToastLength.Short).Show());
//http://profiles.hookflash.com/itunes-appstore/config.json
}
开发者ID:SeanmanX,项目名称:opandroid,代码行数:30,代码来源:GestureActivity.cs
示例7: HandleScanResult
void HandleScanResult(ZXing.Result result)
{
string msg = "";
if (result != null && !string.IsNullOrEmpty(result.Text))
msg = "Found Barcode: " + result.Text;
else
msg = "Scanning Canceled!";
Info = msg;
}
开发者ID:TinusGreen,项目名称:GendacProjects,代码行数:10,代码来源:CodeScannerViewModel.cs
示例8: HandleScanResult
void HandleScanResult(ZXing.Result result)
{
string msg = "";
if (result != null && !string.IsNullOrEmpty(result.Text))
msg = "Found Barcode: " + result.Text;
else
msg = "Scanning Canceled!";
this.RunOnUiThread(() => scannedResult.Text = msg);
}
开发者ID:sergeyfitis,项目名称:XamarinTest,代码行数:10,代码来源:Custom_overlay_activity.cs
示例9: AddBarcodeToResults
private void AddBarcodeToResults(ZXing.Result result)
{
SetActivityMessage("Barcode decoded", false);
//BarcodeResult.AddToResultCollection(result, _viewModel);
format = result.BarcodeFormat.ToString();
contents = result.Text;
raw = result.RawBytes;
com.codename1.ui.Display d = (com.codename1.ui.Display)com.codename1.ui.Display.getInstance();
d.callSerially(this);
}
开发者ID:sannysanoff,项目名称:CodenameOne,代码行数:10,代码来源:AsyncPictureDecoderExtension.cs
示例10: HandleScanResult
void HandleScanResult (ZXing.Result result)
{
string msg = "";
if (result != null && !string.IsNullOrEmpty(result.Text))
msg = "Found Barcode: " + result.Text;
else
msg = "Scanning Canceled!";
this.RunOnUiThread(() => Toast.MakeText(this, msg, ToastLength.Short).Show());
}
开发者ID:versus1985,项目名称:ZXing.Net.Mobile,代码行数:11,代码来源:MainActivity.cs
示例11: parse
override public ParsedResult parse(ZXing.Result result)
{
String rawText = result.Text;
if (rawText == null ||
!(rawText.StartsWith("sms:") || rawText.StartsWith("SMS:") ||
rawText.StartsWith("mms:") || rawText.StartsWith("MMS:")))
{
return null;
}
// Check up front if this is a URI syntax string with query arguments
var nameValuePairs = parseNameValuePairs(rawText);
String subject = null;
String body = null;
var querySyntax = false;
if (nameValuePairs != null && nameValuePairs.Count != 0)
{
subject = nameValuePairs["subject"];
body = nameValuePairs["body"];
querySyntax = true;
}
// Drop sms, query portion
//UPGRADE_WARNING: Method 'java.lang.String.indexOf' was converted to 'System.String.IndexOf' which may throw an exception. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1101'"
var queryStart = rawText.IndexOf('?', 4);
String smsURIWithoutQuery;
// If it's not query syntax, the question mark is part of the subject or message
if (queryStart < 0 || !querySyntax)
{
smsURIWithoutQuery = rawText.Substring(4);
}
else
{
smsURIWithoutQuery = rawText.Substring(4, (queryStart) - (4));
}
int lastComma = -1;
int comma;
var numbers = new List<String>(1);
var vias = new List<String>(1);
while ((comma = smsURIWithoutQuery.IndexOf(',', lastComma + 1)) > lastComma)
{
String numberPart = smsURIWithoutQuery.Substring(lastComma + 1, comma);
addNumberVia(numbers, vias, numberPart);
lastComma = comma;
}
addNumberVia(numbers, vias, smsURIWithoutQuery.Substring(lastComma + 1));
return new SMSParsedResult(SupportClass.toStringArray(numbers),
SupportClass.toStringArray(vias),
subject,
body);
}
开发者ID:Bogdan-p,项目名称:ZXing.Net,代码行数:53,代码来源:SMSMMSResultParser.cs
示例12: HandleResult
void HandleResult(ZXing.Result result){
if (result != null)
{
var msg = "NO barcode!";
msg = "barcode: " + result.Text + "was not in your database";
// LagerDAO dao = new LagerDAO();
int id = -1;
try{
id = Convert.ToInt32(result.Text);
}catch(Exception e){
Console.WriteLine(e.Message);
}
IList<LagerObject> lol = null;
if(id != -1){
lol = new List<LagerObject> ();
lol.Add(AppDelegate.dao.GetLagerObjectByID(id));
}
if (lol != null)
{
if (lol.Count == 0)
{
var title = "no barcode";
var alert = new UIAlertView(title, msg, null, "cancel", null);
alert.Show();
}
else
{
LagerObject lo = lol[0];
if (lo.isContainer == "true")
{
var cd = new no.dctapps.commons.events.screens.ContainerDetails(lo);
parent.PresentViewControllerAsync(cd, true);
}
else if (lo.isLargeObject == "true")
{
BigItemDetailScreen bs = new BigItemDetailScreen(lo);
parent.PresentViewControllerAsync(bs, true);
}
else
{
var alert = new UIAlertView("No such object", msg, null, "cancel", null);
alert.Show();
}
}
}
}
}
开发者ID:KuroiAme,项目名称:Indexer,代码行数:50,代码来源:Scanner.cs
示例13: HandleScanResult
void HandleScanResult(ZXing.Result result)
{
string msg = "";
if (result != null && !string.IsNullOrEmpty(result.Text))
msg = "Found Barcode: " + result.Text;
else
msg = "Scanning Canceled!";
this.InvokeOnMainThread(() => {
var av = new UIAlertView("Barcode Result", msg, null, "OK", null);
av.Show();
});
}
开发者ID:krishnanuj1990,项目名称:Xamarin.iOS.BarcodeSample,代码行数:14,代码来源:HomeViewController.cs
示例14: RectangleFromResultPoints
private static Rectangle RectangleFromResultPoints(ZXing.ResultPoint[] resultPoints)
{
PointF minPoint = new PointF(resultPoints[0].X, resultPoints[0].Y);
PointF maxPoint = minPoint;
foreach (var point in resultPoints)
{
minPoint.X = Math.Min(minPoint.X, point.X);
minPoint.Y = Math.Min(minPoint.Y, point.Y);
maxPoint.X = Math.Max(maxPoint.X, point.X);
maxPoint.Y = Math.Max(maxPoint.Y, point.Y);
}
return new Rectangle((int)minPoint.X, (int)minPoint.Y, (int)(maxPoint.X - minPoint.X), (int)(maxPoint.Y - minPoint.Y));
}
开发者ID:jefff,项目名称:animalcrossingqr,代码行数:15,代码来源:MainForm.cs
示例15: parse
override public ParsedResult parse(ZXing.Result result)
{
String rawText = result.Text;
if (rawText == null ||
(!rawText.StartsWith("tel:") && !rawText.StartsWith("TEL:")))
{
return null;
}
// Normalize "TEL:" to "tel:"
String telURI = rawText.StartsWith("TEL:") ? "tel:" + rawText.Substring(4) : rawText;
// Drop tel, query portion
//UPGRADE_WARNING: Method 'java.lang.String.indexOf' was converted to 'System.String.IndexOf' which may throw an exception. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1101'"
int queryStart = rawText.IndexOf('?', 4);
String number = queryStart < 0 ? rawText.Substring(4) : rawText.Substring(4, (queryStart) - (4));
return new TelParsedResult(number, telURI, null);
}
开发者ID:Binjaaa,项目名称:ZXing.Net.Mobile,代码行数:16,代码来源:TelResultParser.cs
示例16: parse
override public ParsedResult parse(ZXing.Result result)
{
String rawText = result.Text;
if (rawText == null || !rawText.StartsWith("MECARD:"))
{
return null;
}
String[] rawName = matchDoCoMoPrefixedField("N:", rawText, true);
if (rawName == null)
{
return null;
}
String name = parseName(rawName[0]);
String pronunciation = matchSingleDoCoMoPrefixedField("SOUND:", rawText, true);
String[] phoneNumbers = matchDoCoMoPrefixedField("TEL:", rawText, true);
String[] emails = matchDoCoMoPrefixedField("EMAIL:", rawText, true);
String note = matchSingleDoCoMoPrefixedField("NOTE:", rawText, false);
String[] addresses = matchDoCoMoPrefixedField("ADR:", rawText, true);
String birthday = matchSingleDoCoMoPrefixedField("BDAY:", rawText, true);
if (birthday != null && !isStringOfDigits(birthday, 8))
{
// No reason to throw out the whole card because the birthday is formatted wrong.
birthday = null;
}
String url = matchSingleDoCoMoPrefixedField("URL:", rawText, true);
// Although ORG may not be strictly legal in MECARD, it does exist in VCARD and we might as well
// honor it when found in the wild.
String org = matchSingleDoCoMoPrefixedField("ORG:", rawText, true);
return new AddressBookParsedResult(maybeWrap(name),
null,
pronunciation,
phoneNumbers,
null,
emails,
null,
null,
note,
addresses,
null,
org,
birthday,
null,
url,
null);
}
开发者ID:Bogdan-p,项目名称:ZXing.Net,代码行数:47,代码来源:AddressBookDoCoMoResultParser.cs
示例17: parse
override public ParsedResult parse(ZXing.Result result)
{
var rawText = result.Text;
if (rawText == null ||
(!rawText.StartsWith("urlto:") && !rawText.StartsWith("URLTO:")))
{
return null;
}
//UPGRADE_WARNING: Method 'java.lang.String.indexOf' was converted to 'System.String.IndexOf' which may throw an exception. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1101'"
int titleEnd = rawText.IndexOf(':', 6);
if (titleEnd < 0)
{
return null;
}
var title = titleEnd <= 6 ? null : rawText.Substring(6, (titleEnd) - (6));
var uri = rawText.Substring(titleEnd + 1);
return new URIParsedResult(uri, title);
}
开发者ID:Binjaaa,项目名称:ZXing.Net.Mobile,代码行数:18,代码来源:URLTOResultParser.cs
示例18: parse
override public ParsedResult parse(ZXing.Result result)
{
String rawText = result.Text;
if (rawText == null || !rawText.StartsWith("MEBKM:"))
{
return null;
}
String title = matchSingleDoCoMoPrefixedField("TITLE:", rawText, true);
String[] rawUri = matchDoCoMoPrefixedField("URL:", rawText, true);
if (rawUri == null)
{
return null;
}
String uri = rawUri[0];
if (!URIResultParser.isBasicallyValidURI(uri))
{
return null;
}
return new URIParsedResult(uri, title);
}
开发者ID:Binjaaa,项目名称:ZXing.Net.Mobile,代码行数:20,代码来源:BookmarkDoCoMoResultParser.cs
示例19: parse
/// <summary>
/// See <a href="http://www.bisg.org/isbn-13/for.dummies.html">ISBN-13 For Dummies</a>
/// </summary>
/// <param name="result">The result.</param>
/// <returns></returns>
override public ParsedResult parse(ZXing.Result result)
{
BarcodeFormat format = result.BarcodeFormat;
if (format != BarcodeFormat.EAN_13)
{
return null;
}
String rawText = result.Text;
int length = rawText.Length;
if (length != 13)
{
return null;
}
if (!rawText.StartsWith("978") && !rawText.StartsWith("979"))
{
return null;
}
return new ISBNParsedResult(rawText);
}
开发者ID:n1rvana,项目名称:ZXing.NET,代码行数:25,代码来源:ISBNResultParser.cs
示例20: ScanResultHandler
void ScanResultHandler(ZXing.Result result)
{
string message = "";
if (result != null && !string.IsNullOrEmpty(result.Text))
{
message = result.Text;
}
else
{
message = "Scan cancelled";
}
MainText = message;
if (result != null && String.Equals(result.BarcodeFormat.ToString(), "PDF_417", StringComparison.OrdinalIgnoreCase))
{
string[] arr = result.Text.Split('%');
string antwoord;
antwoord = "Make: " + arr[9] + "\nModel: " + arr[10] + "\nCar Description: " + arr[8] + "\nCar Colour: " + arr[11] + "\nLicense number: " + arr[6] + "\nDate of Expiry: " + arr[14];
MainText = antwoord;
}
}
开发者ID:bnroode,项目名称:training,代码行数:20,代码来源:ScanViewModel.cs
注:本文中的ZXing类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论