private void OnAdvertisingTextBoxTextChanged(object sender, TextChangedEventArgs e) { if (sender is TextBox) { TextBox textBox = sender as TextBox; string textBoxName = textBox.Name.ToLower(); string text = textBox.Text; if (textBoxName.StartsWith("beaconid1")) { int oldTextLength = text.Length; int oldCaretPosition = textBox.SelectionStart; BeaconId1 = BeaconFactory.FormatUuid(text); int newCaretPosition = oldCaretPosition + (BeaconId1.Length - oldTextLength); if (newCaretPosition > 0 && newCaretPosition <= BeaconId1.Length) { textBox.SelectionStart = newCaretPosition; } } else if (textBoxName.StartsWith("beaconid2")) { BeaconId2 = text; } else if (textBoxName.StartsWith("beaconid3")) { BeaconId3 = text; } } }
public override string ToString() { return(BeaconFactory.FormatUuid(Id1) + ":" + Id2 + ":" + Id3); }