public static Show ( |
||
owner | ||
title | string | |
message | string | |
exception | ||
return | void |
private void _upload_Click(object sender, EventArgs e) { _progress.Value = 0; _progress.Visible = true; try { Cursor = Cursors.WaitCursor; IEnumerable <UploadAudioPattern> audioPatterns = GetAudioPatterns(); IEnumerable <UploadLedPattern> ledPatterns = GetLedPatterns(); _sirenOfShameDevice.UploadCustomPatterns(audioPatterns, ledPatterns, progress => { Invoke(() => { _progress.Value = progress; }); }); _progress.Value = 100; _progress.Visible = false; } catch (Exception ex) { Log.Error("Could not upload", ex); ExceptionMessageBox.Show(this, "Error Uploading", "Could not upload patterns", ex); _progress.Visible = false; } finally { Cursor = Cursors.Default; } }
private void _audioAdd_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); if (dlg.ShowDialog(this) == DialogResult.OK) { try { string outputFileName = Path.Combine(Path.GetDirectoryName(_settings.FileName), Path.GetFileNameWithoutExtension(dlg.FileName) + ".u8"); _audioFileService.Convert(dlg.FileName).WriteToFile(outputFileName); var setting = new AudioPatternSetting { FileName = outputFileName, Name = Path.GetFileNameWithoutExtension(outputFileName) }; AddOrUpdateAudioPattern(setting); } catch (Exception ex) { ExceptionMessageBox.Show(this, "Error Adding Audio Pattern", "Could not add audio pattern.", ex); } } }