private void ReadFromClipboard() { if (Clipboard.ContainsText(TextDataFormat.Text)) { string copiedText = Clipboard.GetText(TextDataFormat.Text).Trim(); if (BinaryProcessor.IsBinaryNumber(copiedText)) { BinaryTextBox.Text = copiedText; } else if (HexProcessor.IsHexNumber(copiedText)) { HexTextBox.Text = copiedText; } else if (IntegerProcessor.IsInteger(copiedText, out int intNumber)) { IntegerTextBox.Text = copiedText; } } }
private void BinaryTextBox_TextChanged(object sender, TextChangedEventArgs e) { var input = BinaryTextBox.Text.Trim(); if (!string.IsNullOrEmpty(input)) { if (BinaryProcessor.IsBinaryNumber(input)) { var binaryValue = BinaryProcessor.ConvertToBinary(input); IntegerTextBox.Text = binaryValue.ToString(); HexTextBox.Text = binaryValue.ToHexString(); PostConvertion(input); } else { ErrorMessage.Text = ERROR_MESSAGE; } } else { RefreshExecute(null, null); } }