private void NavigationFrame_FragmentNavigation(object sender, System.Windows.Navigation.FragmentNavigationEventArgs e)
        {
            var samplePage = NavigationFrame.Content as SamplePage;

            if (samplePage != null)
            {
                samplePage.OnNavigatedTo(e.Fragment);
            }
        }
예제 #2
0
 protected override void OnFragmentNavigation(FragmentNavigationEventArgs e)
 {
     switch (e.Fragment)
     {
         case "Coffee":
             SetItemsCoffee();
             break;
         case "Tea":
             SetItemsTea();
             break;
     }
 }
예제 #3
0
        /// <summary>
        /// Called by NavigationService to let document content to handle the fragment first.
        /// </summary>
        /// <param name="sender"></param> 
        /// <param name="e"></param>
        internal static void FragmentHandler(object sender, FragmentNavigationEventArgs e) 
        { 
            NavigationService ns = sender as NavigationService;
 
            if (ns != null)
            {
                string fragment = e.Fragment;
                IFixedNavigate fixedNavigate = ns.Content as IFixedNavigate; 

                if (fixedNavigate != null) 
                { 
                    fixedNavigate.NavigateAsync(e.Fragment);
                    e.Handled = true; 
                }
            }
        }
        /// <summary>
        /// Raises the Fragment Navigation event synchronously
        /// </summary>
        /// <param name="fragment">The fragment that was navigated to</param>
        private void RaiseFragmentNavigation(string fragment)
        {
            FragmentNavigationEventHandler eventHandler = this.FragmentNavigation;

            if (eventHandler != null)
            {
                FragmentNavigationEventArgs eventArgs = new FragmentNavigationEventArgs(fragment);
                eventHandler(this, eventArgs);
            }

            Page p = this._host.Content as Page;

            if (p != null)
            {
                FragmentNavigationEventArgs eventArgs = new FragmentNavigationEventArgs(fragment);
                p.InternalOnFragmentNavigation(eventArgs);
            }
        }
예제 #5
0
        private void OnSourceChanged(Uri oldValue, Uri newValue, Object parameter)
        {
            // if resetting source or old source equals new, don't do anything
            if (this.IsResetSource || newValue != null && newValue.Equals(oldValue))
            {
                return;
            }

            // handle fragment navigation
            string newFragment = null;
            var oldValueNoFragment = NavigationManager.RemoveFragment(oldValue);
            var newValueNoFragment = NavigationManager.RemoveFragment(newValue, out newFragment);

            if (newValueNoFragment != null && newValueNoFragment.Equals(oldValueNoFragment))
            {
                // fragment navigation
                FragmentNavigationEventArgs args = new FragmentNavigationEventArgs
                {
                    Fragment = newFragment,
                    Parameter = parameter,
                };

                OnFragmentNavigation(this.Content as IContent, args);
            }
            else
            {
                var navType = this.IsNavigatingHistory ? NavigationType.Back : NavigationType.New;

                // only invoke CanNavigate for new navigation
                if (!this.IsNavigatingHistory && !CanNavigate(oldValue, newValue, navType))
                {
                    return;
                }

                Navigate(oldValue, newValue, navType, parameter);
            }
        }
예제 #6
0
        // Returns true if a listener has handled the fragment and no more processing is necessary
        // False indicates that NavigationService should continue with the default behaviour
        private bool FireFragmentNavigation(string fragment)
        {
            if (string.IsNullOrEmpty(fragment))
            {
                // A navigation to a null or empty fragment is a scroll to the top of the page.
                // This is not intuitively a fragment navigation so we should not fire this event.
                return false;
            }

            FragmentNavigationEventArgs e = new FragmentNavigationEventArgs(fragment, INavigatorHost);

            // Event handler exception continuality: if exception occurs in FragmentNavigation event handler, the cleanup action is
            // the same as StopLoading().
            try
            {
                if (_fragmentNavigation != null)
                {
                    _fragmentNavigation(this, e);
                }

                if (Application != null && Application.CheckAccess())
                {
                    Application.FireFragmentNavigation(e);
                }
            }
            catch
            {
                DoStopLoading(true, false);

                throw;
            }

            return e.Handled;
        }
예제 #7
0
파일: MainPage.xaml.cs 프로젝트: JuRogn/OA
        private void ContentFrame_FragmentNavigation(object sender, FragmentNavigationEventArgs e)
        {

        }
 /// <summary>
 /// Raises the FragmentNavigation event.
 /// </summary>
 /// <param name="e">The arguments that describe this event.</param>
 protected virtual void OnFragmentNavigation(FragmentNavigationEventArgs e)
 {
     if (FragmentNavigation != null)
     {
         FragmentNavigation(this, e);
     }
 }
예제 #9
0
 private void Application_FragmentNavigation(object sender, FragmentNavigationEventArgs e)
 {
     System.Console.WriteLine("Application_FragmentNavigation, Fragment: {0}", e.Fragment);
 }
예제 #10
0
 internal void InternalOnFragmentNavigation(FragmentNavigationEventArgs e)
 {
     this.OnFragmentNavigation(e);
 }
예제 #11
0
        private void OnFragmentNavigation(IContent content, FragmentNavigationEventArgs e)
        {
            // invoke optional IContent.OnFragmentNavigation
            if (content != null)
            {
                content.OnFragmentNavigation(e);
            }

            // raise the FragmentNavigation event
            if (FragmentNavigation != null)
            {
                FragmentNavigation(this, e);
            }
        }
예제 #12
0
		protected virtual void OnFragmentNavigation (FragmentNavigationEventArgs args)
		{
			if (FragmentNavigation != null)
				FragmentNavigation (this, args);
		}
예제 #13
0
		// Called when navigating to a fragment on a page
		protected override void OnFragmentNavigation(FragmentNavigationEventArgs e)
		{
		}
예제 #14
0
 /// <summary>
 /// This method fires the FragmentNavigation event
 /// whenever a navigation to a uri containing a fragment
 /// occurs.
 /// </summary>
 /// <remarks>
 ///     This method follows the .Net programming guideline of having a protected virtual
 ///     method that raises an event, to provide a convenience for developers that subclass
 ///     the event. If you override this method - you need to call Base.OnNavigationStopped(...) for
 ///     the corresponding event to be raised.
 /// </remarks>
 /// <param name="e">FragmentNavigationEventArgs</param>
 protected virtual void OnFragmentNavigation(FragmentNavigationEventArgs e)
 {
     VerifyAccess();
     if (FragmentNavigation != null)
     {
         FragmentNavigation(this, e);
     }
 }
 void PART_Frame_FragmentNavigation(object sender, FragmentNavigationEventArgs e)
 {
     if (FragmentNavigation != null)
         FragmentNavigation(this, e);
 }
 /// <summary>
 /// Called when navigation to a content fragment begins.
 /// </summary>
 /// <param name="e">An object that contains the navigation data.</param>
 public void OnFragmentNavigation(FragmentNavigationEventArgs e)
 {   
 }
 private void ContentFrame_FragmentNavigation(object sender, FragmentNavigationEventArgs e)
 {
     LayoutRoot.IsBusy = false;
 }
        /// <summary>
        /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed.
        /// <example>
        /// fragmentnavigationeventhandler.BeginInvoke(sender, e, callback);
        /// </example>
        /// </summary>
        public static IAsyncResult BeginInvoke(this FragmentNavigationEventHandler fragmentnavigationeventhandler, Object sender, FragmentNavigationEventArgs e, AsyncCallback callback)
        {
            if(fragmentnavigationeventhandler == null) throw new ArgumentNullException("fragmentnavigationeventhandler");

            return fragmentnavigationeventhandler.BeginInvoke(sender, e, callback, null);
        }
 /// <summary>
 /// Fragmented Navigation is not supported in WP 7 (build 7004)
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void NonLinearNavigationService_FragmentNavigation(object sender, FragmentNavigationEventArgs e)
 {
     Debug.WriteLine("NonLinearNavigationService_FragmentNavigation");
 }
예제 #20
0
 protected override void OnFragmentNavigation(FragmentNavigationEventArgs e)
 {
     base.OnFragmentNavigation(e);
     Model.FragmentNavigation(e.Fragment);
 }
예제 #21
0
 internal void FireFragmentNavigation(FragmentNavigationEventArgs e)
 {
     OnFragmentNavigation(e);
 }
예제 #22
0
 private void Application_FragmentNavigation(object sender, System.Windows.Navigation.FragmentNavigationEventArgs e)
 {
     logger.InfoFormat("{0:D3}.{1}", ++numberIndex, MethodBase.GetCurrentMethod().Name);
 }
        /// <summary>
        /// Raises the Fragment Navigation event synchronously
        /// </summary>
        /// <param name="fragment">The fragment that was navigated to</param>
        private void RaiseFragmentNavigation(string fragment)
        {
            FragmentNavigationEventHandler eventHandler = this.FragmentNavigation;

            if (eventHandler != null)
            {
                FragmentNavigationEventArgs eventArgs = new FragmentNavigationEventArgs(fragment);
                eventHandler(this, eventArgs);
            }

            Page p = this._host.Content as Page;
            if (p != null)
            {
                FragmentNavigationEventArgs eventArgs = new FragmentNavigationEventArgs(fragment);
                p.InternalOnFragmentNavigation(eventArgs);
            }
        }
예제 #24
0
 /// <summary>
 /// This method is called when fragment navigation occurs on a page - either because a fragment
 /// was present in the original Uri that navigated to this page, or because a later fragment
 /// navigation occurs.
 /// </summary>
 /// <remarks>
 /// This should be used rather than signing up for NavigationService.FragmentNavigation
 /// because that event may be difficult to sign up for in time to get the first fragment navigation.
 /// </remarks>
 /// <param name="e">The event arguments, containing the fragment navigated to</param>
 protected virtual void OnFragmentNavigation(FragmentNavigationEventArgs e)
 {
     return;
 }
 void frame_FragmentNavigation(object sender, FragmentNavigationEventArgs e)
 {
     var handler = this.FragmentNavigation;
     if (handler != null)
     {
         handler(sender, e);
     }
 }
예제 #26
0
        private void SetContent(Uri newSource, NavigationType navigationType, object newContent, bool contentIsError, Object parameter)
        {
            var oldContent = this.Content as IContent;

            // assign content
            this.Content = newContent;

            // do not raise navigated event when error
            if (!contentIsError)
            {
                var args = new NavigationEventArgs
                {
                    Frame = this,
                    Source = newSource,
                    Content = newContent,
                    NavigationType = navigationType,
                    Parameter = parameter,
                };

                OnNavigated(oldContent, newContent as IContent, args);
            }

            // set IsLoadingContent to false
            SetValue(IsLoadingContentPropertyKey, false);

            if (!contentIsError)
            {
                // and raise optional fragment navigation events
                string fragment;
                NavigationManager.RemoveFragment(newSource, out fragment);
                if (fragment != null)
                {
                    // fragment navigation
                    var fragmentArgs = new FragmentNavigationEventArgs
                    {
                        Fragment = fragment
                    };

                    OnFragmentNavigation(newContent as IContent, fragmentArgs);
                }
            }
        }