feat: quick fix and rename.
This commit is contained in:
@@ -5,6 +5,6 @@
|
||||
xmlns:u-semi="https://irihi.tech/ursa/themes/semi">
|
||||
<Application.Styles>
|
||||
<StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" />
|
||||
<u-semi:SemiTheme Locale="en-US"/>
|
||||
<u-semi:SemiTheme Locale="zh-CN"/>
|
||||
</Application.Styles>
|
||||
</Application>
|
||||
@@ -14,10 +14,10 @@ public partial class DialogWithActionViewModel: ObservableObject, IDialogContext
|
||||
|
||||
public void Close()
|
||||
{
|
||||
Closed?.Invoke(this, false);
|
||||
RequestClose?.Invoke(this, false);
|
||||
}
|
||||
|
||||
public event EventHandler<object?>? Closed;
|
||||
public event EventHandler<object?>? RequestClose;
|
||||
|
||||
public ICommand OKCommand { get; set; }
|
||||
public ICommand CancelCommand { get; set; }
|
||||
@@ -35,12 +35,12 @@ public partial class DialogWithActionViewModel: ObservableObject, IDialogContext
|
||||
|
||||
private void OK()
|
||||
{
|
||||
Closed?.Invoke(this, true);
|
||||
RequestClose?.Invoke(this, true);
|
||||
}
|
||||
|
||||
private void Cancel()
|
||||
{
|
||||
Closed?.Invoke(this, false);
|
||||
RequestClose?.Invoke(this, false);
|
||||
}
|
||||
|
||||
private async Task ShowDialog()
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -3,5 +3,5 @@ namespace Ursa.Controls;
|
||||
public interface IDialogContext
|
||||
{
|
||||
void Close();
|
||||
event EventHandler<object?> Closed;
|
||||
event EventHandler<object?> RequestClose;
|
||||
}
|
||||
@@ -194,6 +194,7 @@ public abstract class NumericUpDown : TemplatedControl
|
||||
if (AllowDrag && _dragPanel is not null)
|
||||
{
|
||||
_dragPanel.IsVisible = true;
|
||||
_dragPanel.Focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -204,8 +205,14 @@ public abstract class NumericUpDown : TemplatedControl
|
||||
if (e.ClickCount == 2 && _dragPanel is not null && AllowDrag)
|
||||
{
|
||||
_dragPanel.IsVisible = false;
|
||||
_textBox.IsReadOnly = false;
|
||||
}
|
||||
_textBox?.Focus();
|
||||
else
|
||||
{
|
||||
_textBox?.Focus();
|
||||
_textBox!.IsReadOnly = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void OnDragPanelPointerReleased(object sender, PointerReleasedEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user