예제 #1
0
        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;
                }
            }
        }
예제 #2
0
 public override string ToString()
 {
     return(BeaconFactory.FormatUuid(Id1) + ":" + Id2 + ":" + Id3);
 }