Recovered from decompiled OpenMaui.Controls.Linux.dll: - SkiaShell.cs: FlyoutHeader, FlyoutFooter, scroll support (918 -> 1325 lines) - X11Window.cs: Cursor support (XCreateFontCursor, XDefineCursor) - All handlers with dark mode support - All services with latest implementations - LinuxApplication with theme change handling
35 lines
688 B
C#
35 lines
688 B
C#
using System;
|
|
using System.Windows.Input;
|
|
|
|
namespace Microsoft.Maui.Platform.Linux.Handlers;
|
|
|
|
internal class RelayCommand : ICommand
|
|
{
|
|
private readonly Action _execute;
|
|
|
|
private readonly Func<bool>? _canExecute;
|
|
|
|
public event EventHandler? CanExecuteChanged;
|
|
|
|
public RelayCommand(Action execute, Func<bool>? canExecute = null)
|
|
{
|
|
_execute = execute ?? throw new ArgumentNullException("execute");
|
|
_canExecute = canExecute;
|
|
}
|
|
|
|
public bool CanExecute(object? parameter)
|
|
{
|
|
return _canExecute?.Invoke() ?? true;
|
|
}
|
|
|
|
public void Execute(object? parameter)
|
|
{
|
|
_execute();
|
|
}
|
|
|
|
public void RaiseCanExecuteChanged()
|
|
{
|
|
this.CanExecuteChanged?.Invoke(this, EventArgs.Empty);
|
|
}
|
|
}
|