add PlaySound method
This commit is contained in:
parent
61d34a0732
commit
4076447416
BIN
SCRUM-Timer/Assets/ringtone001.wav
Normal file
BIN
SCRUM-Timer/Assets/ringtone001.wav
Normal file
Binary file not shown.
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
|
|
||||||
namespace SCRUM_Timer;
|
namespace SCRUM_Timer;
|
||||||
|
|
||||||
public class CountdownTimer
|
public class CountdownTimer
|
||||||
@ -9,7 +10,9 @@ public class CountdownTimer
|
|||||||
public bool isRunning;
|
public bool isRunning;
|
||||||
private Thread timerThread;
|
private Thread timerThread;
|
||||||
|
|
||||||
|
|
||||||
public event EventHandler<TimeSpan>? TimeChanged;
|
public event EventHandler<TimeSpan>? TimeChanged;
|
||||||
|
public event EventHandler? CountdownEndReached;
|
||||||
|
|
||||||
public CountdownTimer()
|
public CountdownTimer()
|
||||||
{
|
{
|
||||||
@ -38,6 +41,14 @@ public class CountdownTimer
|
|||||||
TimeSpan tickTime = new TimeSpan(0, 0, 1);
|
TimeSpan tickTime = new TimeSpan(0, 0, 1);
|
||||||
while (isRunning)
|
while (isRunning)
|
||||||
{
|
{
|
||||||
|
if (ActualTime == TimeSpan.Zero) //If 00:00:00 reached
|
||||||
|
{
|
||||||
|
isRunning = false;
|
||||||
|
CountdownEndReached?.Invoke(this, null);
|
||||||
|
Console.WriteLine("Timer is stopped");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
ActualTime = ActualTime.Subtract(tickTime);
|
ActualTime = ActualTime.Subtract(tickTime);
|
||||||
TimeChanged?.Invoke(this, ActualTime);
|
TimeChanged?.Invoke(this, ActualTime);
|
||||||
Console.WriteLine(ActualTime);
|
Console.WriteLine(ActualTime);
|
||||||
@ -58,4 +69,9 @@ public class CountdownTimer
|
|||||||
Console.WriteLine($"Changed Time To: {time}");
|
Console.WriteLine($"Changed Time To: {time}");
|
||||||
TimeChanged?.Invoke(this, ActualTime);
|
TimeChanged?.Invoke(this, ActualTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void PlaySound()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -19,7 +19,7 @@ public partial class MainWindow : Window
|
|||||||
Dispatcher.UIThread.Post(() => { TimeText.Text = ts.ToString(@"hh\:mm\:ss"); });
|
Dispatcher.UIThread.Post(() => { TimeText.Text = ts.ToString(@"hh\:mm\:ss"); });
|
||||||
};
|
};
|
||||||
|
|
||||||
// Startwert anzeigen
|
// Show time
|
||||||
TimeText.Text = countdownTimer.ActualTime.ToString(@"hh\:mm\:ss");
|
TimeText.Text = countdownTimer.ActualTime.ToString(@"hh\:mm\:ss");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("SCRUM-Timer")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("SCRUM-Timer")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+c75571d37f7336dfb52fed9dc6d68bf9b9f45b5b")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+61d34a07322c12eda04f3d0b42138bdbcbfecb60")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("SCRUM-Timer")]
|
[assembly: System.Reflection.AssemblyProductAttribute("SCRUM-Timer")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("SCRUM-Timer")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("SCRUM-Timer")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
9c6fe80198f5371ea3d3b92476d3d3b511441274fad1a2af08f329e71215972b
|
ab040ed544ed55e89cafba8bf0618c74dc63a5fcd550dd04c456f26224f4ed78
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user