mirror of
https://github.com/usatiuk/PomoTime.git
synced 2025-10-28 08:27:48 +01:00
@@ -17,6 +17,8 @@ using Windows.UI.Xaml.Navigation;
|
||||
using Windows.Storage;
|
||||
using Windows.System.Threading;
|
||||
using Windows.UI.Core;
|
||||
using Microsoft.Toolkit.Uwp.Notifications;
|
||||
using Windows.UI.Notifications;
|
||||
|
||||
|
||||
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
|
||||
@@ -136,6 +138,7 @@ namespace PomoTime
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
SendToast();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -148,6 +151,48 @@ namespace PomoTime
|
||||
}
|
||||
}
|
||||
|
||||
void SendToast()
|
||||
{
|
||||
string header;
|
||||
switch (runningState.CurrentPeriod)
|
||||
{
|
||||
case Period.LongBreak:
|
||||
header = "Long break time!";
|
||||
break;
|
||||
case Period.ShortBreak:
|
||||
header = "Short break time!";
|
||||
break;
|
||||
case Period.Work:
|
||||
header = "Work time!";
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
ToastVisual visual = new ToastVisual()
|
||||
{
|
||||
BindingGeneric = new ToastBindingGeneric()
|
||||
{
|
||||
Children =
|
||||
{
|
||||
new AdaptiveText()
|
||||
{
|
||||
Text = header
|
||||
},
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
ToastContent toastContent = new ToastContent()
|
||||
{
|
||||
Visual = visual,
|
||||
};
|
||||
|
||||
var toast = new ToastNotification(toastContent.GetXml());
|
||||
toast.ExpirationTime = DateTime.Now.AddMinutes(runningState.MinutesLeft);
|
||||
ToastNotificationManager.CreateToastNotifier().Show(toast);
|
||||
}
|
||||
|
||||
|
||||
private void PlayButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
@@ -32,8 +32,7 @@ namespace PomoTime
|
||||
output = "Work";
|
||||
break;
|
||||
default:
|
||||
output = "Something wrong";
|
||||
break;
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
// Return the month value to pass to the target.
|
||||
|
||||
Reference in New Issue
Block a user