public static NfcTagRecord FromUrl(string url)
        {
            if (!string.IsNullOrWhiteSpace(url))
            {
                var nfcTagRecord = new NfcTagRecord();

                FromUrl(nfcTagRecord, url);

                if (nfcTagRecord.IsValid())
                    return nfcTagRecord;
                else
                    return null;
            }

            return null;
        }
        private static void FromUrl(NfcTagRecord nfcTagRecord, string url)
        {
            nfcTagRecord.Url = url;

            if (!string.IsNullOrWhiteSpace(url))
            {
                var match = NfcTouchUrlRegex.Match(url);

                if (match != null && match.Success)
                {
                    var domainGroup = match.Groups["domain"];

                    if (domainGroup != null)
                        nfcTagRecord.Domain = domainGroup.Value;

                    var deviceIdGroup = match.Groups["deviceId"];

                    if (deviceIdGroup != null)
                        nfcTagRecord.DeviceId = deviceIdGroup.Value;
                }
            }
        }
        public PlatformNfcTag EncodeNfcTag(Device device, bool makeReadOnly = true)
        {
            var nfcTag = this.GetNfcTag();
            this.CheckForNfcTag(nfcTag);

            var platformNfcTag = new PlatformNfcTag();

            using (var ndef = NdefTechnology.Get(nfcTag))
            {
                ndef.Connect();

                if (!ndef.IsWritable)
                    throw new ApplicationException("The nfc tag is not writable.");

                platformNfcTag.Uid = ndef.TagUIDString();

                var nfcTagRecord = new NfcTagRecord(device);
                ndef.WriteNdefMessage(nfcTagRecord);

                platformNfcTag.Record = nfcTagRecord;

                if (makeReadOnly && ndef.CanMakeReadOnly)
                {
                    ndef.MakeReadOnly();
                    platformNfcTag.ReadOnly = true;
                }
                else
                {
                    platformNfcTag.ReadOnly = false;
                }
            }

            return platformNfcTag;
        }