fix: fix nullable annotations in popconfirm.
This commit is contained in:
@@ -182,7 +182,7 @@ public class PopConfirm : ContentControl
|
|||||||
Button.ClickEvent.AddHandler(OnButtonClicked, _closeButton, _cancelButton, _confirmButton);
|
Button.ClickEvent.AddHandler(OnButtonClicked, _closeButton, _cancelButton, _confirmButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnButtonClicked(object sender, RoutedEventArgs e)
|
private void OnButtonClicked(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!HandleAsyncCommand) _popup?.SetValue(Popup.IsOpenProperty, false);
|
if (!HandleAsyncCommand) _popup?.SetValue(Popup.IsOpenProperty, false);
|
||||||
// This is a hack for MVVM toolkit and Prism that uses INotifyPropertyChanged for async command. It counts the number of
|
// This is a hack for MVVM toolkit and Prism that uses INotifyPropertyChanged for async command. It counts the number of
|
||||||
@@ -243,7 +243,7 @@ public class PopConfirm : ContentControl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnMainElementLostFocus(object sender, RoutedEventArgs e)
|
private void OnMainElementLostFocus(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var newFocus = TopLevel.GetTopLevel(this)?.FocusManager?.GetFocusedElement();
|
var newFocus = TopLevel.GetTopLevel(this)?.FocusManager?.GetFocusedElement();
|
||||||
if (newFocus is Visual v && _popup?.IsInsidePopup(v) == true) return;
|
if (newFocus is Visual v && _popup?.IsInsidePopup(v) == true) return;
|
||||||
@@ -251,7 +251,7 @@ public class PopConfirm : ContentControl
|
|||||||
}
|
}
|
||||||
|
|
||||||
private bool _suppressButtonClickEvent;
|
private bool _suppressButtonClickEvent;
|
||||||
private void OnMainElementGotFocus(object sender, GotFocusEventArgs e)
|
private void OnMainElementGotFocus(object? sender, GotFocusEventArgs e)
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Got Focus");
|
Debug.WriteLine("Got Focus");
|
||||||
if (TriggerMode.HasFlag(PopConfirmTriggerMode.Click) && TriggerMode.HasFlag(PopConfirmTriggerMode.Focus))
|
if (TriggerMode.HasFlag(PopConfirmTriggerMode.Click) && TriggerMode.HasFlag(PopConfirmTriggerMode.Focus))
|
||||||
@@ -270,7 +270,7 @@ public class PopConfirm : ContentControl
|
|||||||
LostFocusEvent.RemoveHandler(OnMainElementLostFocus, child);
|
LostFocusEvent.RemoveHandler(OnMainElementLostFocus, child);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnMainButtonClicked(object sender, RoutedEventArgs e)
|
private void OnMainButtonClicked(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Main Button Clicked");
|
Debug.WriteLine("Main Button Clicked");
|
||||||
if (!_suppressButtonClickEvent)
|
if (!_suppressButtonClickEvent)
|
||||||
@@ -281,7 +281,7 @@ public class PopConfirm : ContentControl
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void OnMainElementPressed(object sender, PointerPressedEventArgs e)
|
private void OnMainElementPressed(object? sender, PointerPressedEventArgs e)
|
||||||
{
|
{
|
||||||
SetCurrentValue(IsDropdownOpenProperty, !IsDropdownOpen);
|
SetCurrentValue(IsDropdownOpenProperty, !IsDropdownOpen);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Controls.Primitives;
|
using Avalonia.Controls.Primitives;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Interactivity;
|
|
||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
|
|
||||||
namespace Ursa.Controls;
|
namespace Ursa.Controls;
|
||||||
@@ -28,7 +27,7 @@ public class WindowThumb: Control
|
|||||||
this.AddHandler(DoubleTappedEvent, OnTapped);
|
this.AddHandler(DoubleTappedEvent, OnTapped);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnTapped(object sender, TappedEventArgs e)
|
private void OnTapped(object? sender, TappedEventArgs e)
|
||||||
{
|
{
|
||||||
if (this.VisualRoot is not Window window) return;
|
if (this.VisualRoot is not Window window) return;
|
||||||
if (!window.CanResize) return;
|
if (!window.CanResize) return;
|
||||||
@@ -36,7 +35,7 @@ public class WindowThumb: Control
|
|||||||
window.WindowState = window.WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized;
|
window.WindowState = window.WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPressed(object sender, PointerPressedEventArgs e)
|
private void OnPressed(object? sender, PointerPressedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) return;
|
if (!e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) return;
|
||||||
if (e.ClickCount > 1) return;
|
if (e.ClickCount > 1) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user