Skip to content

Commit

Permalink
Stop the timer while it's not recording
Browse files Browse the repository at this point in the history
Timer always tick and did not do anything. while not recording.

(cherry picked from commit 73b8d01)
  • Loading branch information
MELSunny authored and sebastienwarin committed Nov 15, 2019
1 parent 9dbffb6 commit ac73a86
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion SWYH/Windows/RecordWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public RecordWindow()
{
InitializeComponent();
timer.Tick += new EventHandler(timer_Tick);
timer.Start();
}

void timer_Tick(object sender, EventArgs e)
Expand All @@ -66,6 +65,7 @@ private void Window_Loaded(object sender, RoutedEventArgs e)

private void btRecord_Click(object sender, RoutedEventArgs e)
{
timer.Start();
this.isRecording = true;
this.startDate = DateTime.Now;
App.CurrentInstance.swyhDevice.sessionMp3Streams.GetOrAdd(Int32.MinValue, new PipeStream());
Expand All @@ -75,6 +75,7 @@ private void btRecord_Click(object sender, RoutedEventArgs e)

private void btStop_Click(object sender, RoutedEventArgs e)
{
timer.Stop();
this.isRecording = false;
PipeStream value = null;
while (!App.CurrentInstance.swyhDevice.sessionMp3Streams.TryRemove(Int32.MinValue, out value)) ; ;
Expand Down Expand Up @@ -144,6 +145,7 @@ private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs
this.UpdateUi();
}
this.Hide();
timer.Stop();
}

private void Window_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
Expand Down

0 comments on commit ac73a86

Please sign in to comment.