Exemplo n.º 1
0
        private void ExecuteNavigation(NavigationContext navigationContext, object[] activeViews, Action <NavigationResult> navigationCallback)
        {
            try
            {
                NotifyActiveViewsNavigatingFrom(navigationContext, activeViews);

                object view = this.regionNavigationContentLoader.LoadContent(this.Region, navigationContext);

                // Raise the navigating event just before activing the view.
                this.RaiseNavigating(navigationContext);

                this.Region.Activate(view);

                // Update the navigation journal before notifying others of navigaton
                IRegionNavigationJournalEntry journalEntry = this.serviceLocator.GetInstance <IRegionNavigationJournalEntry>();
                journalEntry.Uri        = navigationContext.Uri;
                journalEntry.Parameters = navigationContext.Parameters;
                this.journal.RecordNavigation(journalEntry);

                // The view can be informed of navigation
                InvokeOnNavigationAwareElement(view, (n) => n.OnNavigatedTo(navigationContext));

                navigationCallback(new NavigationResult(navigationContext, true));

                // Raise the navigated event when navigation is completed.
                this.RaiseNavigated(navigationContext);
            }
            catch (Exception e)
            {
                this.NotifyNavigationFailed(navigationContext, navigationCallback, e);
            }
        }
Exemplo n.º 2
0
        private void ExecuteNavigation(INavigationContext navigationContext, object[] activeViews, Action <IRegionNavigationResult> navigationCallback)
        {
            try
            {
                NotifyActiveViewsNavigatingFrom(navigationContext, activeViews);

                var view = (VisualElement)_regionNavigationContentLoader.LoadContent(Region, navigationContext);

                // Raise the navigating event just before activating the view.
                RaiseNavigating(navigationContext);

                Region.Activate(view);

                // Update the navigation journal before notifying others of navigation
                IRegionNavigationJournalEntry journalEntry = _container.Resolve <IRegionNavigationJournalEntry>();
                journalEntry.Uri        = navigationContext.Uri;
                journalEntry.Parameters = navigationContext.Parameters;

                bool persistInHistory = PersistInHistory(view);

                Journal.RecordNavigation(journalEntry, persistInHistory);

                // The view can be informed of navigation
                MvvmHelpers.OnNavigatedTo(view, navigationContext);

                navigationCallback(new RegionNavigationResult(navigationContext, true));

                // Raise the navigated event when navigation is completed.
                RaiseNavigated(navigationContext);
            }
            catch (Exception e)
            {
                NotifyNavigationFailed(navigationContext, navigationCallback, e);
            }
        }
Exemplo n.º 3
0
        public bool IsMe(IRegionNavigationJournalEntry entry)
        {
            var parts = entry.Uri.OriginalString.Split('?');

            if (parts[0] == _uri.OriginalString && entry.Tag == Playlist)
            {
                return true;
            }

            return false;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Records the navigation.
        /// </summary>
        /// <param name="entry">The entry.</param>
        public void RecordNavigation(IRegionNavigationJournalEntry entry)
        {
            var currentEntry = CurrentEntry;

            _regionNavigationJournal.RecordNavigation(entry);
            // if currententry isn't equal to previous entry then we moved forward
            if (currentEntry != null && CurrentEntry == entry)
            {
                _backStack.Push(currentEntry.Uri);
            }
        }
Exemplo n.º 5
0
        public bool IsMe(IRegionNavigationJournalEntry entry)
        {
            var parts = entry.Uri.OriginalString.Split('?');

            if (parts[0] == _uri.OriginalString)
            {
                return true;
            }

            return entry.Uri == _uri;
        }
Exemplo n.º 6
0
 public void RecordNavigation(IRegionNavigationJournalEntry entry)
 {
     if (!this.isNavigatingInternal)
     {
         if (this.CurrentEntry != null)
         {
             this.backStack.Push(this.CurrentEntry);
         }
         this.forwardStack.Clear();
         this.CurrentEntry = entry;
     }
 }
Exemplo n.º 7
0
 private void InternalNavigate(IRegionNavigationJournalEntry entry, Action <bool> callback)
 {
     this.isNavigatingInternal = true;
     this.NavigationTarget.RequestNavigate(
         entry.Uri,
         nr =>
     {
         this.isNavigatingInternal = false;
         if (nr.Result.HasValue)
         {
             callback(nr.Result.Value);
         }
     },
         entry.Parameters);
 }
        void InternalNavigate(IRegionNavigationJournalEntry entry, Action <bool> callback)
        {
            _navigatingInternal = true;
            NavigationTarget.Navigate(
                entry.Uri,
                nr =>
            {
                _navigatingInternal = false;

                if (nr.Result.HasValue)
                {
                    callback(nr.Result.Value);
                }
            },
                entry.Args);
        }
        private void ExecuteNavigation(NavigationContext navigationContext, object[] activeViews, Action <NavigationResult> navigationCallback, IUnityContainer container)
        {
            try
            {
                NotifyActiveViewsNavigatingFrom(navigationContext, activeViews);

                object view = null;
                if (container == null)
                {
                    view = this.regionNavigationContentLoader.LoadContent(this.Region, navigationContext);
                }
                else
                {
                    CustomRegionNavigationContentLoader customLoader = this.regionNavigationContentLoader as CustomRegionNavigationContentLoader;
                    if (customLoader == null)
                    {
                        throw new InvalidOperationException("Custom RegionNavigationContentLoader can not be null");
                    }

                    view = customLoader.LoadContent(this.Region, navigationContext, container);
                }

                // Raise the navigating event just before activing the view.
                this.RaiseNavigating(navigationContext);

                this.Region.Activate(view);

                // Update the navigation journal before notifying others of navigaton
                IRegionNavigationJournalEntry journalEntry = this.serviceLocator.GetInstance <IRegionNavigationJournalEntry>();
                journalEntry.Uri        = navigationContext.Uri;
                journalEntry.Parameters = navigationContext.Parameters;
                this.journal.RecordNavigation(journalEntry);

                // The view can be informed of navigation
                Action <INavigationAware> action = (n) => n.OnNavigatedTo(navigationContext);
                MvvmHelpers.ViewAndViewModelAction(view, action);

                navigationCallback(new NavigationResult(navigationContext, true));

                // Raise the navigated event when navigation is completed.
                this.RaiseNavigated(navigationContext);
            }
            catch (Exception e)
            {
                this.NotifyNavigationFailed(navigationContext, navigationCallback, e);
            }
        }
Exemplo n.º 10
0
        private void ExecuteNavigation(NavigationContext navigationContext, object[] activeViews, Action <NavigationResult> navigationCallback, IUnityContainer containerToUse)
        {
            try
            {
                NotifyActiveViewsNavigatingFrom(navigationContext, activeViews);
                object view = null;
                if (containerToUse == null)
                {
                    view = this.regionNavigationContentLoader.LoadContent(this.Region, navigationContext);
                }
                else
                {
                    CustomRegionNavigationContentLoader customRegionNavigationContentLoader = this.regionNavigationContentLoader as CustomRegionNavigationContentLoader;
                    if (customRegionNavigationContentLoader == null)
                    {
                        throw new InvalidOperationException("CustomRegionNavigationService.ExecuteNavigation method that takes a container may only be used with a CustomRegionNavigationContentLoader");
                    }

                    view = ((CustomRegionNavigationContentLoader)this.regionNavigationContentLoader).LoadContent(this.Region, navigationContext, containerToUse);
                }


                // Raise the navigating event just before activing the view.
                this.RaiseNavigating(navigationContext);

                this.Region.Activate(view);

                // Update the navigation journal before notifying others of navigaton
                IRegionNavigationJournalEntry journalEntry = this.serviceLocator.GetInstance <IRegionNavigationJournalEntry>();
                journalEntry.Uri = navigationContext.Uri;
                this.journal.RecordNavigation(journalEntry);

                // The view can be informed of navigation
                InvokeOnNavigationAwareElement(view, (n) => n.OnNavigatedTo(navigationContext));

                navigationCallback(new NavigationResult(navigationContext, true));

                // Raise the navigated event when navigation is completed.
                this.RaiseNavigated(navigationContext);
            }
            catch (Exception e)
            {
                this.NotifyNavigationFailed(navigationContext, navigationCallback, e);
            }
        }
Exemplo n.º 11
0
 public void GoForward()
 {
     if (this.CanGoForward)
     {
         IRegionNavigationJournalEntry entry = this.forwardStack.Peek();
         this.InternalNavigate(
             entry,
             result =>
         {
             if (result)
             {
                 if (this.CurrentEntry != null)
                 {
                     this.backStack.Push(this.CurrentEntry);
                 }
                 this.forwardStack.Pop();
                 this.CurrentEntry = entry;
             }
         });
     }
 }
Exemplo n.º 12
0
 private void ExecuteNavigation(NavigationContext navigationContext, object[] activeViews, Action <NavigationResult> navigationCallback)
 {
     try
     {
         NotifyActiveViewsNavigatingFrom(navigationContext, activeViews);
         object view = this.regionNavigationContentLoader.LoadContent(this.Region, navigationContext);
         this.RaiseNavigating(navigationContext);
         this.Region.Activate(view);
         IRegionNavigationJournalEntry journalEntry = this.serviceLocator.GetInstance <IRegionNavigationJournalEntry>();
         journalEntry.Uri        = navigationContext.Uri;
         journalEntry.Parameters = navigationContext.Parameters;
         this.journal.RecordNavigation(journalEntry);
         InvokeOnNavigationAwareElement(view, (n) => n.OnNavigatedTo(navigationContext));
         navigationCallback(new NavigationResult(navigationContext, true));
         this.RaiseNavigated(navigationContext);
     }
     catch (Exception e)
     {
         this.NotifyNavigationFailed(navigationContext, navigationCallback, e);
     }
 }
Exemplo n.º 13
0
        /// <summary>
        /// Records the navigation to the entry..
        /// </summary>
        /// <param name="entry">The entry to record.</param>
        /// <param name="persistInHistory">Determine if the view is added to the back stack or excluded from the history.</param>
        public void RecordNavigation(IRegionNavigationJournalEntry entry, bool persistInHistory)
        {
            if (!_isNavigatingInternal)
            {
                if (CurrentEntry != null)
                {
                    _backStack.Push(CurrentEntry);
                }

                _forwardStack.Clear();

                if (persistInHistory)
                {
                    CurrentEntry = entry;
                }
                else
                {
                    CurrentEntry = null;
                }
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// Navigates to the most recent entry in the forward navigation history, or does nothing if no entry exists in forward navigation.
        /// </summary>
        public void GoForward()
        {
            if (CanGoForward)
            {
                IRegionNavigationJournalEntry entry = _forwardStack.Peek();
                InternalNavigate(
                    entry,
                    result =>
                {
                    if (result)
                    {
                        if (CurrentEntry != null)
                        {
                            _backStack.Push(CurrentEntry);
                        }

                        _forwardStack.Pop();
                        CurrentEntry = entry;
                    }
                });
            }
        }
        void ExecuteNavigation(NavigationContext navigationContext, object[] activeViews, Action <NavigationResult> navigationCallback)
        {
            try
            {
                NotifyActiveViewsNavigatingFrom(navigationContext, activeViews);

                object view = _regionNavigationContentLoader.LoadContent(Region, navigationContext);

                // Raise the navigating event just before activing the view.
                RaiseNavigating(navigationContext);

                Region.Activate(view);

                // Update the navigation journal before notifying others of navigaton
                IRegionNavigationJournalEntry journalEntry = _container.Resolve <IRegionNavigationJournalEntry>();
                journalEntry.Uri  = navigationContext.Uri;
                journalEntry.Args = navigationContext.Args;

                bool persistInHistory = PersistInHistory(view);

                Journal.RecordNavigation(journalEntry, persistInHistory);

                // The view can be informed of navigation
                void action(INavigationAware n) => n.OnNavigatedTo(navigationContext);

                MVVMHelper.ViewAndViewModelAction(view, (Action <INavigationAware>)action);

                navigationCallback(new NavigationResult(navigationContext, true));

                // Raise the navigated event when navigation is completed.
                RaiseNavigated(navigationContext);
            }
            catch (Exception e)
            {
                NotifyNavigationFailed(navigationContext, navigationCallback, e);
            }
        }
 public void OnNavigatedTo(NavigationContext navigationContext)
 {
     if (navigationJournal == null)
     {
     navigationJournal = navigationContext.NavigationService.Journal;
     navigationJournalEntry = navigationJournal.CurrentEntry;
     }
 }
Exemplo n.º 17
0
        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            if (navigationJournal == null)
            {
                navigationJournal = navigationContext.NavigationService.Journal;
                navigationJournalEntry = navigationJournal.CurrentEntry;
            }
            allowKeyPressMonitoring = true;

            _mediaSource = navigationContext.Parameters["mediaSource"];

            InitializeComponent();
            initVLCPlayer();

            if (localVlcControl.Media != null)
            {
                localVlcControl.Media.ParsedChanged -= MediaOnParsedChanged;
            }
            else
            {
                localVlcControl.VideoProperties.Scale = 2.0f;
                localVlcControl.PositionChanged += VlcControlOnPositionChanged;
                localVlcControl.TimeChanged += VlcControlOnTimeChanged;
            }

            localVlcControl.Media = new PathMedia(_mediaSource);
            localVlcControl.Media.ParsedChanged += MediaOnParsedChanged;
            localVlcControl.Play();
        }
Exemplo n.º 18
0
        private void InternalNavigate(IRegionNavigationJournalEntry entry, Action<bool> callback)
        {
            this.isNavigatingInternal = true;
            this.NavigationTarget.RequestNavigate(
                entry.Uri,
                nr =>
                {
                    this.isNavigatingInternal = false;

                    if (nr.Result.HasValue)
                    {
                        callback(nr.Result.Value);
                    }
                },
                entry.Parameters);
        }
Exemplo n.º 19
0
 public void OnNavigatedTo(NavigationContext navigationContext)
 {
     youTubeSearch("dog");
     regionManager = ServiceLocator.Current.GetInstance<IRegionManager>();
     if (navigationJournal == null)
     {
       navigationJournal = navigationContext.NavigationService.Journal;
       navigationJournalEntry = navigationJournal.CurrentEntry;
     }
 }
Exemplo n.º 20
0
 public void OnNavigatedTo(NavigationContext navigationContext)
 {
     moduleManager = ServiceLocator.Current.GetInstance<IModuleManager>();
       moduleCatalog = ServiceLocator.Current.GetInstance<IModuleCatalog>();
       regionManager = ServiceLocator.Current.GetInstance<IRegionManager>();
       container = ServiceLocator.Current.GetInstance<IUnityContainer>();
       if (navigationJournal == null)
       {
     navigationJournal = navigationContext.NavigationService.Journal;
     navigationJournalEntry = navigationJournal.CurrentEntry;
       }
 }
Exemplo n.º 21
0
 /// <summary>
 /// Clears the journal of current, back, and forward navigation histories.
 /// </summary>
 public void Clear()
 {
     CurrentEntry = null;
     _backStack.Clear();
     _forwardStack.Clear();
 }
Exemplo n.º 22
0
 public bool IsMe(IRegionNavigationJournalEntry entry)
 {
     return false;
 }
Exemplo n.º 23
0
        /// <summary>
        /// Records the navigation to the entry..
        /// </summary>
        /// <param name="entry">The entry to record.</param>
        public void RecordNavigation(IRegionNavigationJournalEntry entry)
        {
            if (!this.isNavigatingInternal)
            {
                if (this.CurrentEntry != null)
                {
                    this.backStack.Push(this.CurrentEntry);
                }

                this.forwardStack.Clear();
                this.CurrentEntry = entry;
            }
        }
Exemplo n.º 24
0
 public void OnNavigatedTo(NavigationContext navigationContext)
 {
     Messenger.Default.Register<string>(this, AppClosing);
       regionManager = ServiceLocator.Current.GetInstance<IRegionManager>();
       if (navigationJournal == null)
       {
     navigationJournal = navigationContext.NavigationService.Journal;
     navigationJournalEntry = navigationJournal.CurrentEntry;
       }
 }
Exemplo n.º 25
0
 public bool IsMe(IRegionNavigationJournalEntry entry)
 {
     return entry.Uri == _uri;
 }
Exemplo n.º 26
0
 public void OnNavigatedTo(NavigationContext navigationContext)
 {
   Messenger.Default.Register<MediaElement>(this, "Main", TV_Rendered);
   Messenger.Default.Register<ContentControl>(this, "Content", CC_Rendered);
   Messenger.Default.Register<string>(this, AppClosing);
   Messenger.Default.Register<string>(this, "TVLoaded", StartTV);
   regionManager = ServiceLocator.Current.GetInstance<IRegionManager>();
   if (navigationJournal == null)
   {
     navigationJournal = navigationContext.NavigationService.Journal;
     navigationJournalEntry = navigationJournal.CurrentEntry;
   }
   StartupControl();
 }