1234567891011121314151617181920212223242526272829303132 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Input;
-
- namespace Tcp.Test2
- {
- public class DelegateCommand : ICommand
- {
- private Action _action;
- public DelegateCommand(Action action)
- {
- _action = action;
- }
- public event EventHandler? CanExecuteChanged;
-
- public bool CanExecute(object? parameter)
- {
- return true;
- }
-
- public void Execute(object? parameter)
- {
- if (_action != null)
- {
- _action();
- }
- }
- }
- }
|