예제 #1
0
        private void ExportAudioButton_Click(object sender, RoutedEventArgs e)
        {
            var saveFileDialog = new SaveFileDialog
            {
                FileName   = "MorseCode - " + AudioSpeedComboBox.Text,
                DefaultExt = ".wav",
                Filter     = "Waveform Audio File|*.wav"
            };

            if (saveFileDialog.ShowDialog() != true)
            {
                return;
            }

            var text     = OutputRichTextBox.GetText();
            var speed    = AudioSpeedComboBox.SelectedIndex;
            var fileName = saveFileDialog.FileName;

            MorseAudioGenerator.Generate(fileName, text, CharsDelimiter, WordsDelimiter, speed);

            var content   = $"{saveFileDialog.SafeFileName} is Saved!";
            var arguments = $"/select, \"{fileName}\"";

            void Action() => Process.Start("explorer.exe", arguments);

            Snackbar.MessageQueue.Enqueue(content, "Open", Action);
        }