private void buttonTest_Click(object sender, EventArgs e) { Util.DebugWriteLine(this, "BEGIN"); IEncConverter aEC = InitializeEncConverter; if (aEC != null) { try { aEC.DirectionForward = !checkBoxTestReverse.Checked; //ecTextBoxOutput.Text = aEC.Convert(ecTextBoxInput.Text); string result = aEC.Convert(ecTextBoxInput.Text); Util.DebugWriteLine(this, "Putting in text box: '" + result + "'"); ecTextBoxOutput.Text = result; //ecTextBoxOutput.Text = "Hello there!"; } catch (Exception ex) { MessageBox.Show(String.Format("Test failed! Reason: {0}", ex.Message), EncConverters.cstrCaption); } NormConversionType eType = (checkBoxTestReverse.Checked) ? EncConverter.NormalizeLhsConversionType(ConversionType) : EncConverter.NormalizeRhsConversionType(ConversionType); if (eType == NormConversionType.eLegacy) { UpdateLegacyCodes(ecTextBoxOutput.Text, m_aEC.CodePageOutput, richTextBoxHexOutput); } else { UpdateUniCodes(ecTextBoxOutput.Text, richTextBoxHexOutput); } } }
protected void TestTabInputChanged() { if (m_aEC == null) // means it hasn't been set up yet. { return; } if (ecTextBoxInput.TextLength > 0) { buttonTest.Enabled = true; NormConversionType eType = (checkBoxTestReverse.Checked) ? EncConverter.NormalizeRhsConversionType(ConversionType) : EncConverter.NormalizeLhsConversionType(ConversionType); if (eType == NormConversionType.eLegacy) { UpdateLegacyCodes(ecTextBoxInput.Text, m_aEC.CodePageInput, richTextBoxHexInput); } else { UpdateUniCodes(ecTextBoxInput.Text, richTextBoxHexInput); } } else { richTextBoxHexInput.Clear(); buttonTest.Enabled = false; } // whenever the input changes, clear out the output ecTextBoxOutput.Text = null; richTextBoxHexOutput.Text = null; }
private void buttonTest_Click(object sender, EventArgs e) { IEncConverter aEC = InitializeEncConverter; if (aEC != null) { try { aEC.DirectionForward = !checkBoxTestReverse.Checked; ecTextBoxOutput.Text = aEC.Convert(ecTextBoxInput.Text); } catch (Exception ex) { MessageBox.Show(String.Format("Test failed! Reason: {0}", ex.Message), EncConverters.cstrCaption); } NormConversionType eType = (checkBoxTestReverse.Checked) ? EncConverter.NormalizeLhsConversionType(ConversionType) : EncConverter.NormalizeRhsConversionType(ConversionType); if (eType == NormConversionType.eLegacy) { UpdateLegacyCodes(ecTextBoxOutput.Text, m_aEC.CodePageOutput, richTextBoxHexOutput); } else { UpdateUniCodes(ecTextBoxOutput.Text, richTextBoxHexOutput); } } }
protected bool IsLhsLegacy(IEncConverter aEC) { if (aEC.DirectionForward) { return(EncConverter.NormalizeLhsConversionType(aEC.ConversionType) == NormConversionType.eLegacy); } else { return(EncConverter.NormalizeRhsConversionType(aEC.ConversionType) == NormConversionType.eLegacy); } }