void SelectMedia() { Unselect(); MediaButton.SetSelected(true); control = new RtdMediaControl(); control.Dock = DockStyle.Fill; pMain.Controls.Add(control); }
void SelectWifiHandover() { Unselect(); //WifiHandoverButton.SetSelected(true); control = new RtdWifiHandoverControl(); control.Dock = DockStyle.Fill; pMain.Controls.Add(control); }
void SelectVCard() { Unselect(); VCardButton.SetSelected(true); control = new RtdVCardControl(); control.Dock = DockStyle.Fill; pMain.Controls.Add(control); }
void SelectSmartPoster() { Unselect(); SmartPosterButton.SetSelected(true); control = new RtdSmartPosterControl(); control.Dock = DockStyle.Fill; pMain.Controls.Add(control); }
void SelectText() { Unselect(); TextButton.SetSelected(true); control = new RtdTextControl(); control.Dock = DockStyle.Fill; pMain.Controls.Add(control); }
void SelectUri() { Unselect(); UriButton.SetSelected(true); control = new RtdUriControl(); control.Dock = DockStyle.Fill; pMain.Controls.Add(control); }
public void SetNdef(Ndef ndef) { /* Display the NDEF as raw data in the hexBox */ /* ------------------------------------------ */ Trace.WriteLine("SetNdef"); byte[] b = ndef.GetBytes(); DynamicByteProvider p = new DynamicByteProvider(b); hexBox.ByteProvider = p; /* Try to recognize the NDEF, to display it in a user-friendly control */ /* ------------------------------------------------------------------- */ RtdControl control = null; if (ndef is RtdSmartPoster) { lbDecodedType.Text = "SmartPoster"; control = new RtdSmartPosterControl(); control.SetContent(ndef); } else if (ndef is RtdUri) { lbDecodedType.Text = "URI"; control = new RtdUriControl(); control.SetContent(ndef); } else if (ndef is RtdText) { lbDecodedType.Text = "Text"; control = new RtdControl(); control.SetContent(ndef); } else if (ndef is RtdVCard) { lbDecodedType.Text = "VCard"; control = new RtdVCardControl(); control.SetContent(ndef); } else if (ndef is RtdMedia) { lbDecodedType.Text = "Media (MIME)"; control = new RtdMediaControl(); control.SetContent(ndef); } if (control != null) { pDecoded.Controls.Clear(); control.Dock = DockStyle.Fill; pDecoded.Controls.Add(control); } }
void CbNdefTypeSelectedIndexChanged(object sender, EventArgs e) { if (control != null) { pMain.Controls.Remove(control); control.Dispose(); control = null; } switch (cbNdefType.SelectedIndex) { case 0: /* Text */ control = new RtdTextControl(); break; case 1: /* URI */ control = new RtdUriControl(); break; case 2: /* SmartPoster */ control = new RtdSmartPosterControl(); break; case 3: /* vCard */ control = new RtdVCardControl(); break; case 4: /* Arbitrary MIME Media (text) */ control = new RtdMediaControl(); break; case 5: /* WifiHandover */ control = new RtdWifiHandoverControl(); break; default: break; } if (control != null) { control.Dock = DockStyle.Fill; pMain.Controls.Add(control); } }
void Unselect() { if (control != null) { pMain.Controls.Remove(control); control.Dispose(); control = null; } SmartPosterButton.SetSelected(false); UriButton.SetSelected(false); TextButton.SetSelected(false); VCardButton.SetSelected(false); MediaButton.SetSelected(false); //WifiHandoverButton.SetSelected(false); }