void ISplashScreenService.ShowSplashScreen(string documentType)
        {
            if (SplashScreenType != null && (!string.IsNullOrEmpty(documentType) || ViewTemplate != null || ViewLocator != null))
            {
                throw new InvalidOperationException(DXSplashScreenExceptions.ServiceException1);
            }
            if (DXSplashScreen.IsActive)
            {
                return;
            }

            if (SplashScreenType != null)
            {
                DXSplashScreen.Show(SplashScreenType);
            }
            else
            {
                DXSplashScreen.Show(CreateSplashScreenWindow, CreateSplashScreen,
                                    new object[] { SplashScreenWindowStyle, SplashScreenStartupLocation },
                                    new object[] { documentType, ViewLocator, ViewTemplate });
            }
            isSplashScreenShown = 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();
            }
        }
Example #2
0
 Task ISplashScreenService.ShowSplashScreen(string documentType)
 {
     if (SplashScreenType != null)
     {
         if (!string.IsNullOrEmpty(documentType) || ViewTemplate != null || ViewLocator != null)
         {
             throw new InvalidOperationException(DXSplashScreenExceptions.ServiceException1);
         }
         if (typeof(ISplashScreen).IsAssignableFrom(SplashScreenType))
         {
             return(DXSplashScreen.Show(SplashScreenType, UseFadeEffect));
         }
         if (typeof(UIElement).IsAssignableFrom(SplashScreenType))
         {
             SplashScreenViewModel = new SplashScreenViewModel();
             SplashScreen          = (UIElement)Activator.CreateInstance(SplashScreenType);
             SplashScreen.With(x => x as FrameworkElement).Do(x => x.DataContext = SplashScreenViewModel);
             return(DXSplashScreen.Show(SplashScreen, UseFadeEffect));
         }
         return(null);
     }
     SplashScreenViewModel = new SplashScreenViewModel();
     SplashScreen          = (UIElement)CreateAndInitializeView(documentType, SplashScreenViewModel, null, null);
     return(DXSplashScreen.Show(SplashScreen, UseFadeEffect));
 }
Example #3
0
        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();
            }
        }
Example #4
0
        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;
            }
        }