예제 #1
0
            public void SetState(object state)
            {
                if (ViewModelBase.IsInDesignMode)
                {
                    return;
                }
                if (!DXSplashScreen.IsActive)
                {
                    throw new InvalidOperationException(DXSplashScreenExceptions.ServiceException2);
                }
                Action <object> setStateCore = (p) => {
                    if (SplashScreen is ISplashScreen)
                    {
                        return;
                    }
                    if (SplashScreen.Content is FrameworkElement)
                    {
                        SplashScreenViewModel splashScreenViewModel = ((FrameworkElement)SplashScreen.Content).DataContext as SplashScreenViewModel;
                        if (splashScreenViewModel == null)
                        {
                            return;
                        }
                        splashScreenViewModel.State = p;
                        return;
                    }
                };

                SplashScreen.Dispatcher.BeginInvoke(setStateCore, state);
            }
예제 #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));
 }
예제 #3
0
        static object CreateSplashScreen(object parameter)
        {
            object[]     parameters            = (object[])parameter;
            string       documentType          = parameters[0] as string;
            IViewLocator viewLocator           = parameters[1] as IViewLocator;
            DataTemplate viewTemplate          = parameters[2] as DataTemplate;
            var          SplashScreenViewModel = new SplashScreenViewModel();

            return(ViewHelper.CreateAndInitializeView(viewLocator, documentType, SplashScreenViewModel, null, null, viewTemplate, null));
        }
        public SplashScreenViewModel Clone()
        {
            var result = new SplashScreenViewModel();

            result.allowDisableMarquee = false;
            result.MaxProgress         = MaxProgress;
            result.Progress            = Progress;
            result.State               = State;
            result.IsIndeterminate     = IsIndeterminate;
            result.allowDisableMarquee = true;
            return(result);
        }
예제 #5
0
        static object CreateDefaultSplashScreen(object parameter)
        {
            var    splashScreenType      = SplashScreenHelper.FindParameter <Type>(parameter);
            var    splashScreenViewModel = new SplashScreenViewModel();
            object view = null;

            if (splashScreenType != null)
            {
                view = Activator.CreateInstance(splashScreenType);
                view.With(x => x as FrameworkElement).Do(x => x.DataContext = splashScreenViewModel);
            }
            return(view);
        }
예제 #6
0
        static object CreateDefaultSplashScreen(object parameter)
        {
            object[] parameters       = (object[])parameter;
            Type     splashScreenType = parameters[0] as Type;
            SplashScreenViewModel splashScreenViewModel = new SplashScreenViewModel();
            object view = null;

            if (splashScreenType != null)
            {
                view = Activator.CreateInstance(splashScreenType);
                view.With(x => x as FrameworkElement).Do(x => x.DataContext = splashScreenViewModel);
            }
            return(view);
        }
 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);
 }
예제 #8
0
        SplashScreenViewModel CreateSplashScreenViewModel()
        {
            var result = new SplashScreenViewModel()
            {
                State = State
            };

            if (Math.Abs(Progress - SplashScreenViewModel.ProgressDefaultValue) > 0.0001)
            {
                result.Progress = Progress;
            }
            if (Math.Abs(MaxProgress - SplashScreenViewModel.MaxProgressDefaultValue) > 0.0001)
            {
                result.MaxProgress = MaxProgress;
            }

            return(result);
        }
 static object CreateSplashScreen(object parameter) {
     object[] parameters = (object[])parameter;
     string documentType = parameters[0] as string;
     IViewLocator viewLocator = parameters[1] as IViewLocator;
     DataTemplate viewTemplate = parameters[2] as DataTemplate;
     var SplashScreenViewModel = new SplashScreenViewModel();
     return ViewHelper.CreateAndInitializeView(viewLocator, documentType, SplashScreenViewModel, null, null, viewTemplate, null);
 }
 static object ExitFrame(object f) {
     Window = Window.GetWindow(Instance);
     ViewModel = (SplashScreenViewModel)Instance.DataContext;
     ((DispatcherFrame)f).Continue = false;
     return null;
 }
 static object CreateSplashScreen(object parameter) {
     object[] parameters = (object[])parameter;
     string documentType = parameters[0] as string;
     IViewLocator viewLocator = parameters[1] as IViewLocator;
     DataTemplate viewTemplate = parameters[2] as DataTemplate;
     Type splashScreenType = parameters[3] as Type;
     var SplashScreenViewModel = new SplashScreenViewModel();
     object view = null;
     if(splashScreenType != null) {
         view = Activator.CreateInstance(splashScreenType);
         view.With(x => x as FrameworkElement).Do(x => x.DataContext = SplashScreenViewModel);
     } else
         view = ViewHelper.CreateAndInitializeView(viewLocator, documentType, SplashScreenViewModel, null, null, viewTemplate, null);
     return view;
 }