public WindowArranger(SplashScreenOwner parent, SplashScreenLocation childLocation) { if(parent == null) throw new ArgumentNullException("parent"); this.childLocation = childLocation; this.parent = parent; if(parent.IsInitialized) ParentInitializationComplete(); else parent.Initialized += OnParentInitialized; }
public void Release() { if(isDisposed) return; UnsubscribeChildEvents(); UnsubscribeParentEvents(); childWindow = null; childHandle = IntPtr.Zero; parent.Initialized -= OnParentInitialized; parent = null; isDisposed = true; }
public WindowLocker(SplashScreenOwner owner) { this.owner = owner; if(!owner.IsInitialized) owner.Initialized += OnOwnerInitialized; else OnInitialized(); }
public void Release(bool activateWindowIfNeeded) { if(owner == null) return; var window = owner.Window; IntPtr handle = owner.WindowHandle; owner.Initialized -= OnOwnerInitialized; owner = null; if(window == null) return; InvokeOnThread(window.Dispatcher, () => { if(activateWindowIfNeeded && !window.IsActive) window.Activate(); UnlockWindow(handle); }, DispatcherPriority.Render, false); }
void CreateLocker(SplashScreenOwner parentContainer, bool lockWindow) { if(lockWindow) locker = new WindowLocker(parentContainer); }
void CreateArranger(SplashScreenOwner parentContainer, SplashScreenLocation childLocation) { arranger = new WindowArranger(parentContainer, childLocation); arranger.ParentClosed += OnParentWindowClosed; arranger.AttachChild(this); }
public void SplashScreenStartupLocation_Test04() { var owner = new SplashScreenOwner(RealWindow); RealWindow.WindowStartupLocation = WindowStartupLocation.Manual; RealWindow.Left = 200; RealWindow.Width = 300; RealWindow.Top = 100; RealWindow.Height = 240; RealWindow.Show(); DispatcherHelper.DoEvents(); DXSplashScreen.Show(CreateDefaultWindow, CreateDefaultContent, new object[] { owner, WindowStartupLocation.CenterOwner }, null); SplashScreenTestUserControl.DoEvents(); Rect pos = GetSplashScreenBounds(); Assert.AreEqual(new Point(270, 130), pos.TopLeft); CloseDXSplashScreen(); }
public LoadingDecoratorWindow(bool useFadeEffect, SplashScreenOwner parentContainer, SplashScreenLocation childLocation, bool lockParent) { WindowStyle = WindowStyle.None; AllowsTransparency = true; ShowInTaskbar = false; Background = new SolidColorBrush(Colors.Transparent); SizeToContent = SizeToContent.WidthAndHeight; WindowStartupLocation = WindowStartupLocation.Manual; Left = parentContainer.ControlStartupPosition.Left; Top = parentContainer.ControlStartupPosition.Top; Width = parentContainer.ControlStartupPosition.Width; Height = parentContainer.ControlStartupPosition.Height; Topmost = false; ShowActivated = false; IsHitTestVisible = false; Focusable = false; CreateArranger(parentContainer, childLocation); CreateLocker(parentContainer, lockParent); WindowFadeAnimationBehavior.SetEnableAnimation(this, useFadeEffect); Loaded += OnWindowLoaded; }
public void SplashScreenStartupLocation_Test00() { var owner = new SplashScreenOwner(RealWindow); RealWindow.WindowStartupLocation = WindowStartupLocation.Manual; RealWindow.Left = 200; RealWindow.Width = 300; RealWindow.Top = 100; RealWindow.Height = 240; RealWindow.Show(); DispatcherHelper.DoEvents(); SplashScreenTestUserControl.TemplateCreator = SplashScreenTestsHelper.CreateControlTemplate; DXSplashScreen.Show<SplashScreenTestUserControl>(WindowStartupLocation.CenterOwner, owner); SplashScreenTestUserControl.DoEvents(); Rect pos = GetSplashScreenBounds(); Assert.AreEqual(new Point(290, 150), pos.TopLeft); CloseDXSplashScreen(); }
public void NotShowIfOwnerClosedTest01_T268403() { RealWindow.Show(); RealWindow.Close(); DispatcherHelper.DoEvents(); var owner = new SplashScreenOwner(RealWindow); if(DXSplashScreen.SplashContainer != null) DXSplashScreen.SplashContainer.Test_SkipWindowOpen = true; DXSplashScreen.Show(CreateDefaultWindow, CreateDefaultContent, new object[] { owner, SplashScreenClosingMode.ManualOnly }, null); EnqueueDelay(100); DispatcherHelper.DoEvents(); var info = DXSplashScreen.SplashContainer.ActiveInfo; Assert.IsNotNull(info.InternalThread); Assert.IsFalse(info.RelationInfo.IsInitialized, "relation"); Assert.IsTrue(DXSplashScreen.IsActive); Assert.IsFalse(DXSplashScreen.SplashContainer.Test_SkipWindowOpen, "skipOpen"); CloseDXSplashScreen(); }
public void NotShowIfOwnerClosedTest00_T268403() { RealWindow.Show(); DispatcherHelper.DoEvents(); var owner = new SplashScreenOwner(RealWindow); RealWindow.Close(); if(DXSplashScreen.SplashContainer != null) DXSplashScreen.SplashContainer.Test_SkipWindowOpen = false; DXSplashScreen.Show(CreateDefaultWindow, CreateDefaultContent, new object[] { owner }, null); var info = DXSplashScreen.SplashContainer.ActiveInfo; EnqueueWait(() => info.InternalThread == null); Assert.IsFalse(DXSplashScreen.IsActive); Assert.IsTrue(DXSplashScreen.SplashContainer.Test_SkipWindowOpen); CloseDXSplashScreen(); }
public void SplashScreenOwner_Test02() { var owner = new SplashScreenOwner(new Border()); DXSplashScreen.Show(CreateDefaultWindow, CreateDefaultContent, new object[] { owner }, null); var info = DXSplashScreen.SplashContainer.ActiveInfo; Assert.AreEqual(owner.Owner, info.Owner.WindowObject); Assert.IsNotNull(info.InternalThread); Assert.IsFalse(info.Owner.IsInitialized); CloseDXSplashScreen(); }
public void SplashScreenOwner_Test00() { var owner = new SplashScreenOwner(new Border()); DXSplashScreen.Show<SplashScreenTestUserControl>(WindowStartupLocation.CenterScreen, owner); var info = DXSplashScreen.SplashContainer.ActiveInfo; Assert.AreEqual(owner.Owner, info.Owner.WindowObject); Assert.IsNotNull(info.InternalThread); Assert.IsFalse(info.Owner.IsInitialized); CloseDXSplashScreen(); }