void ISplashScreenService.ShowSplashScreen(string documentType) { if (SplashScreenType != null && (!string.IsNullOrEmpty(documentType) || ViewTemplate != null || ViewLocator != null)) { throw new InvalidOperationException(DXSplashScreenExceptions.ServiceException1); } if (IsSplashScreenActive) { return; } Func <object, object> contentCreator = null; object contentCreatorParams = null; IList <object> windowCreatorParams = new List <object>() { SplashScreenWindowStyle, SplashScreenStartupLocation, Owner.With(x => new SplashScreenOwner(x)), SplashScreenClosingMode, FadeInDuration, FadeOutDuration }; if (SplashScreenType == null) { contentCreator = CreateSplashScreen; contentCreatorParams = new object[] { documentType, ViewLocator, ViewTemplate }; } else { DXSplashScreen.CheckSplashScreenType(SplashScreenType); if (typeof(Window).IsAssignableFrom(SplashScreenType)) { windowCreatorParams.Add(SplashScreenType); } else if (typeof(FrameworkElement).IsAssignableFrom(SplashScreenType)) { contentCreator = DXSplashScreen.DefaultSplashScreenContentCreator; contentCreatorParams = SplashScreenType; } } if (UseIndependentWindow) { GetSplashContainer(true).Show(CreateSplashScreenWindow, contentCreator, windowCreatorParams.ToArray(), contentCreatorParams); } else { DXSplashScreen.Show(CreateSplashScreenWindow, contentCreator, windowCreatorParams.ToArray(), contentCreatorParams); } isSplashScreenShown = UseIndependentWindow || DXSplashScreen.IsActive; if (Math.Abs(Progress - SplashScreenViewModel.ProgressDefaultValue) > 0.0001) { OnProgressChanged(); } if (Math.Abs(MaxProgress - SplashScreenViewModel.MaxProgressDefaultValue) > 0.0001) { OnMaxProgressChanged(); } if (!object.Equals(State, SplashScreenViewModel.StateDefaultValue)) { OnStateChanged(); } }
void ISplashScreenService.ShowSplashScreen(string documentType) { if (SplashScreenType != null && (!string.IsNullOrEmpty(documentType) || ViewTemplate != null || ViewLocator != null)) { throw new InvalidOperationException(DXSplashScreenExceptions.ServiceException1); } if (IsSplashScreenActive) { return; } Func <object, object> contentCreator = null; object contentCreatorParams = null; var ssModel = CreateSplashScreenViewModel(); IList <object> windowCreatorParams = new List <object>() { SplashScreenWindowStyle, SplashScreenStartupLocation, Owner.With(x => new SplashScreenOwner(x)), SplashScreenClosingMode, FadeInDuration, FadeOutDuration }; if (SplashScreenType == null) { contentCreator = CreateSplashScreen; contentCreatorParams = new object[] { documentType, ViewLocator, ViewTemplate, ssModel }; } else { DXSplashScreen.CheckSplashScreenType(SplashScreenType); if (typeof(Window).IsAssignableFrom(SplashScreenType)) { windowCreatorParams.Add(SplashScreenType); } else if (typeof(FrameworkElement).IsAssignableFrom(SplashScreenType)) { contentCreator = DXSplashScreen.DefaultSplashScreenContentCreator; contentCreatorParams = new object[] { SplashScreenType, ssModel }; } } isSplashScreenShown = true; if (UseIndependentWindow) { var container = GetSplashContainer(true); container.Closed += OnSplashScreenClosed; container.Show(CreateSplashScreenWindow, contentCreator, windowCreatorParams.ToArray(), contentCreatorParams, null); IsSplashScreenActive = true; } else { DXSplashScreen.Show(CreateSplashScreenWindow, contentCreator, windowCreatorParams.ToArray(), contentCreatorParams); isSplashScreenShown = DXSplashScreen.IsActive; } }