check if a nfc or qrtag is an btutag
This commit is contained in:
@@ -533,11 +533,11 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
// Errorcase
|
||||
if (this.Dispatcher != null)
|
||||
{
|
||||
this.Dispatcher.BeginInvoke(new Action(() => MessageBoxes.ShowMainModelErrorMessageBox(AppResources.ScarNfc_Fail)));
|
||||
this.Dispatcher.BeginInvoke(new Action(() => MessageBoxes.ShowMainModelErrorMessageBox(AppResources.BTUTag_WrongTag)));
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBoxes.ShowMainModelErrorMessageBox(AppResources.ScarNfc_Fail);
|
||||
MessageBoxes.ShowMainModelErrorMessageBox(AppResources.BTUTag_WrongTag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -226,10 +226,16 @@ namespace CampusAppWP8.Pages.Dev
|
||||
|
||||
var result = this.barcodeReader.Decode(this.bit);
|
||||
|
||||
if (result != null)
|
||||
if (result != null )
|
||||
{
|
||||
Dispatcher.BeginInvoke(delegate
|
||||
{
|
||||
|
||||
if (!Wp8StringManager.IsBTUQRTag(result.Text))
|
||||
{
|
||||
MessageBoxes.ShowMainModelErrorMessageBox(AppResources.BTUTag_WrongTag);
|
||||
return;
|
||||
}
|
||||
if (this.resultAppStoreKey != null)
|
||||
{
|
||||
if (NavigationService.CanGoBack)
|
||||
|
||||
@@ -411,26 +411,46 @@ namespace CampusAppWP8.Pages
|
||||
{
|
||||
// create ndefMessage
|
||||
this.device.StopSubscribingForMessage(message.SubscriptionId);
|
||||
|
||||
if (AppSettings.BTUTagDefaultHandler.CampusMap == Settings.AppSetting.TagDefaultHandler)
|
||||
var ndefMessage = message.Data;
|
||||
byte[] data = ndefMessage.ToArray();
|
||||
NDEFMessage ndef = new NDEFMessage(data);
|
||||
string nfcContent = ndef.GetContent();
|
||||
if (nfcContent == null)
|
||||
{
|
||||
var ndefMessage = message.Data;
|
||||
byte[] data = ndefMessage.ToArray();
|
||||
NDEFMessage ndef = new NDEFMessage(data);
|
||||
|
||||
// search for placeId
|
||||
string nfcContent = ndef.GetContent();
|
||||
this.GoToCampusMappage(nfcContent);
|
||||
nfcContent = string.Empty;
|
||||
}
|
||||
else
|
||||
|
||||
string searchPid = Wp8StringManager.FilterPlaceIdinNFCResultString(nfcContent.Trim());
|
||||
|
||||
if (searchPid == null)
|
||||
{
|
||||
// Errorcase
|
||||
if (this.Dispatcher != null)
|
||||
{
|
||||
this.Dispatcher.BeginInvoke(new Action(() => this.ShowBtuTagMessageBox()));
|
||||
this.Dispatcher.BeginInvoke(new Action(() => MessageBoxes.ShowMainModelErrorMessageBox(AppResources.BTUTag_WrongTag)));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ShowBtuTagMessageBox();
|
||||
MessageBoxes.ShowMainModelErrorMessageBox(AppResources.BTUTag_WrongTag);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (AppSettings.BTUTagDefaultHandler.CampusMap == Settings.AppSetting.TagDefaultHandler)
|
||||
{
|
||||
// search for placeId
|
||||
this.GoToCampusMappage(nfcContent);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.Dispatcher != null)
|
||||
{
|
||||
this.Dispatcher.BeginInvoke(new Action(() => this.ShowBtuTagMessageBox()));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ShowBtuTagMessageBox();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -150,6 +150,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Der eingescannte Tag ist kein BTU-Tag ähnelt.
|
||||
/// </summary>
|
||||
public static string BTUTag_WrongTag {
|
||||
get {
|
||||
return ResourceManager.GetString("BTUTag_WrongTag", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Gebäude ähnelt.
|
||||
/// </summary>
|
||||
@@ -915,15 +924,6 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Kein gültigen NFC-Tag gefunden ähnelt.
|
||||
/// </summary>
|
||||
public static string ScarNfc_Fail {
|
||||
get {
|
||||
return ResourceManager.GetString("ScarNfc_Fail", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Bitte halten Sie das Handy vor dem NFC-Tag ähnelt.
|
||||
/// </summary>
|
||||
|
||||
@@ -416,9 +416,6 @@
|
||||
<data name="App_ScanQR" xml:space="preserve">
|
||||
<value>BTU-Tag via QR-Code</value>
|
||||
</data>
|
||||
<data name="ScarNfc_Fail" xml:space="preserve">
|
||||
<value>Kein gültigen NFC-Tag gefunden</value>
|
||||
</data>
|
||||
<data name="ScarNfc_Search" xml:space="preserve">
|
||||
<value>Bitte halten Sie das Handy vor dem NFC-Tag</value>
|
||||
</data>
|
||||
@@ -488,4 +485,7 @@
|
||||
<data name="Setting_ImpressumTitle" xml:space="preserve">
|
||||
<value>Über BTU Campus-App</value>
|
||||
</data>
|
||||
<data name="BTUTag_WrongTag" xml:space="preserve">
|
||||
<value>Der eingescannte Tag ist kein BTU-Tag</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -585,4 +585,7 @@
|
||||
<data name="ParamRemoveBack" xml:space="preserve">
|
||||
<value>removeBack</value>
|
||||
</data>
|
||||
<data name="BTUTAG_QRStart" xml:space="preserve">
|
||||
<value>BTU-CampusApp</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -195,6 +195,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die BTU-CampusApp ähnelt.
|
||||
/// </summary>
|
||||
public static string BTUTAG_QRStart {
|
||||
get {
|
||||
return ResourceManager.GetString("BTUTAG_QRStart", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die CampusMapAppQRCodeSearchResultStorageKey ähnelt.
|
||||
/// </summary>
|
||||
|
||||
@@ -25,5 +25,19 @@ namespace CampusAppWP8.Utility
|
||||
{
|
||||
return System.Net.HttpUtility.HtmlDecode(Wp8StringManager.StripHTML(inputString));
|
||||
}
|
||||
|
||||
/// <summary> Query if 'content' is a valid btuqr tag. </summary>
|
||||
/// <remarks> Stubbfel, 16.10.2013. </remarks>
|
||||
/// <param name="content"> The content. </param>
|
||||
/// <returns> true if btuqr tag, false if not. </returns>
|
||||
public static bool IsBTUQRTag(string content)
|
||||
{
|
||||
if (content != null && content.StartsWith(Constants.BTUTAG_QRStart))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user