From f8594acb1d4018feb2e12af710f103be72580f15 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 8 Jun 2022 18:10:41 +0900 Subject: [PATCH] Cleanup dialog implementation --- osu.Game/Screens/Select/SkinDeleteDialog.cs | 48 ++++++++------------- 1 file changed, 19 insertions(+), 29 deletions(-) diff --git a/osu.Game/Screens/Select/SkinDeleteDialog.cs b/osu.Game/Screens/Select/SkinDeleteDialog.cs index c7c36fb92c..4262118658 100644 --- a/osu.Game/Screens/Select/SkinDeleteDialog.cs +++ b/osu.Game/Screens/Select/SkinDeleteDialog.cs @@ -5,48 +5,38 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Skinning; using osu.Game.Overlays.Dialog; -using osu.Game.Database; namespace osu.Game.Screens.Select { public class SkinDeleteDialog : PopupDialog { - private SkinManager manager; - - [BackgroundDependencyLoader] - private void load(SkinManager skinManager) - { - manager = skinManager; - } + [Resolved] + private SkinManager manager { get; set; } public SkinDeleteDialog(Skin skin) { - skin.SkinInfo.PerformRead(s => + BodyText = skin.SkinInfo.Value.Name; + Icon = FontAwesome.Regular.TrashAlt; + HeaderText = @"Confirm deletion of"; + Buttons = new PopupDialogButton[] { - BodyText = s.Name; - - Icon = FontAwesome.Regular.TrashAlt; - HeaderText = @"Confirm deletion of"; - Buttons = new PopupDialogButton[] + new PopupDialogDangerousButton { - new PopupDialogDangerousButton + Text = @"Yes. Totally. Delete it.", + Action = () => { - Text = @"Yes. Totally. Delete it.", - Action = () => - { - if (manager == null) - return; + if (manager == null) + return; - manager.Delete(s); - manager.CurrentSkinInfo.Value = DefaultSkin.CreateInfo().ToLiveUnmanaged(); - }, + manager.Delete(skin.SkinInfo.Value); + manager.CurrentSkinInfo.SetDefault(); }, - new PopupDialogCancelButton - { - Text = @"Firetruck, I didn't mean to!", - }, - }; - }); + }, + new PopupDialogCancelButton + { + Text = @"Firetruck, I didn't mean to!", + }, + }; } } }