private SetActiveWindow ( |
||
hwnd | ||
return |
public void Close() { if (!_dispatcher.CheckAccess()) { _dispatcher.Invoke(DispatcherPriority.Normal, (Action)Close); return; } if (_isClosed) { throw new InvalidOperationException("Splash screen was already closed"); } _isClosed = true; if (FadeOutDuration <= TimeSpan.Zero) { _DestroyResources(); return; } try { NativeMethods.SetActiveWindow(_hwndWrapper.Handle); } catch { // SetActiveWindow fails if the application is not in the foreground. // If this is the case, don't bother animating the fade out. _DestroyResources(); return; } _fadeOutEnd = DateTime.UtcNow + FadeOutDuration; if (_dt != null) { _dt.Stop(); } _dt = new DispatcherTimer(TimeSpan.FromMilliseconds(30), DispatcherPriority.Normal, _FadeOutTick, _dispatcher); _dt.Start(); return; }