Ejemplo n.º 1
0
 public virtual DialogScreenResult Show(
     Window window,
     IScreenFactory <IScreenBase> screen,
     bool modal
     )
 {
     return(WindowLifecycle.Show(
                _aggregator,
                _windowService,
                window,
                screen,
                modal
                ));
 }
Ejemplo n.º 2
0
        /// <remarks>
        ///   Note to inheritors: This method does not call <see
        ///   cref="Show(Window,IScreenFactory{IScreenBase},bool)"/>.
        /// </remarks>
        public virtual void Show(
            IScreenFactory <IScreenBase> screen,
            IScreenBase parent = null,
            string title       = null
            )
        {
            Window ownerWin = GetAssociatedWindow(parent);
            Window window   = _windowService.CreateWindow(ownerWin, title, false);

            WindowLifecycle.Show(
                _aggregator,
                _windowService,
                window,
                screen,
                modal: false
                );
        }
Ejemplo n.º 3
0
        /// <remarks>
        ///   Note to inheritors: This method does not call <see
        ///   cref="Show(Window, IScreenFactory{IScreenBase}, bool)"/>.
        /// </remarks>
        public virtual DialogScreenResult ShowDialog(
            IScreenFactory <IScreenBase> screen,
            IScreenBase parent = null,
            string title       = null
            )
        {
            Window ownerWin = GetAssociatedWindow(parent);
            Window window   = _windowService.CreateWindow(ownerWin, title, true);

            return(WindowLifecycle.Show(
                       _aggregator,
                       _windowService,
                       window,
                       screen,
                       modal: true
                       ));
        }
Ejemplo n.º 4
0
        public Window GetAssociatedWindow(IScreenBase screen)
        {
            if (screen == null)
            {
                return(null);
            }

            WindowLifecycle lf = ScreenTreeHelper
                                 .GetAncestorsOf(screen, includeSelf: true)
                                 .SelectMany(s => s.Children.OfType <WindowLifecycle>())
                                 .FirstOrDefault();

            if (lf != null)
            {
                return(lf.Window);
            }

            throw new ArgumentException(ExceptionTexts.NoAssociatedWindow);
        }
Ejemplo n.º 5
0
        public static DialogScreenResult Show(
            EventAggregator aggregator,
            IWindowService windowService,
            Window window,
            IScreenFactory <IScreenBase> screenFactory,
            bool modal
            )
        {
            var lf = new WindowLifecycle(aggregator, windowService, window);

            if (modal)
            {
                return(lf.ShowModal(screenFactory));
            }
            else
            {
                lf.Show(screenFactory);
                return(null);
            }
        }