Esempio n. 1
0
        private void TextBoxPlainText_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
        {
            switch (ConversionUtility.RecogniseDataSystem(TextBoxPlainText.Text.ToString()))
            {
            case 1:
                RadioButtonPlainTextBin.IsChecked   = true;
                RadioButtonPlainTextHex.IsChecked   = false;
                RadioButtonPlainTextPlain.IsChecked = false;
                break;

            case 2:
                RadioButtonPlainTextBin.IsChecked   = false;
                RadioButtonPlainTextHex.IsChecked   = true;
                RadioButtonPlainTextPlain.IsChecked = false;
                break;

            case 3:
                RadioButtonPlainTextBin.IsChecked   = false;
                RadioButtonPlainTextHex.IsChecked   = false;
                RadioButtonPlainTextPlain.IsChecked = true;
                break;

            default:
                if (TextBoxPlainText.Text != String.Empty)
                {
                    TextBoxPlainText.Text = "Nieznany format.";
                }
                break;
            }
        }
Esempio n. 2
0
        private void RadioButtonPlainTextBin_Checked(object sender, RoutedEventArgs e)
        {
            switch (ConversionUtility.RecogniseDataSystem(TextBoxPlainText.Text.ToString()))
            {
            case 1:
                break;

            case 2:
                TextBoxPlainText.Text = Converters.HexToBin(TextBoxPlainText.Text);
                break;

            case 3:
                TextBoxPlainText.Text = Converters.TextToBin(TextBoxPlainText.Text);
                break;

            default:
                TextBoxPlainText.Text = "Nieznany format.";
                break;
            }
        }