Beispiel #1
0
        public static void SendNavigateTo(NavigateMode mode, Type page, params object[] par)
        {
            switch (mode)
            {
            case NavigateMode.Main:
                MianNavigateToEvent(page, par);
                break;

            case NavigateMode.Info:
                InfoNavigateToEvent(page, par);
                break;

            case NavigateMode.Play:
                PlayNavigateToEvent(page, par);
                break;

            case NavigateMode.Home:
                HomeNavigateToEvent(page, par);
                break;

            case NavigateMode.Bg:
                BgNavigateToEvent(page, par);
                break;

            default:
                break;
            }
        }
Beispiel #2
0
        NavigationCache FindHistory(NavigateMode mode)
        {
            if (_navigationCaches == null || _navigationCaches.Count == 0)
            {
                return(null);
            }

            switch (mode)
            {
            case NavigateMode.Back:
                if (_selectedPageIndex - 1 < 0)
                {
                    return(null);
                }

                return(_navigationCaches[_selectedPageIndex - 1]);

            case NavigateMode.Forward:
                if (_selectedPageIndex + 1 >= _navigationCaches.Count)
                {
                    return(null);
                }

                return(_navigationCaches[_selectedPageIndex + 1]);

            default:
                return(null);
            }
        }
        private async Task InternalNavigateToAsync(Type viewModelType, object parameter,
                                                   NavigateMode navigateMode = NavigateMode.Relative)
        {
            Page page = CreatePage(viewModelType, parameter);

            //if (page is LoginView)
            //{
            //    Application.Current.MainPage = new CustomNavigationView(page);
            //}
            //else
            //{
            if (navigateMode == NavigateMode.Relative)
            {
                var navigationPage = Application.Current.MainPage as NaviPage;
                if (navigationPage != null)
                {
                    await navigationPage.PushAsync(page);
                }
                else
                {
                    Application.Current.MainPage = new NaviPage(page);
                }
            }
            else
            {
                Application.Current.MainPage = page;
            }
            //}

            await(page.BindingContext as ViewModelBase).InitializeAsync(parameter);
        }
Beispiel #4
0
 public NavigateInfo(Type pageType, object pageArg = null, NavigateMode mode = NavigateMode.Default, object navigateParam = null)
 {
     PageType      = pageType;
     PageArg       = pageArg;
     Mode          = mode;
     NavigateParam = navigateParam;
 }
Beispiel #5
0
 /// <summary>
 ///     Inactive with DVD menu.
 /// </summary>
 /// <param name="mode"></param>
 public void Navigate(NavigateMode mode)
 {
     if (VlcMediaPlayer != null)
     {
         VlcMediaPlayer.Navigate(mode);
     }
 }
        private async Task InternalNavigateToAsync(Type viewModelType, object parameter,
                                                   NavigateMode navigateMode = NavigateMode.Relative)
        {
            Page page = CreatePage(viewModelType, parameter);

            //if (page is LoginView)
            //{
            //    Application.Current.MainPage = new CustomNavigationView(page);
            //}
            //else
            //{
            var retriveNavigationPage             = GetNavigationPageDelegate();
            var retriveMasterDetailPage           = GetMasterDetailPageDelegate();
            var retriveMasterDetailNavigationPage = GetMasterDetailNavigationPageDelegate();

            if (navigateMode == NavigateMode.Relative)
            {
                NavigationPage navigationPage = null;
                if (retriveNavigationPage != null)
                {
                    navigationPage = retriveNavigationPage;
                }
                if (retriveMasterDetailNavigationPage != null)
                {
                    navigationPage = retriveMasterDetailNavigationPage;
                }
                //var navigationPage = GetNavigationPageDelegate();
                if (navigationPage != null)
                {
                    await navigationPage.PushAsync(page);
                }
                else
                {
                    //Application.Current.MainPage = new NaviPage(page);
                    Application.Current.MainPage = GenerateNavigationPageDelegate(page);
                }
            }
            else if (navigateMode == NavigateMode.Master)
            {
                //if ((retriveMasterDetailPage == null) )
                //{
                MasterDetailPage masterDetailPage = GenerateMasterDetailPageDelegate();
                masterDetailPage.Detail      = GenerateNavigationPageDelegate(page);
                Application.Current.MainPage = masterDetailPage;
                //}
                //else
                //{
                //    retriveMasterDetailPage.Detail = GenerateNavigationPageDelegate(page);
                //}
            }
            else
            {
                Application.Current.MainPage = page;
            }
            //}

            await(page.BindingContext as ViewModelBase).InitializeAsync(parameter);
        }
        /// <summary>
        ///     Inactive with DVD menu.
        /// </summary>
        /// <param name="mode"></param>
        public void Navigate(NavigateMode mode)
        {
            if (VlcMediaPlayer == null)
            {
                throw new InvalidOperationException("VlcMediaPlayer doesn't have initialize.");
            }

            VlcMediaPlayer.Navigate(mode);
        }
Beispiel #8
0
        /// <summary>
        /// Performs the navigation to the given target
        /// </summary>
        /// <param name="target"></param>
        public void Navigate(NavigateMode mode, string target, params object[] args)
        {
            if (String.IsNullOrEmpty(target))
            {
                IShowMessageViewService showMessageService = ViewServiceLocator.GetViewService <IShowMessageViewService>();

                showMessageService.ButtonSetup = DialogButton.Ok;
                showMessageService.Caption     = "Warning";
                showMessageService.Text        = "Option not mapped to a view.";

                showMessageService.ShowMessage();

                return;
            }

            Application.Current.Dispatcher.BeginInvoke
            (
                DispatcherPriority.Background,
                new ThreadStart
                (
                    delegate
            {
                ParametersCollection navParams = null;
                string area = null;

                if (args != null && args.Length > 0)
                {
                    navParams = new ParametersCollection();
                    navParams.Add(NavigationParams.NavigationParamsKey, args);
                }

                var smnode = SiteMapService.SiteMap.RootNode.ChildNodes
                             .OfType <NavigationNode>()
                             .Traverse <NavigationNode>(node => ((node.ChildNodes) != null ? node.ChildNodes.OfType <NavigationNode>() : null))
                             .Where(n => n.Url == target).SingleOrDefault();

                if (smnode != null)
                {
                    area = smnode.SiteArea;
                }

                NavigationRequest request   = new NavigationRequest(target, navParams, area, mode);
                IDisposable navigationToken = nRoute.Navigation.NavigationService.Navigate(request);

                if (navigationToken != null)
                {
                    navigationToken.Dispose();
                    navigationToken = null;
                }
            }
                )
            );
        }
Beispiel #9
0
        /// <summary>
        /// Navigates to the most recent item in navigation history.
        /// </summary>
        /// <param name="mode"></param>
        /// <returns><c>true</c> if navigation is successed; otherwise, <c>false</c>.</returns>
        bool Navigate(NavigateMode mode)
        {
            _curMode = mode;
            if (!CanGoBack && mode == NavigateMode.Back)
            {
                return(false);
            }
            if (!CanGoForward && mode == NavigateMode.Forward)
            {
                return(false);
            }

            NavigationCache cache = FindHistory(mode);

            if (cache == null)
            {
                return(false);
            }

            _isSameUri = CurrentItem != null && CurrentItem.Uri.Equals(cache.Uri);
            if (_isSameUri)
            {
                _isOnNavigateMode = true;
            }
            bool isNavigated = _mainFrame.Navigate(cache.Uri, cache.ExtraData);

            if (!_isSameUri && isNavigated)
            {
                switch (mode)
                {
                case NavigateMode.Back:
                    _selectedPageIndex = _selectedPageIndex - 1;
                    _isOnNavigateMode  = true;
                    break;

                case NavigateMode.Forward:
                    _selectedPageIndex = _selectedPageIndex + 1;
                    _isOnNavigateMode  = true;
                    break;

                default:
                    break;
                }
            }

            return(isNavigated);
        }
Beispiel #10
0
        public async static void SendNavigateTo(NavigateMode mode, Type page, params object[] par)
        {
            switch (mode)
            {
            case NavigateMode.Main:
                MianNavigateToEvent(page, par);
                break;

            case NavigateMode.Info:
                if (page.FullName.Contains("WebPage") && await HandelUrl(par[0].ToString()))
                {
                    return;
                }
                InfoNavigateToEvent(page, par);
                break;

            case NavigateMode.Play:
                if (!page.FullName.Contains("MusicMiniPlayerPage"))
                {
                    MusicHelper.Pause();
                }
                //&&SettingHelper.IsPc()
                if (page == typeof(LiveRoomPage))
                {
                    PlayNavigateToEvent(typeof(LiveRoomPC), par);
                    return;
                }

                PlayNavigateToEvent(page, par);
                break;

            case NavigateMode.Home:
                HomeNavigateToEvent(page, par);
                break;

            case NavigateMode.Bg:
                BgNavigateToEvent(page, par);
                break;

            default:
                break;
            }
        }
Beispiel #11
0
        public static void SendNavigateTo(NavigateMode mode, Type page, params object[] par)
        {
            switch (mode)
            {
            case NavigateMode.Main:
                MianNavigateToEvent(page, par);
                break;

            case NavigateMode.Detail:
                DetailNavigateToEvent(page, par);
                break;

            case NavigateMode.Master:
                MasterNavigateToEvent(page, par);
                break;

            default:
                break;
            }
        }
Beispiel #12
0
        /// <summary>
        /// Performs the navigation to the given target
        /// </summary>
        /// <param name="target"></param>
        public void Navigate(NavigateMode mode, string target, params object[] args)
        {
            if (String.IsNullOrEmpty(target))
            {
                IShowMessageViewService showMessageService = ViewServiceLocator.GetViewService<IShowMessageViewService>();

                showMessageService.ButtonSetup  = DialogButton.Ok;
                showMessageService.Caption      = "Warning";
                showMessageService.Text         = "Option not mapped to a view.";

                showMessageService.ShowMessage();

                return;
            }

            Application.Current.Dispatcher.BeginInvoke
            (
                DispatcherPriority.Background,
                new ThreadStart
                (
                    delegate
                    {
                        ParametersCollection    navParams   = null;
                        string                  area        = null;

                        if (args != null && args.Length > 0)
                        {
                            navParams = new ParametersCollection();
                            navParams.Add(NavigationParams.NavigationParamsKey, args);
                        }

                        var smnode = SiteMapService.SiteMap.RootNode.ChildNodes
                            .OfType<NavigationNode>()
                            .Traverse<NavigationNode>(node => ((node.ChildNodes) != null ? node.ChildNodes.OfType<NavigationNode>() : null))
                            .Where(n => n.Url == target).SingleOrDefault();

                        if (smnode != null)
                        {
                            area = smnode.SiteArea;
                        }

                        NavigationRequest   request         = new NavigationRequest(target, navParams, area, mode);
                        IDisposable         navigationToken = nRoute.Navigation.NavigationService.Navigate(request);

                        if (navigationToken != null)
                        {
                            navigationToken.Dispose();
                            navigationToken = null;
                        }
                    }
                )
            );
        }
Beispiel #13
0
 /// <summary>
 /// Performs the navigation to the given target
 /// </summary>
 /// <param name="target"></param>
 public void Navigate(NavigateMode mode, string target)
 {
     this.Navigate(mode, target, null);
 }
 public Task NavigateToAsync <TViewModel>(object parameter, NavigateMode navigateMode = NavigateMode.Relative) where TViewModel : ViewModelBase
 {
     return(InternalNavigateToAsync(typeof(TViewModel), parameter, navigateMode));
 }
 public NavigationRequest(string url, ParametersCollection requestParameters, string siteArea, NavigateMode navigationMode)
     : base(url, requestParameters, siteArea)
 {
     _navigateMode = navigationMode;
 }
 public Task NavigateToAsync <TViewModel>(NavigateMode navigateMode = NavigateMode.Relative) where TViewModel : ViewModelBase
 {
     return(InternalNavigateToAsync(typeof(TViewModel), null, navigateMode));
 }
 public NavigationRequest(string url, ParametersCollection requestParameters, NavigateMode navigationMode)
     : this(url, requestParameters, null, navigationMode)
 {
 }
Beispiel #18
0
 public void Navigate(NavigateMode mode)
 {
     _navigateFunction.Delegate(InstancePointer, mode);
 }
Beispiel #19
0
 public void Navigate(NavigateMode mode)
 {
     NavigateFunction.Delegate(InstancePointer, mode);
 }
Beispiel #20
0
        /// <summary>
        ///     Inactive with DVD menu.
        /// </summary>
        /// <param name="mode"></param>
        public void Navigate(NavigateMode mode)
        {
            ThrowIfNotInitialize();

            VlcMediaPlayer.Navigate(mode);
        }
Beispiel #21
0
 /// <summary>
 /// Performs the navigation to the given target
 /// </summary>
 /// <param name="target"></param>
 public void Navigate(NavigateMode mode, string target)
 {
     this.Navigate(mode, target, null);
 }
Beispiel #22
0
 public void Navigate(NavigateMode mode)
 {
     VlcMediaPlayer.Navigate(mode);
 }
Beispiel #23
0
 /// <summary>
 /// Performs the navigation to the given target
 /// </summary>
 /// <param name="target"></param>
 protected void Navigate(NavigateMode mode, string target)
 {
     this.Navigate(mode, target, null);
 }
Beispiel #24
0
 /// <summary>
 /// Performs the navigation to the given target
 /// </summary>
 /// <param name="target"></param>
 protected void Navigate(NavigateMode mode, string target, params object[] args)
 {
     this.GetService<INavigationService>().Navigate(mode, target, args);
 }
 public NavigationRequest(string url, string siteArea, NavigateMode navigationMode)
     : this(url, null, siteArea, navigationMode)
 {
 }