private NdefRecord GetPublishingMessage(Type type, string data) { NdefRecord retValue = null; if (type == typeof(NdefTextRecord)) { var oRecord = new NdefTextRecord(); oRecord.Text = data; retValue = oRecord; } else if (type == typeof(NdefSpRecord)) { var oRecord = new NdefSpRecord(); //this.NotifyUser(NotifyType.PeerMessage, "Not Supportint Type, Value (Uri:" + oRecord.Uri + ")"); } else if (type == typeof(NdefUriRecord)) { var oRecord = new NdefUriRecord(); //this.NotifyUser(NotifyType.PeerMessage, "Not Supportint Type, Value (Uri:" + oRecord.Uri + ")"); } else if (type == typeof(NdefTelRecord)) { var oRecord = new NdefTelRecord(); //this.NotifyUser(NotifyType.PeerMessage, "Not Supportint Type, Value (Tel:" + oRecord.TelNumber + ")"); } else if (type == typeof(NdefMailtoRecord)) { var oRecord = new NdefMailtoRecord(); //this.NotifyUser(NotifyType.PeerMessage, "Not Supportint Type, Value (Subject:" + oRecord.Subject + ")"); } else if (type == typeof(NdefAndroidAppRecord)) { var oRecord = new NdefAndroidAppRecord(); //this.NotifyUser(NotifyType.PeerMessage, "Not Supportint Type, Value (Package:" + oRecord.PackageName + ")"); } else if (type == typeof(NdefLaunchAppRecord)) { var oRecord = new NdefLaunchAppRecord(); string praid = CoreApplication.Id; // The Application Id value from your package.appxmanifest. string appName = Package.Current.Id.FamilyName + "!" + praid; NdefLaunchAppRecord launch = new NdefLaunchAppRecord(); launch.AddPlatformAppId("Windows", appName); launch.Arguments = data; retValue = oRecord; } else if (type == typeof(NdefSmsRecord)) { var oRecord = new NdefSmsRecord(); //this.NotifyUser(NotifyType.PeerMessage, "Not Supportint Type, Value (Sms:" + oRecord.SmsBody + ")"); } else if (type == typeof(NdefSmartUriRecord)) { var oRecord = new NdefSmartUriRecord(); //this.NotifyUser(NotifyType.PeerMessage, "Not Supportint Type, Value (Uri:" + oRecord.Uri + ")"); } else { // } return retValue; }
private string HandleNDEFRecord(NdefRecord record) { string tag = string.Empty; var specializedType = record.CheckSpecializedType(false); if (specializedType == typeof(NdefTextRecord)) { var oRecord = new NdefTextRecord(record); try { tag = oRecord.Text; this.NotifyUser(tag, NotifyType.PublishMessage); } catch { } } else if (specializedType == typeof(NdefSpRecord)) { var oRecord = new NdefSpRecord(record); //this.NotifyUser(NotifyType.PeerMessage, "Not Supportint Type, Value (Uri:" + oRecord.Uri + ")"); } else if (specializedType == typeof(NdefUriRecord)) { var oRecord = new NdefUriRecord(record); //this.NotifyUser(NotifyType.PeerMessage, "Not Supportint Type, Value (Uri:" + oRecord.Uri + ")"); } else if (specializedType == typeof(NdefTelRecord)) { var oRecord = new NdefTelRecord(record); //this.NotifyUser(NotifyType.PeerMessage, "Not Supportint Type, Value (Tel:" + oRecord.TelNumber + ")"); } else if (specializedType == typeof(NdefMailtoRecord)) { var oRecord = new NdefMailtoRecord(record); //this.NotifyUser(NotifyType.PeerMessage, "Not Supportint Type, Value (Subject:" + oRecord.Subject + ")"); } else if (specializedType == typeof(NdefAndroidAppRecord)) { var oRecord = new NdefAndroidAppRecord(record); //this.NotifyUser(NotifyType.PeerMessage, "Not Supportint Type, Value (Package:" + oRecord.PackageName + ")"); } else if (specializedType == typeof(NdefLaunchAppRecord)) { var oRecord = new NdefLaunchAppRecord(record); //this.NotifyUser(NotifyType.PeerMessage, "Not Supportint Type, Value (Platform:" + oRecord.PlatformIds + ")"); } else if (specializedType == typeof(NdefSmsRecord)) { var oRecord = new NdefSmsRecord(record); //this.NotifyUser(NotifyType.PeerMessage, "Not Supportint Type, Value (Sms:" + oRecord.SmsBody + ")"); } else if (specializedType == typeof(NdefSmartUriRecord)) { var oRecord = new NdefSmartUriRecord(record); //this.NotifyUser(NotifyType.PeerMessage, "Not Supportint Type, Value (Uri:" + oRecord.Uri + ")"); } else { //this.NotifyUser(NotifyType.PeerMessage, "Not Supporting Type"); } return tag; }