mirror of
https://github.com/usatiuk/PomoTime.git
synced 2025-10-29 00:47:48 +01:00
@@ -17,6 +17,8 @@ using Windows.UI.Xaml.Navigation;
|
|||||||
using Windows.Storage;
|
using Windows.Storage;
|
||||||
using Windows.System.Threading;
|
using Windows.System.Threading;
|
||||||
using Windows.UI.Core;
|
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
|
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
|
||||||
@@ -136,6 +138,7 @@ namespace PomoTime
|
|||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException();
|
||||||
}
|
}
|
||||||
|
SendToast();
|
||||||
}
|
}
|
||||||
else
|
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)
|
private void PlayButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,8 +32,7 @@ namespace PomoTime
|
|||||||
output = "Work";
|
output = "Work";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
output = "Something wrong";
|
throw new ArgumentOutOfRangeException();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the month value to pass to the target.
|
// Return the month value to pass to the target.
|
||||||
|
|||||||
Reference in New Issue
Block a user