diff --git a/src/AccessibilityInsights.SharedUx/Controls/EventRecordControl.xaml.cs b/src/AccessibilityInsights.SharedUx/Controls/EventRecordControl.xaml.cs
index a8cb4ed84..dcfa42155 100644
--- a/src/AccessibilityInsights.SharedUx/Controls/EventRecordControl.xaml.cs
+++ b/src/AccessibilityInsights.SharedUx/Controls/EventRecordControl.xaml.cs
@@ -15,7 +15,10 @@
using System;
using System.Collections.Generic;
using System.Globalization;
+using System.IO;
using System.Linq;
+using System.Media;
+using System.Reflection;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Automation;
@@ -36,6 +39,9 @@ public partial class EventRecordControl : UserControl
public TwoStateButtonViewModel vmEventRecorder { get; private set; } = new TwoStateButtonViewModel(ButtonState.Off);
+ private Stream startRecordingSoundStream, stopRecordingSoundStream;
+ private SoundPlayer player;
+
///
/// Event handler to main window for recording start
///
@@ -95,8 +101,12 @@ public static ConfigurationModel AppConfiguration
public EventRecordControl()
{
InitializeComponent();
-
InitCommandBindings();
+
+ player = new SoundPlayer();
+ Assembly assembly = Assembly.GetExecutingAssembly();
+ startRecordingSoundStream = assembly.GetManifestResourceStream(assembly.GetName().Name + ".Resources.Sound.start_event_recording.wav");
+ stopRecordingSoundStream = assembly.GetManifestResourceStream(assembly.GetName().Name + ".Resources.Sound.stop_event_recording.wav");
}
void InitCommandBindings()
@@ -184,6 +194,18 @@ private void onbuttonEventRecorderClicked(object sender, RoutedEventArgs e)
HollowHighlightDriver.GetDefaultInstance().Clear();
}
+ /// If sounds are enabled, play the passed-in stream. Used to enable sound feedback when toggling recording.
+ private void PlaySoundIfNeeded(Stream stream)
+ {
+ if (HelperMethods.ShouldPlaySound)
+ {
+ player.Stop();
+ player.Stream = stream;
+ player.Stream.Position = 0;
+ player.Play();
+ }
+ }
+
///
/// Toggle event recording
///
@@ -236,6 +258,8 @@ private void StartRecordingEvent()
this.tbIntro.Visibility = Visibility.Collapsed;
this.svData.Visibility = Visibility.Visible;
+ PlaySoundIfNeeded(startRecordingSoundStream);
+
this.NotifyRecordingChange(true);
Logger.PublishTelemetryEvent(TelemetryAction.Event_Start_Record);
@@ -310,6 +334,8 @@ await Task.Run(() =>
this.ctrlProgressRing.Deactivate();
+ PlaySoundIfNeeded(stopRecordingSoundStream);
+
this.vmEventRecorder.State = ButtonState.Off;
this.NotifyRecordingChange(false);
}
diff --git a/src/AccessibilityInsights.SharedUx/Resources/Sound/start_event_recording.wav b/src/AccessibilityInsights.SharedUx/Resources/Sound/start_event_recording.wav
new file mode 100644
index 000000000..b92b01c6c
Binary files /dev/null and b/src/AccessibilityInsights.SharedUx/Resources/Sound/start_event_recording.wav differ
diff --git a/src/AccessibilityInsights.SharedUx/Resources/Sound/stop_event_recording.wav b/src/AccessibilityInsights.SharedUx/Resources/Sound/stop_event_recording.wav
new file mode 100644
index 000000000..f4b23f995
Binary files /dev/null and b/src/AccessibilityInsights.SharedUx/Resources/Sound/stop_event_recording.wav differ
diff --git a/src/AccessibilityInsights.SharedUx/SharedUx.csproj b/src/AccessibilityInsights.SharedUx/SharedUx.csproj
index ed574a242..682f9dddf 100644
--- a/src/AccessibilityInsights.SharedUx/SharedUx.csproj
+++ b/src/AccessibilityInsights.SharedUx/SharedUx.csproj
@@ -85,4 +85,13 @@
+
+
+
+
+
+
+
+
+