/// <summary> /// Checks the type name format and type of this record and returns /// the appropriate specialized class, if one is available and known /// for this record type. /// </summary> /// <param name="checkForSubtypes">If set to true, also checks for /// subtypes of the URL / SmartPoster record where the library offers /// a convenient handling class - e.g. for SMS or Mailto records, /// which are actually URL schemes.</param> /// <returns>Type name of the specialized class that can understand /// and manipulate the payload through convenience methods.</returns> public Type CheckSpecializedType(bool checkForSubtypes) { // Note: can't check for specialized types like the geo record // or the SMS record yet, as these are just convenience classes // for creating URI / Smart Poster records. if (checkForSubtypes) { // Need to check specialized URI / Sp records before checking for base types. if (NdefSmsRecord.IsRecordType(this)) { return(typeof(NdefSmsRecord)); } if (NdefMailtoRecord.IsRecordType(this)) { return(typeof(NdefMailtoRecord)); } if (NdefTelRecord.IsRecordType(this)) { return(typeof(NdefTelRecord)); } if (NdefWindowsSettingsRecord.IsRecordType(this)) { return(typeof(NdefWindowsSettingsRecord)); } } // Unique / base record types if (NdefUriRecord.IsRecordType(this)) { return(typeof(NdefUriRecord)); } if (NdefSpRecord.IsRecordType(this)) { return(typeof(NdefSpRecord)); } if (NdefTextRecord.IsRecordType(this)) { return(typeof(NdefTextRecord)); } if (NdefSpActRecord.IsRecordType(this)) { return(typeof(NdefSpActRecord)); } if (NdefSpSizeRecord.IsRecordType(this)) { return(typeof(NdefSpSizeRecord)); } if (NdefSpMimeTypeRecord.IsRecordType(this)) { return(typeof(NdefSpMimeTypeRecord)); } if (NdefLaunchAppRecord.IsRecordType(this)) { return(typeof(NdefLaunchAppRecord)); } if (NdefAndroidAppRecord.IsRecordType(this)) { return(typeof(NdefAndroidAppRecord)); } if (NdefVcardRecordBase.IsRecordType(this)) { return(typeof(NdefVcardRecordBase)); } if (NdefIcalendarRecordBase.IsRecordType(this)) { return(typeof(NdefIcalendarRecordBase)); } if (NdefBtSecureSimplePairingRecord.IsRecordType(this)) { return(typeof(NdefBtSecureSimplePairingRecord)); } if (NdefHandoverSelectRecord.IsRecordType(this)) { return(typeof(NdefHandoverSelectRecord)); } if (NdefHandoverErrorRecord.IsRecordType(this)) { return(typeof(NdefHandoverErrorRecord)); } if (NdefHandoverAlternativeCarrierRecord.IsRecordType(this)) { return(typeof(NdefHandoverAlternativeCarrierRecord)); } if (NdefMimeImageRecordBase.IsRecordType(this)) { return(typeof(NdefMimeImageRecordBase)); } return(typeof(NdefRecord)); }
private void BtnWriteWindowsSettings_Click(object sender, RoutedEventArgs e) { // Create a Windows 10 Settings record var record = new NdefWindowsSettingsRecord { SettingsApp = NdefWindowsSettingsRecord.NfcSettingsApp.DevicesNfc }; // Publish the record using the proximity device PublishRecord(record, true); }