add Recommendation

This commit is contained in:
NaBian committed 2019-05-28 23:47:07 +08:00
1 parent ee4125e2bf
commit cf5f84869d
33 files changed
+320 -141

No files matched your search

@@ -0,0 +1,28 @@
using System;
using System.Windows;
using System.Windows.Input;
using System.Windows.Interop;
using HandyControl.Tools.Interop;
namespace HandyControl.Interactivity
{
public class PushMainWindow2TopCommand : ICommand
{
public bool CanExecute(object parameter) => true;
public void Execute(object parameter)
{
if (Application.Current.MainWindow != null && Application.Current.MainWindow.Visibility != Visibility.Visible)
{
Application.Current.MainWindow.Show();
var hwndSource = (HwndSource)PresentationSource.FromDependencyObject(Application.Current.MainWindow);
if (hwndSource != null)
{
UnsafeNativeMethods.SetForegroundWindow(hwndSource.Handle);
}
}
}
public event EventHandler CanExecuteChanged;
}
}