private void OnResetClicked(object sender, RoutedEventArgs e)
        {
            CheckUIThread();
            if (MessageBoxResult.Yes == MessageBox.Show(this, GetStringResource("reset_message"),
                                                        GetStringResource("reset"), MessageBoxButton.YesNo))
            {
                ReedSolomonImpl = null;
                encodedBytes    = null;
#if NOISE_DECODE_ENABLE
                noisedBytes = decodedBytes = null;
#endif
                inputTextBox.IsReadOnly = encodeButton.IsEnabled = decodeButton.IsEnabled
                                                                       = noiseButton.IsEnabled = changeTextBoxViewButton.IsEnabled
                                                                                                     = resetButton.IsEnabled = isBytesView = false;
                inputTextBox.Text = resultTextBox.Text = inputText = string.Empty;
                changeTextBoxViewButton.Content = GetStringResource("bytes");
            }
        }
        private void OnEncodeClicked(object sender, RoutedEventArgs e)
        {
            CheckUIThread();
            if (encodedBytes == null || MessageBoxResult.Yes == MessageBox.Show(this,
                                                                                GetStringResource("reset_message"), GetStringResource("encode"), MessageBoxButton.YesNo))
            {
                encodedBytes = null;
#if NOISE_DECODE_ENABLE
                noisedBytes = decodedBytes = null;
#endif
                inputText = string.Empty;
                var message = Encoding.ASCII.GetBytes(string.IsNullOrEmpty(inputText) ? inputTextBox.Text : inputText);
                ReedSolomonImpl = new NativeReedSolomonImpl(message);

                if (string.IsNullOrEmpty(polGenTextBox.Text))
                {
                    ReedSolomonImpl.GeneratorPolynomial = DefaultGeneratorPolynomial;
                }
                else if (ushort.TryParse(polGenTextBox.Text, out var pg))
                {
                    ReedSolomonImpl.GeneratorPolynomial = pg;
                }
                else
                {
                    OnIncorrectData(nameof(ReedSolomonImpl.GeneratorPolynomial));
                    ReedSolomonImpl = null;
                    return;
                }
                ReedSolomonImpl.EncodeAsync();
            }
            else
            {
                viewState          = ViewState.Encode;
                resultTextBox.Text = GetResultTextBoxText(viewState);
            }
        }
 private void OnWindowClosing(object sender, CancelEventArgs e) => ReedSolomonImpl = null;