feat: quick fix and rename.

This commit is contained in:
rabbitism
2024-01-28 20:13:44 +08:00
parent 7b8d91cc42
commit 603f92ab21
6 changed files with 20 additions and 13 deletions

View File

@@ -31,12 +31,12 @@ public class DialogControl: ContentControl
{
if (args.OldValue.Value is IDialogContext oldContext)
{
oldContext.Closed-= CloseFromContext;
oldContext.RequestClose-= OnContextRequestClose;
}
if (args.NewValue.Value is IDialogContext newContext)
{
newContext.Closed += CloseFromContext;
newContext.RequestClose += OnContextRequestClose;
}
}
@@ -102,7 +102,7 @@ public class DialogControl: ContentControl
}
}
private void CloseFromContext(object sender, object? args)
private void OnContextRequestClose(object sender, object? args)
{
if (this.DataContext is IDialogContext context)
{

View File

@@ -26,12 +26,12 @@ public class DialogWindow: Window
{
if (args.OldValue.Value is IDialogContext oldContext)
{
oldContext.Closed-= OnDialogContextClose;
oldContext.RequestClose-= OnContextRequestClose;
}
if (args.NewValue.Value is IDialogContext newContext)
{
newContext.Closed += OnDialogContextClose;
newContext.RequestClose += OnContextRequestClose;
}
}
@@ -43,7 +43,7 @@ public class DialogWindow: Window
EventHelper.RegisterClickEvent(OnDefaultClose, _closeButton);
}
private void OnDialogContextClose(object? sender, object? args)
private void OnContextRequestClose(object? sender, object? args)
{
Close(args);
}

View File

@@ -3,5 +3,5 @@ namespace Ursa.Controls;
public interface IDialogContext
{
void Close();
event EventHandler<object?> Closed;
event EventHandler<object?> RequestClose;
}