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); } }
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); } }
public bool IsMe(IRegionNavigationJournalEntry entry) { var parts = entry.Uri.OriginalString.Split('?'); if (parts[0] == _uri.OriginalString && entry.Tag == Playlist) { return true; } return false; }
/// <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); } }
public bool IsMe(IRegionNavigationJournalEntry entry) { var parts = entry.Uri.OriginalString.Split('?'); if (parts[0] == _uri.OriginalString) { return true; } return entry.Uri == _uri; }
public void RecordNavigation(IRegionNavigationJournalEntry entry) { if (!this.isNavigatingInternal) { if (this.CurrentEntry != null) { this.backStack.Push(this.CurrentEntry); } this.forwardStack.Clear(); this.CurrentEntry = entry; } }
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); } }
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); } }
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; } }); } }
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); } }
/// <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; } } }
/// <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; } }
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(); }
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); }
public void OnNavigatedTo(NavigationContext navigationContext) { youTubeSearch("dog"); regionManager = ServiceLocator.Current.GetInstance<IRegionManager>(); if (navigationJournal == null) { navigationJournal = navigationContext.NavigationService.Journal; navigationJournalEntry = navigationJournal.CurrentEntry; } }
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; } }
/// <summary> /// Clears the journal of current, back, and forward navigation histories. /// </summary> public void Clear() { CurrentEntry = null; _backStack.Clear(); _forwardStack.Clear(); }
public bool IsMe(IRegionNavigationJournalEntry entry) { return false; }
/// <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; } }
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; } }
public bool IsMe(IRegionNavigationJournalEntry entry) { return entry.Uri == _uri; }
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(); }