Example #1
0
 // Called after click to SMS or Tweet radio-button
 private void NoSubject(String my_sign)
 {
     TextInput_Subject.Width     = 323;
     TextInput_Subject.Text      = "n/a";
     TextInput_Subject.IsEnabled = false;
     TextInput_Sender.Text       = my_sign;           // International phone number starts with '+', Twitter account with '@'
     TextInput_Sender.Select(1, 0);
     TextInput_Sender.Focus();
     TextInput_Sender.MaxLength = 16;                 // max length of int. phone number and twitter ID
     TextInput_Message.Height   = 465;                // Covers inputs for SIR E-mail
 }
Example #2
0
 // 3rd -  E-mail
 private void Email_Checked(object sender, RoutedEventArgs e)
 {
     message_type                = "SIR";                                                // at first switches to SIR
     TextInput_Subject.Text      = "SIR " + DateTime.Today.ToString(format: "dd/MM/yy"); // pre-populate for SIR
     TextInput_Subject.IsEnabled = true;
     TextInput_Subject.Width     = 124;                                                  // allow to enter Nature of Accident
     TextInput_Sender.Text       = "@";                                                  // pre-populate 'sender' field fol email entry
     TextInput_Sender.Select(0, 0);
     TextInput_Sender.Focus();
     TextInput_Sender.MaxLength  = 254;               // max length of email address
     TextInput_Message.Height    = 386;               // uncover inputs for SIR
     TextInput_Message.MaxLength = 1028;              // maximum length of the message
 }
Example #3
0
        // Editing 'Sender'
        private void TextInput_Sender_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
        {
            TextInput_Sender.BorderBrush = System.Windows.Media.Brushes.LightGray;

            if (message_type == "SMS")
            {
                if (TextInput_Sender.Text.Length > 1)
                {
                    TextInput_Sender.Text = "+" + ExctractNumbersOnly(TextInput_Sender.Text.Substring(1));
                    TextInput_Sender.Select(TextInput_Sender.Text.Length, 0);
                    TextInput_Sender.Focus();
                }
                else
                {
                    TextInput_Sender.Text = "+";
                    TextInput_Sender.Select(1, 0);
                    TextInput_Sender.Focus();
                }
            }

            if (message_type == "Tweet")
            {
                string new_string = "";
                for (byte i = 1; i < TextInput_Sender.Text.Length; i++)
                {
                    if ((TextInput_Sender.Text[i] >= '0' && TextInput_Sender.Text[i] <= '9') || (TextInput_Sender.Text[i] >= 'a' && TextInput_Sender.Text[i] <= 'z') || (TextInput_Sender.Text[i] >= 'A' && TextInput_Sender.Text[i] <= 'Z') || TextInput_Sender.Text[i] == '_')
                    {
                        new_string += TextInput_Sender.Text[i];
                    }
                }
                TextInput_Sender.Text = "@" + new_string;


                TextInput_Sender.Select(TextInput_Sender.Text.Length, 0);
                TextInput_Sender.Focus();
            }
        }