completed the branch
This commit is contained in:
1 parent
86c58476c6
commit
d25ff966c2
17 files changed
+152
-18
No files matched your search
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace HandyControl.Interactivity
|
||||
{
|
||||
public class CloseWindowCommand : ICommand
|
||||
{
|
||||
public bool CanExecute(object parameter) => true;
|
||||
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
if (parameter is DependencyObject dependencyObject)
|
||||
{
|
||||
if (Window.GetWindow(dependencyObject) is Window window)
|
||||
{
|
||||
window.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler CanExecuteChanged;
|
||||
}
|
||||
}
|
||||
@@ -156,5 +156,10 @@ namespace HandyControl.Interactivity
|
||||
/// 前置主窗口
|
||||
/// </summary>
|
||||
public static PushMainWindow2TopCommand PushMainWindow2Top { get; } = new PushMainWindow2TopCommand();
|
||||
|
||||
/// <summary>
|
||||
/// 关闭窗口
|
||||
/// </summary>
|
||||
public static CloseWindowCommand CloseWindow { get; } = new CloseWindowCommand();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user