Update MessageBox.cs
This commit is contained in:
1 parent
63acdfca0d
commit
4d72f1f921
1 file changed
+12
@@ -50,6 +50,8 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
private bool _showNo;
|
private bool _showNo;
|
||||||
|
|
||||||
|
private IntPtr _lastActiveWindowIntPtr;
|
||||||
|
|
||||||
public static readonly DependencyProperty MessageProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty MessageProperty = DependencyProperty.Register(
|
||||||
"Message", typeof(string), typeof(MessageBox), new PropertyMetadata(default(string)));
|
"Message", typeof(string), typeof(MessageBox), new PropertyMetadata(default(string)));
|
||||||
|
|
||||||
@@ -127,6 +129,16 @@ namespace HandyControl.Controls
|
|||||||
}
|
}
|
||||||
|
|
||||||
base.OnSourceInitialized(e);
|
base.OnSourceInitialized(e);
|
||||||
|
|
||||||
|
_lastActiveWindowIntPtr = InteropMethods.GetForegroundWindow();
|
||||||
|
Activate();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnClosed(EventArgs e)
|
||||||
|
{
|
||||||
|
InteropMethods.SetForegroundWindow(_lastActiveWindowIntPtr);
|
||||||
|
|
||||||
|
base.OnClosed(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnApplyTemplate()
|
public override void OnApplyTemplate()
|
||||||
|
|||||||
Reference in new issue
Block a user