初始化上传
This commit is contained in:
50
常用工具集/Base/DelegateCommand.cs
Normal file
50
常用工具集/Base/DelegateCommand.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace 常用工具集.Base
|
||||
{
|
||||
public class DelegateCommand : ICommand
|
||||
{
|
||||
public Action<object> ExecuteCommand = null;
|
||||
public Func<object, bool> CanExecuteCommand = null;
|
||||
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
public DelegateCommand()
|
||||
{
|
||||
}
|
||||
|
||||
public DelegateCommand(Action<object> Command)
|
||||
{
|
||||
ExecuteCommand = Command;
|
||||
}
|
||||
|
||||
public bool CanExecute(object paramter)
|
||||
{
|
||||
if (CanExecuteCommand != null)
|
||||
{
|
||||
return CanExecuteCommand(paramter);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void Execute(object paramter)
|
||||
{
|
||||
if (ExecuteCommand != null)
|
||||
ExecuteCommand(paramter);
|
||||
}
|
||||
|
||||
public void RaiseCanExecuteChanged()
|
||||
{
|
||||
if (CanExecuteChanged != null)
|
||||
CanExecuteChanged(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user