コード例 #1
0
        /// <summary>
        /// Performs forward navigation from the <paramref name="sourceView"/> to the <paramref name="targetView"/> with receiving a result when it finished.
        /// </summary>
        /// <typeparam name="TTargetView">The type of the target view.</typeparam>
        /// <typeparam name="TResult">The type of the target view model result.</typeparam>
        /// <param name="sourceView">The source view from which navigation is performed from.</param>
        /// <param name="targetView">The target view for navigation.</param>
        /// <param name="animated">Determines if the transition is to be animated.</param>
        /// <param name="navigationStrategy">
        ///     The strategy used for performing navigation.
        ///     Default is <see cref="ForwardNavigationStrategy.PresentViewController(Action)"/> if <paramref name="targetView"/> is <see cref="UINavigationController"/> or
        ///     <see cref="ForwardNavigationStrategy.PushViewController()"/> if <paramref name="targetView"/> is <see cref="UIViewController"/>.
        /// </param>
        /// <exception cref="ArgumentNullException">
        ///     <para><paramref name="sourceView"/> or <paramref name="targetView"/> is <c>null</c>.</para>
        ///     <para>-or-</para>
        ///     <para><see cref="UINavigationController"/> returned by <paramref name="sourceView"/> is <c>null</c>.</para>
        /// </exception>
        public void NavigateForResult <TTargetView, TResult>(
            [NotNull] INavigationView <IViewModelWithResultHandler> sourceView,
            [NotNull] TTargetView targetView,
            bool animated,
            [CanBeNull] ForwardNavigationDelegate navigationStrategy = null)
            where TTargetView : UIViewController, INavigationView <IViewModelWithResult <TResult> >
            where TResult : Result
        {
            if (sourceView == null)
            {
                throw new ArgumentNullException(nameof(sourceView));
            }
            if (targetView == null)
            {
                throw new ArgumentNullException(nameof(targetView));
            }

            var navigationController = sourceView.GetNavigationController();

            if (navigationController == null)
            {
                throw new ArgumentNullException("View's navigation controller is 'null'.", nameof(sourceView));
            }

            targetView.ResultSetWeakSubscribe(sourceView.HandleResult);
            (navigationStrategy ?? GetForwardNavigationStrategy(targetView)).Invoke(navigationController, targetView, animated);
        }
コード例 #2
0
        public NavigationPresenter(INavigationView view,
            ISettingsSerializer settingsSerializer,
            IKeyboardListener keyboardListener,
            IMatchModelMapper matchModelMapper,
            IPresentationService presentationService,
            INavigationServiceBuilder navigationServiceBuilder)
        {
            _view = view;
            _settingsSerializer = settingsSerializer;
            _keyboardListener = keyboardListener;
            _matchModelMapper = matchModelMapper;
            _navigationServiceBuilder = navigationServiceBuilder;
            _presentationService = presentationService;

            Settings settings = _settingsSerializer.Deserialize();

            _keyboardListener.KeyCombinationPressed += GlobalKeyCombinationPressed;
            _keyboardListener.StartListening(settings.GlobalKeyCombination);

            _view.CurrentSettings = settings;
            _view.ShowMatches(new List<MatchModel> {new MatchModel(_matchModelMapper, Resources.InitialMatchesMessage)});
            _view.ShowInitializingScreen = true;

            //Initialize navigation service asynchronously, as it may require a long operation (file system parsing).
            //Clone settings to avoid any coupling
            Settings settingsCopy = settings.Clone() as Settings;
            InitializeDelegate initialize = Initialize;
            initialize.BeginInvoke(settingsCopy, EndInitialize, initialize);
        }
コード例 #3
0
        /// <summary>
        /// Performs forward navigation from the <paramref name="sourceView"/> to the target one with provided <paramref name="parameters"/> and receiving a result when it finished.
        /// </summary>
        /// <typeparam name="TTargetView">The type of the target view.</typeparam>
        /// <typeparam name="TParameters">The type of the target view model parameters.</typeparam>
        /// <typeparam name="TResult">The type of the target view model result.</typeparam>
        /// <param name="sourceView">The source view from which navigation is performed from.</param>
        /// <param name="parameters">The target view model parameters.</param>
        /// <param name="navigationStrategy">The strategy used for performing navigation. Default is <see cref="ForwardNavigationStrategy.StartActivityForResult(Android.OS.Bundle)"/>.</param>
        /// <exception cref="ArgumentNullException">
        ///     <para><paramref name="sourceView"/> is <c>null</c>.</para>
        ///     <para>-or-</para>
        ///     <para><see cref="Android.Support.V4.App.FragmentActivity"/> returned by <paramref name="sourceView"/> is <c>null</c>.</para>
        /// </exception>
        public void NavigateForResult <TTargetView, TParameters, TResult>(
            INavigationView <IViewModelWithResultHandler> sourceView,
            TParameters?parameters,
            ForwardNavigationDelegate?navigationStrategy = null)
            where TTargetView : Android.Support.V4.App.FragmentActivity, IView <IViewModelWithParameters <TParameters> >, INavigationView <IViewModelWithResult <TResult> >
            where TParameters : Parameters
            where TResult : Result
        {
            if (sourceView == null)
            {
                throw new ArgumentNullException(nameof(sourceView));
            }

            var context = sourceView.GetActivity();

            if (context == null)
            {
                throw new ArgumentNullException("View's activity is 'null'.", nameof(sourceView));
            }

            var intent = new Intent(context, typeof(TTargetView));

            intent.PutParameters(parameters);
            var requestCode = sourceView.RequestCode.GetFor <DefaultResultMapper <TResult> >();

            (navigationStrategy ?? NavigationStrategy.Forward.StartActivityForResult()).Invoke(sourceView, intent, requestCode);
        }
コード例 #4
0
        Task CreateNavigationViewHandlerAsync(INavigationView navigationView, Func <NavigationViewHandler, Task> action)
        {
            return(InvokeOnMainThreadAsync(async() =>
            {
                FrameworkElement frameworkElement = null;
                var content = (Panel)DefaultWindow.Content;
                try
                {
                    var mauiContext = MauiContext.MakeScoped(true);
                    var handler = CreateHandler(navigationView, mauiContext);
                    frameworkElement = handler.NativeView;
                    content.Children.Add(frameworkElement);
                    if (navigationView is NavigationViewStub nvs && nvs.NavigationStack?.Count > 0)
                    {
                        navigationView.RequestNavigation(new NavigationRequest(nvs.NavigationStack, false));
                        await nvs.OnNavigationFinished;
                    }

                    await action(handler);
                }
                finally
                {
                    if (frameworkElement != null)
                    {
                        content.Children.Remove(frameworkElement);
                    }
                }
            }));
        }
コード例 #5
0
        /// <summary>
        /// Performs forward navigation from the <paramref name="sourceView"/> to the target one with the provided lifecycle-aware view model <paramref name="parameters"/>
        /// and handling a lifecycle-aware view model result when it finished.
        /// </summary>
        /// <typeparam name="TTargetView">The type of the target view.</typeparam>
        /// <typeparam name="TParameters">The type of the target view model parameters.</typeparam>
        /// <typeparam name="TResult">The type of the target view model result.</typeparam>
        /// <param name="sourceView">The source navigation view from which navigation is performed from.</param>
        /// <param name="parameters">The target view model parameters. Can be <see langword="null"/>.</param>
        /// <param name="navigationStrategy">
        /// The strategy used for performing navigation. Can be <see langword="null"/>.
        /// <para>The default is <see cref="ForwardNavigationStrategy.StartActivityForResult(Bundle?)"/>.</para>
        /// </param>
        /// <exception cref="ArgumentNullException"><paramref name="sourceView"/> is <see langword="null"/>.</exception>
        /// <exception cref="ArgumentException">
        /// The <paramref name="sourceView" /> is derived from a class other than the <see cref="FragmentActivity"/> or <see cref="Fragment"/>.
        /// </exception>
        /// <exception cref="InvalidOperationException">
        /// <see cref="NavigationViewExtensions.GetActivity(INavigationView{ILifecycleViewModel})"/> returned <see langword="null"/> value for the provided <paramref name="sourceView"/>.
        /// </exception>
        public void NavigateForResult <TTargetView, TParameters, TResult>(
            INavigationView <ILifecycleViewModelWithResultHandler> sourceView,
            TParameters?parameters,
            ForwardNavigationDelegate?navigationStrategy = null)
            where TTargetView : FragmentActivity, INavigationView <ILifecycleViewModelWithParameters <TParameters> >, INavigationView <ILifecycleViewModelWithResult <TResult> >
            where TParameters : Parameters
            where TResult : Result
        {
            if (sourceView == null)
            {
                throw new ArgumentNullException(nameof(sourceView));
            }

            var context = sourceView.GetActivity();

            if (context == null)
            {
                throw new InvalidOperationException(
                          $"'{TypeFormatter.FormatName(sourceView.GetType())}.{nameof(NavigationViewExtensions.GetActivity)}' returned 'null' value.");
            }

            var targetViewIntent = new Intent(context, typeof(TTargetView));

            targetViewIntent.PutParameters(parameters);
            var requestCode = sourceView.RequestCode.GetFor <DefaultResultMapper <TResult> >();

            (navigationStrategy ?? NavigationStrategy.Forward.StartActivityForResult()).Invoke(sourceView, targetViewIntent, requestCode);
        }
コード例 #6
0
        public ApplicationWindow(INavigationView navigationView, IDealView dealView, IProjectView projectView, ICatalogView catalogView, IErrorLogView errorLogView)
            : this()
        {
            this.LeftPanel.Children.Add(navigationView as UserControl);
            (navigationView as UserControl).Margin = new Thickness(0, 0, 0, 0);
            (navigationView as UserControl).BorderBrush = Brushes.LightGray;
            (navigationView as UserControl).BorderThickness = new Thickness(0, 0, 0, 0);

            this.CenterPanel.Children.Add(dealView as UserControl);
            (dealView as UserControl).Margin = new Thickness(0, 0, 0, 0);
            (dealView as UserControl).BorderThickness = new Thickness(0, 0, 0, 0);
            dealView.HideView();

            this.CenterPanel.Children.Add(projectView as UserControl);
            (projectView as UserControl).Margin = new Thickness(0, 0, 0, 0);
            (projectView as UserControl).BorderThickness = new Thickness(0, 0, 0, 0);
            projectView.HideView();

            this.CenterPanel.Children.Add(catalogView as UserControl);
            (catalogView as UserControl).Margin = new Thickness(0, 0, 0, 0);
            (catalogView as UserControl).BorderThickness = new Thickness(0, 0, 0, 0);
            catalogView.HideView();

            this.FooterPanel.Children.Add(errorLogView as UserControl);
            (errorLogView as UserControl).Margin = new Thickness(0, 0, 0, 0);
            (errorLogView as UserControl).BorderThickness = new Thickness(0, 0, 0, 0);
        }
コード例 #7
0
        public NavigationPresenter(INavigationView view,
                                   ISettingsSerializer settingsSerializer,
                                   IKeyboardListener keyboardListener,
                                   IMatchModelMapper matchModelMapper,
                                   IPresentationService presentationService,
                                   INavigationServiceBuilder navigationServiceBuilder)
        {
            _view = view;
            _settingsSerializer       = settingsSerializer;
            _keyboardListener         = keyboardListener;
            _matchModelMapper         = matchModelMapper;
            _navigationServiceBuilder = navigationServiceBuilder;
            _presentationService      = presentationService;

            Settings settings = _settingsSerializer.Deserialize();

            _keyboardListener.KeyCombinationPressed += GlobalKeyCombinationPressed;
            _keyboardListener.StartListening(settings.GlobalKeyCombination);

            _view.CurrentSettings = settings;
            _view.ShowMatches(new List <MatchModel> {
                new MatchModel(_matchModelMapper, Resources.InitialMatchesMessage)
            });
            _view.ShowInitializingScreen = true;

            //Initialize navigation service asynchronously, as it may require a long operation (file system parsing).
            //Clone settings to avoid any coupling
            Settings           settingsCopy = settings.Clone() as Settings;
            InitializeDelegate initialize   = Initialize;

            initialize.BeginInvoke(settingsCopy, EndInitialize, initialize);
        }
コード例 #8
0
        /// <summary>
        /// Performs forward navigation from the <paramref name="sourceView"/> to the <paramref name="targetView"/>.
        /// </summary>
        /// <typeparam name="TTargetView">The type of the target view.</typeparam>
        /// <param name="sourceView">The source view from which navigation is performed from.</param>
        /// <param name="targetView">The target view for navigation.</param>
        /// <param name="animated">Determines if the transition is to be animated.</param>
        /// <param name="navigationStrategy">
        ///     The strategy used for performing navigation.
        ///     Default is <see cref="ForwardNavigationStrategy.PresentViewController(Action)"/> if <paramref name="targetView"/> is <see cref="UINavigationController"/> or
        ///     <see cref="ForwardNavigationStrategy.PushViewController()"/> if <paramref name="targetView"/> is <see cref="UIViewController"/>.
        /// </param>
        /// <exception cref="ArgumentNullException">
        ///     <para><paramref name="sourceView"/> or <paramref name="targetView"/> is <c>null</c>.</para>
        ///     <para>-or-</para>
        ///     <para><see cref="UINavigationController"/> returned by <paramref name="sourceView"/> is <c>null</c>.</para>
        /// </exception>
        public void Navigate <TTargetView>(
            [NotNull] INavigationView <IViewModel> sourceView,
            [NotNull] TTargetView targetView,
            bool animated,
            [CanBeNull] ForwardNavigationDelegate navigationStrategy = null)
            where TTargetView : UIViewController
        {
            if (sourceView == null)
            {
                throw new ArgumentNullException(nameof(sourceView));
            }
            if (targetView == null)
            {
                throw new ArgumentNullException(nameof(targetView));
            }

            var navigationController = sourceView.GetNavigationController();

            if (navigationController == null)
            {
                throw new ArgumentNullException("View's navigation controller is 'null'.", nameof(sourceView));
            }

            (navigationStrategy ?? GetForwardNavigationStrategy(targetView)).Invoke(navigationController, targetView, animated);
        }
コード例 #9
0
ファイル: ThemeManager.cs プロジェクト: zhamppx97/maui
 public static double GetFlyoutMargin(this INavigationView nav)
 {
     if (s_navigationViewFlyoutMargin > 0)
     {
         return(s_navigationViewFlyoutMargin);
     }
     return(s_navigationViewFlyoutMargin = CalculateDoubleScaledSizeInLargeScreen(10));
 }
コード例 #10
0
ファイル: ThemeManager.cs プロジェクト: zhamppx97/maui
 public static double GetFlyoutItemHeight(this INavigationView nav)
 {
     if (s_navigationViewFlyoutItemHeight > 0)
     {
         return(s_navigationViewFlyoutItemHeight);
     }
     return(s_navigationViewFlyoutItemHeight = CalculateDoubleScaledSizeInLargeScreen(60));
 }
コード例 #11
0
ファイル: ThemeManager.cs プロジェクト: zhamppx97/maui
 public static double GetFlyoutItemWidth(this INavigationView nav)
 {
     if (s_navigationViewFlyoutItemWidth > 0)
     {
         return(s_navigationViewFlyoutItemWidth);
     }
     return(s_navigationViewFlyoutItemWidth = CalculateDoubleScaledSizeInLargeScreen(200));
 }
コード例 #12
0
ファイル: ThemeManager.cs プロジェクト: zhamppx97/maui
 public static double GetFlyoutIconSize(this INavigationView nav)
 {
     if (s_navigationViewFlyoutIconSize > 0)
     {
         return(s_navigationViewFlyoutIconSize);
     }
     return(s_navigationViewFlyoutIconSize = CalculateDoubleScaledSizeInLargeScreen(25));
 }
コード例 #13
0
        NavigationController(INavigationView view, IMessageQueue queue, ClientPerspective perspective)
        {
            _view = view;
            _view.WhenInboxSelected(HandleInboxSelected);
            _view.WhenProjectSelected(HandleProjectSelected);
            _queue = queue;
            _perspective = perspective;

        }
コード例 #14
0
        /// <summary>
        /// Gets an existing <see cref="INavigationView{TViewModel}"/> instance by <paramref name="viewModel"/>.
        /// </summary>
        /// <param name="viewModel">The view model that is used to get its view.</param>
        /// <param name="view">The navigation view corresponding to the provided model.</param>
        /// <returns><see langword="true"/> if the view still exists and has not yet been garbage collected or disposed; otherwise, <see langword="false"/>.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="viewModel"/> is <see langword="null"/>.</exception>
        public static bool TryGetView(ILifecycleViewModel viewModel, [MaybeNullWhen(returnValue: false)] out INavigationView <ILifecycleViewModel> view)
        {
            if (viewModel == null)
            {
                throw new ArgumentNullException(nameof(viewModel));
            }

            return(ViewRegistry.TryGetView(viewModel, out view));
        }
コード例 #15
0
        protected override void HideInternal(INavigationView view)
        {
            if (view == CurrentScreen.Value)
            {
                PreviousScreen  = curScreen.Value;
                curScreen.Value = null;
            }

            base.HideInternal(view);
        }
コード例 #16
0
        public IAnime GetSubMenuOverlayHide(INavigationView overlay)
        {
            var anime = new Anime();

            anime.AnimateFloat(alpha => overlay.Alpha = alpha)
            .AddTime(0f, 1f, EaseType.CubicEaseOut)
            .AddTime(0.25f, 0f)
            .Build();
            return(anime);
        }
コード例 #17
0
        public IAnime GetDefaultOverlayHide(INavigationView overlay)
        {
            IAnime anime = new Anime();

            anime.AnimateFloat((alpha) => overlay.Alpha = alpha)
            .AddTime(0f, 1f, EaseType.QuadEaseOut)
            .AddTime(0.35f, 0f)
            .Build();
            return(anime);
        }
コード例 #18
0
        /// <summary>
        /// Performs backward navigation from the <paramref name="sourceView"/>.
        /// </summary>
        /// <param name="sourceView">The source view from which navigation is performed from.</param>
        /// <param name="navigationStrategy">The strategy used for performing navigation. Default is <see cref="BackwardNavigationStrategy.Finish()"/>.</param>
        /// <exception cref="ArgumentNullException"><paramref name="sourceView"/> is <c>null</c>.</exception>
        public void NavigateBack(
            [NotNull] INavigationView <IViewModel> sourceView,
            [CanBeNull] BackwardNavigationDelegate navigationStrategy = null)
        {
            if (sourceView == null)
            {
                throw new ArgumentNullException(nameof(sourceView));
            }

            (navigationStrategy ?? NavigationStrategy.Backward.Finish()).Invoke(sourceView);
        }
コード例 #19
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        public NavigationController(INavigationView _view, EventHandler <NavigationArgs> _handle, NavigationSettings _settings)
        {
            // Get control of the navigation view supplied
            view = _view;

            // allow the navigation view to view the navigation setting
            (view as NavigationView).AttachSettings(_settings);

            // Attach the method handle from the main form to the views event listenr
            view.NavigationClick += _handle;
        }
コード例 #20
0
        /// <summary>
        /// Returns self if <paramref name="view"/> is <see cref="FragmentActivity"/> or
        /// <see cref="Fragment.Activity"/> property value if <paramref name="view"/> is <see cref="Fragment"/>.
        /// </summary>
        /// <param name="view">The navigation view.</param>
        /// <returns>The activity instance. Can be <see langword="null"/>.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="view"/> is <see langword="null"/>.</exception>
        /// <exception cref="ArgumentException">
        /// The <paramref name="view" /> is derived from a class other than the <see cref="FragmentActivity"/> or <see cref="Fragment"/>.
        /// </exception>
        public static FragmentActivity?GetActivity(this INavigationView <ILifecycleViewModel> view)
        {
            if (view == null)
            {
                throw new ArgumentNullException(nameof(view));
            }

            return(view.As(
                       activity => activity,
                       fragment => fragment.Activity));
        }
コード例 #21
0
 /// <summary>
 /// Event called when the specified overlay has been hidden.
 /// </summary>
 private void OnOverlayHide(INavigationView view)
 {
     if (view is MenuBarOverlay)
     {
         isMenuBarActive.Value = false;
     }
     if (view is NotificationMenuOverlay)
     {
         isNotificationOverlayActive.Value = false;
     }
 }
コード例 #22
0
 /// <summary>
 /// Event called on current screen change.
 /// </summary>
 private void OnScreenChange(INavigationView screen)
 {
     if (screen is DownloadScreen)
     {
         bgType.Value = BackgroundType.Empty;
     }
     else
     {
         bgType.Value = BackgroundType.Image;
     }
 }
コード例 #23
0
 /// <summary>
 /// Event called when the specified overlay has been shown.
 /// </summary>
 private void OnOverlayShow(INavigationView view)
 {
     if (view is MenuBarOverlay)
     {
         isMenuBarActive.Value = true;
     }
     if (view is NotificationMenuOverlay)
     {
         isNotificationOverlayActive.Value = true;
     }
 }
コード例 #24
0
        /// <summary>
        /// Returns self if <paramref name="view"/> is <see cref="UINavigationController"/> or
        /// <see cref="UIViewController.NavigationController"/> property value if <paramref name="view"/> is <see cref="UIViewController"/>.
        /// </summary>
        /// <param name="view">The navigation view.</param>
        /// <returns>The view controller instance. Can be <see langword="null"/>.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="view"/> is <see langword="null"/>.</exception>
        /// <exception cref="ArgumentException">
        /// The <paramref name="view" /> is derived from a class other than the <see cref="UIViewController"/>.
        /// </exception>
        public static UINavigationController?GetNavigationController(this INavigationView <ILifecycleViewModel> view)
        {
            if (view == null)
            {
                throw new ArgumentNullException(nameof(view));
            }

            return(view.As(
                       viewController => viewController.NavigationController,
                       navigationController => navigationController));
        }
コード例 #25
0
        /// <summary>
        /// Performs backward navigation from the <paramref name="sourceView"/>.
        /// </summary>
        /// <param name="sourceView">The source navigation view from which navigation is performed from.</param>
        /// <param name="navigationStrategy">
        /// The strategy used for performing navigation. Can be <see langword="null"/>.
        /// <para>The default is <see cref="BackwardNavigationStrategy.Finish()"/>.</para>
        /// </param>
        /// <exception cref="ArgumentNullException"><paramref name="sourceView"/> is <see langword="null"/>.</exception>
        public void NavigateBack(
            INavigationView <ILifecycleViewModel> sourceView,
            BackwardNavigationDelegate?navigationStrategy = null)
        {
            if (sourceView == null)
            {
                throw new ArgumentNullException(nameof(sourceView));
            }

            (navigationStrategy ?? NavigationStrategy.Backward.Finish()).Invoke(sourceView);
        }
コード例 #26
0
ファイル: NavigationService.cs プロジェクト: vmtvv/FlexiMvvm
        /// <summary>
        /// Performs backward navigation from the <paramref name="sourceView"/>.
        /// </summary>
        /// <param name="sourceView">The source navigation view from which navigation is performed from.</param>
        /// <param name="animated">Determines if the transition is to be animated.</param>
        /// <param name="navigationStrategy">
        /// The strategy used for performing navigation. Can be <see langword="null"/>.
        /// <para>The default is <see cref="BackwardNavigationStrategy.DismissViewController(Action?)"/> if <paramref name="sourceView"/> is presented or
        /// <see cref="BackwardNavigationStrategy.PopViewController()"/> if <paramref name="sourceView"/> is pushed.</para>
        /// </param>
        /// <exception cref="ArgumentNullException"><paramref name="sourceView"/> is <see langword="null"/>.</exception>
        public void NavigateBack(
            INavigationView <ILifecycleViewModel> sourceView,
            bool animated,
            BackwardNavigationDelegate?navigationStrategy = null)
        {
            if (sourceView == null)
            {
                throw new ArgumentNullException(nameof(sourceView));
            }

            (navigationStrategy ?? GetBackwardNavigationStrategy(sourceView)).Invoke(sourceView, animated);
        }
コード例 #27
0
 public NavigationController(
     IEventBroker eventBroker,
     ICatalogRepository catalogRepository,
     IDealRepository dealRepository,
     IProjectRepository projectRepository,
     INavigationView navigationView)
 {
     this.eventBroker = eventBroker;
     this.catalogRepository = catalogRepository;
     this.dealRepository = dealRepository;
     this.projectRepository = projectRepository;
     this.navigationView = navigationView;
 }
コード例 #28
0
        /// <summary>
        /// Performs backward navigation from the <paramref name="sourceView"/>.
        /// </summary>
        /// <param name="sourceView">The <see cref="INavigationView{TViewModel}"/> from which navigation is performed from.</param>
        /// <param name="animated">Determines if the transition is to be animated.</param>
        /// <param name="viewControllerNavigationStrategy">
        /// The strategy used for performing navigation. Can be <see langword="null"/>.
        /// <para>The default is <see cref="ViewControllerBackwardNavigationStrategy.DismissViewController(Action?)"/> if <paramref name="sourceView"/> is presented or
        /// <see cref="ViewControllerBackwardNavigationStrategy.PopViewController()"/> if <paramref name="sourceView"/> is pushed.</para>
        /// </param>
        /// <exception cref="ArgumentNullException"><paramref name="sourceView"/> is <see langword="null"/>.</exception>
        /// <exception cref="ArgumentException">
        /// The <paramref name="sourceView" /> is derived from a class other than the <see cref="UIViewController"/>.
        /// </exception>
        public void NavigateBack(
            INavigationView <ILifecycleViewModel> sourceView,
            bool animated,
            ViewControllerBackwardNavigationDelegate?viewControllerNavigationStrategy = null)
        {
            if (sourceView == null)
            {
                throw new ArgumentNullException(nameof(sourceView));
            }

            sourceView.As(
                viewController => (viewControllerNavigationStrategy ?? GetViewControllerBackwardNavigationStrategy(viewController)).Invoke(viewController, animated));
        }
コード例 #29
0
        /// <summary>
        /// This constructor initialises the dependent Navigation view, and maintains references to
        /// the main Application Presenter and the Main Application state (which holds a needed reference
        /// to the current book).
        /// </summary>
        /// <param name="view"></param>
        /// <param name="mainPresenter"></param>
        /// <param name="mainState"></param>
        public NavigationPresenter(INavigationView view, ApplicationPresenter mainPresenter, ApplicationState mainState)
        {
            View = view;

            View.IndicateSearchResultsChanged += IndicateSearchResultsChanged;
            View.PlayerView.SectionChanged += PlayerView_SectionChanged;
            View.ApplicationView.BookChanged += ApplicationView_BookChanged;
            View.ApplicationView.NavigationViewFocusChanged += ApplicationView_NavigationViewFocusChanged;

            //view.SelfVoicingSpeakText += view_SelfVoicingSpeakText;

            _mainPresenter = mainPresenter;
            base.MainState = mainState;
        }
コード例 #30
0
        protected override void OnElementChanged(ElementChangedEventArgs <Shell> e)
        {
            if (_native == null)
            {
                _native                = CreateNavigationDrawer();
                _navigationView        = CreateNavigationView();
                _native.NavigationView = _navigationView as ElmSharp.EvasObject;
                _native.Toggled       += OnFlyoutIsPresentedChanged;
                SetNativeView(_native as ElmSharp.EvasObject);

                InitializeFlyout();
            }
            base.OnElementChanged(e);
        }
コード例 #31
0
        public IAnime GetDefaultScreenHide(INavigationView screen)
        {
            IAnime anime = new Anime();

            anime.AnimateVector3((scale) => screen.Scale = scale)
            .AddTime(0f, Vector3.one, EaseType.QuartEaseOut)
            .AddTime(0.35f, new Vector3(3f, 3f, 1f))
            .Build();
            anime.AnimateFloat((alpha) => screen.Alpha = alpha)
            .AddTime(0f, 1f, EaseType.CubicEaseOut)
            .AddTime(0.35f, 0f)
            .Build();
            return(anime);
        }
コード例 #32
0
        protected override void OnElementChanged(ElementChangedEventArgs <Shell> e)
        {
            if (_drawer == null)
            {
                _drawer                = CreateNavigationDrawer();
                _navigationView        = CreateNavigationView();
                _drawer.NavigationView = _navigationView.NativeView;
                _drawer.Toggled       += OnFlyoutIsPresentedChanged;
                SetNativeView(_drawer.TargetView);

                InitializeFlyout();
            }
            base.OnElementChanged(e);
            UpdateFlyoutHeader(false);
        }
コード例 #33
0
        /// <summary>
        /// Performs forward navigation from the <paramref name="sourceView"/> to the target one.
        /// </summary>
        /// <param name="sourceView">The source view from which navigation is performed from.</param>
        /// <param name="targetViewIntent">The description of the target view.</param>
        /// <param name="navigationStrategy">The strategy used for performing navigation. Default is <see cref="ForwardNavigationStrategy.StartActivity(Android.OS.Bundle)"/>.</param>
        /// <exception cref="ArgumentNullException"><paramref name="sourceView"/> or <paramref name="targetViewIntent"/> is <c>null</c>.</exception>
        public void Navigate(
            [NotNull] INavigationView <IViewModel> sourceView,
            [NotNull] Intent targetViewIntent,
            [CanBeNull] ForwardNavigationDelegate navigationStrategy = null)
        {
            if (sourceView == null)
            {
                throw new ArgumentNullException(nameof(sourceView));
            }
            if (targetViewIntent == null)
            {
                throw new ArgumentNullException(nameof(targetViewIntent));
            }

            (navigationStrategy ?? NavigationStrategy.Forward.StartActivity()).Invoke(sourceView, targetViewIntent);
        }
コード例 #34
0
ファイル: NavigationService.cs プロジェクト: vmtvv/FlexiMvvm
        /// <summary>
        /// Performs backward navigation from the <paramref name="sourceView"/> with returning a lifecycle-aware view model result.
        /// </summary>
        /// <typeparam name="TResult">The type of the source view model result.</typeparam>
        /// <param name="sourceView">The source navigation view from which navigation is performed from.</param>
        /// <param name="resultCode">Determines whether the result should be set as successful or canceled.</param>
        /// <param name="result">The source view model result. Can be <see langword="null"/>.</param>
        /// <param name="animated">Determines if the transition is to be animated.</param>
        /// <param name="navigationStrategy">
        /// The strategy used for performing navigation. Can be <see langword="null"/>.
        /// <para>The default is <see cref="BackwardNavigationStrategy.DismissViewController(Action?)"/> if <paramref name="sourceView"/> is presented or
        /// <see cref="BackwardNavigationStrategy.PopViewController()"/> if <paramref name="sourceView"/> is pushed.</para>
        /// </param>
        /// <exception cref="ArgumentNullException"><paramref name="sourceView"/> is <see langword="null"/>.</exception>
        public void NavigateBack <TResult>(
            INavigationView <ILifecycleViewModelWithResult <TResult> > sourceView,
            ResultCode resultCode,
            TResult?result,
            bool animated,
            BackwardNavigationDelegate?navigationStrategy = null)
            where TResult : Result
        {
            if (sourceView == null)
            {
                throw new ArgumentNullException(nameof(sourceView));
            }

            sourceView.SetResult(resultCode, result);
            (navigationStrategy ?? GetBackwardNavigationStrategy(sourceView)).Invoke(sourceView, animated);
        }