Profile adaption - Added support for device hint to 'all' devices

Layouts - Round LED sizes to integers
Auto-update - Use modern Windows 10 toasts
UI - On shutdown wait 6 seconds longer before force-shutdown
UI - Use black icons in notifications on white Windows theme
Message service - Added optional toast callbacks
This commit is contained in:
Robert committed 2021-05-14 21:49:10 +02:00
1 parent 5c337e9c5e
commit 96c55e5c03
26 files changed
+886 -674

No files matched your search

@@ -17,7 +17,7 @@ namespace Artemis.UI.Shared.Services
/// Sets up the notification provider that shows desktop notifications
/// </summary>
/// <param name="notificationProvider">The notification provider that shows desktop notifications</param>
void ConfigureNotificationProvider(INotificationProvider notificationProvider);
void SetNotificationProvider(INotificationProvider notificationProvider);
/// <summary>
/// Queues a notification message for display in a snackbar.
@@ -123,7 +123,9 @@ namespace Artemis.UI.Shared.Services
/// </summary>
/// <param name="title">The title of the notification</param>
/// <param name="message">The message of the notification</param>
void ShowNotification(string title, string message);
/// <param name="activatedCallback">An optional callback that is invoked when the notification is clicked</param>
/// <param name="dismissedCallback">An optional callback that is invoked when the notification is dismissed</param>
void ShowNotification(string title, string message, Action? activatedCallback = null, Action? dismissedCallback = null);
/// <summary>
/// Shows a desktop notification with a Material Design icon
@@ -131,7 +133,9 @@ namespace Artemis.UI.Shared.Services
/// <param name="title">The title of the notification</param>
/// <param name="message">The message of the notification</param>
/// <param name="icon">The name of the icon</param>
void ShowNotification(string title, string message, PackIconKind icon);
/// <param name="activatedCallback">An optional callback that is invoked when the notification is clicked</param>
/// <param name="dismissedCallback">An optional callback that is invoked when the notification is dismissed</param>
void ShowNotification(string title, string message, PackIconKind icon, Action? activatedCallback = null, Action? dismissedCallback = null);
/// <summary>
/// Shows a desktop notification with a Material Design icon
@@ -139,6 +143,8 @@ namespace Artemis.UI.Shared.Services
/// <param name="title">The title of the notification</param>
/// <param name="message">The message of the notification</param>
/// <param name="icon">The name of the icon as a string</param>
void ShowNotification(string title, string message, string icon);
/// <param name="activatedCallback">An optional callback that is invoked when the notification is clicked</param>
/// <param name="dismissedCallback">An optional callback that is invoked when the notification is dismissed</param>
void ShowNotification(string title, string message, string icon, Action? activatedCallback = null, Action? dismissedCallback = null);
}
}
@@ -1,4 +1,5 @@
using MaterialDesignThemes.Wpf;
using System;
using MaterialDesignThemes.Wpf;
namespace Artemis.UI.Shared.Services
{
@@ -6,7 +7,7 @@ namespace Artemis.UI.Shared.Services
/// Represents a class provides desktop notifications so that <see cref="IMessageService" /> can us it to show desktop
/// notifications
/// </summary>
public interface INotificationProvider
public interface INotificationProvider : IDisposable
{
/// <summary>
/// Shows a notification
@@ -14,6 +15,8 @@ namespace Artemis.UI.Shared.Services
/// <param name="title">The title of the notification</param>
/// <param name="message">The message of the notification</param>
/// <param name="icon">The Material Design icon to show in the notification</param>
void ShowNotification(string title, string message, PackIconKind icon);
/// <param name="activatedCallback">A callback that is invoked when the notification is clicked</param>
/// <param name="dismissedCallback">A callback that is invoked when the notification is dismissed</param>
void ShowNotification(string title, string message, PackIconKind icon, Action? activatedCallback, Action? dismissedCallback);
}
}
@@ -3,7 +3,7 @@ using MaterialDesignThemes.Wpf;
namespace Artemis.UI.Shared.Services
{
internal class MessageService : IMessageService
internal class MessageService : IMessageService, IDisposable
{
private INotificationProvider? _notificationProvider;
public ISnackbarMessageQueue MainMessageQueue { get; }
@@ -14,8 +14,12 @@ namespace Artemis.UI.Shared.Services
}
/// <inheritdoc />
public void ConfigureNotificationProvider(INotificationProvider notificationProvider)
public void SetNotificationProvider(INotificationProvider notificationProvider)
{
if (ReferenceEquals(_notificationProvider, notificationProvider))
return;
_notificationProvider?.Dispose();
_notificationProvider = notificationProvider;
}
@@ -72,22 +76,32 @@ namespace Artemis.UI.Shared.Services
}
/// <inheritdoc />
public void ShowNotification(string title, string message)
public void ShowNotification(string title, string message, Action? activatedCallback = null, Action? dismissedCallback = null)
{
_notificationProvider?.ShowNotification(title, message, PackIconKind.None);
_notificationProvider?.ShowNotification(title, message, PackIconKind.None, activatedCallback, dismissedCallback);
}
/// <inheritdoc />
public void ShowNotification(string title, string message, PackIconKind icon)
public void ShowNotification(string title, string message, PackIconKind icon, Action? activatedCallback = null, Action? dismissedCallback = null)
{
_notificationProvider?.ShowNotification(title, message, icon);
_notificationProvider?.ShowNotification(title, message, icon, activatedCallback, dismissedCallback);
}
/// <inheritdoc />
public void ShowNotification(string title, string message, string icon)
public void ShowNotification(string title, string message, string icon, Action? activatedCallback = null, Action? dismissedCallback = null)
{
Enum.TryParse(typeof(PackIconKind), icon, true, out object? iconKind);
_notificationProvider?.ShowNotification(title, message, (PackIconKind) (iconKind ?? PackIconKind.None));
_notificationProvider?.ShowNotification(title, message, (PackIconKind) (iconKind ?? PackIconKind.None), activatedCallback, dismissedCallback);
}
#region IDisposable
/// <inheritdoc />
public void Dispose()
{
_notificationProvider?.Dispose();
}
#endregion
}
}