Esempio n. 1
0
        // When the Write button in the default NDEF groupbox is pressed, the form is closed
        private void writeDefaultNdef(object sender, EventArgs e)
        {
            if (utils == null)
            {
                utils = new NDEFUtils(this.myDevice);
            }

            byte i2cAddress = Utils.HexToByte(this.addressInput_TxtB.Text);

            byte[] NDEFmessage;
            this.isNDEFbuttonpressed = true;
            this.NDEFtext            = this.textNdef_textBox.Text;


            if (this.myDevice.isPresent)
            {
                utils.CreateDefaultNdef(out NDEFmessage);

                // Write the message into the tag and update the data grid views
                I2CData result = this.myDevice.writeMessage(i2cAddress, NDEFmessage);

                this.logging.Text = result.log;
                if (result.error == I2CError.Success)
                {
                    this.updateTablesWithNdef(NDEFmessage);
                }

                // Update error status bar
                this.operationStatus_Lbl.Text = this.GetTextError(result.error);
                dgvUtils.markTlvs(type);
            }
            else
            {
                Utils.showDevLostAndClose(this);
            }
        }
Esempio n. 2
0
 public WriteNdefForm()
 {
     InitializeComponent();
     utils = new NDEFUtils(this.myDevice);
 }