Make notifications less noisy

This commit is contained in:
Dean Herbert 2018-07-13 21:25:08 +09:00
parent d08c44a726
commit ac4f25c5bc
4 changed files with 15 additions and 2 deletions

View File

@ -111,6 +111,8 @@ protected override void LoadComplete()
private class UpdateCompleteNotification : SimpleNotification
{
public override bool IsImportant => true;
public UpdateCompleteNotification(string version, Action<string> openUrl = null)
{
Text = $"You are now running osu!lazer {version}.\nClick to see what's new!";

View File

@ -116,7 +116,7 @@ protected ArchiveModelManager(Storage storage, IDatabaseContextFactory contextFa
/// <param name="paths">One or more archive locations on disk.</param>
public void Import(params string[] paths)
{
var notification = new ProgressNotification
var notification = new ImportNotification
{
Text = "Import is initialising...",
Progress = 0,
@ -407,5 +407,10 @@ private ArchiveReader getReaderFrom(string path)
return new LegacyFilesystemReader(path);
throw new InvalidFormatException($"{path} is not a valid archive");
}
private class ImportNotification : ProgressNotification
{
public override bool IsImportant => true;
}
}
}

View File

@ -128,7 +128,8 @@ public void Post(Notification notification) => postScheduler.Add(() =>
var section = sections.Children.FirstOrDefault(s => s.AcceptTypes.Any(accept => accept.IsAssignableFrom(ourType)));
section?.Add(notification, notification.DisplayOnTop ? -runningDepth : runningDepth);
State = Visibility.Visible;
if (notification.IsImportant)
State = Visibility.Visible;
updateCounts();
});

View File

@ -23,6 +23,11 @@ public abstract class Notification : Container
/// </summary>
public event Action Closed;
/// <summary>
/// Whether this notification should forcefully display itself.
/// </summary>
public virtual bool IsImportant => false;
/// <summary>
/// Run on user activating the notification. Return true to close.
/// </summary>