示例#1
0
        /// <summary>
        ///   Initializes a new NavigationService for ViewModel-based navigation.
        /// </summary>
        /// <param name="conductor"> The underlying screen conductor used to activate navigation targets. </param>
        public Navigator(IConductActiveItem conductor)
        {
            if (conductor == null)
            {
                throw new ArgumentNullException("conductor");
            }

            _conductor = conductor;
        }
示例#2
0
        protected AppBarConductor(IConductActiveItem conductor, PhoneApplicationPage page)
        {
            _conductor = conductor;
            _page      = page;

            _pivot    = _page.GetVisualDescendants().OfType <Pivot>().FirstOrDefault();
            _panorama = _page.GetVisualDescendants().OfType <Panorama>().FirstOrDefault();

            if (_pivot == null && _panorama == null)
            {
                throw new ArgumentException("The appbar conductor must have a Pivot or Panorama to sync with.");
            }

            if (_pivot != null)
            {
                _pivot.LoadedPivotItem += PivotOnLoadedPivotItem;
            }

            if (_panorama != null)
            {
                _panorama.SelectionChanged += PanoramaOnSelectionChanged;

                // Load first appbar in Panorama after animations are complete
                var firstViewAware = conductor.ActiveItem as IViewAware;

                if (firstViewAware != null)
                {
                    EventHandler <ViewAttachedEventArgs> attachedHandler = null;

                    attachedHandler = (sender, args) =>
                    {
                        SyncAppBar(args.View as DependencyObject);

                        firstViewAware.ViewAttached -= attachedHandler;
                    };

                    firstViewAware.ViewAttached += attachedHandler;
                }
            }

            HandleDeferLoad();
        }
 public FrameAdapter(Frame frame)
 {
     this.frame = frame;
     // Might want to tighten this up as it makes assumptions :)
     this.shell = (frame as FrameworkElement).DataContext as IConductActiveItem;
 }
 /// <summary>
 ///   Initializes a new NavigationService.
 /// </summary>
 /// <param name="conductor"> The underlying screen conductor used to activate navigation targets. </param>
 public Navigator(IConductActiveItem conductor)
 {
     _conductor = conductor;
 }
示例#5
0
        /// <summary>
        ///   Initializes a new NavigationService for ViewModel-based navigation.
        /// </summary>
        /// <param name="conductor"> The underlying screen conductor used to activate navigation targets. </param>
        public Navigator(IConductActiveItem conductor)
        {
            if (conductor == null) throw new ArgumentNullException("conductor");

            _conductor = conductor;
        }
示例#6
0
 /// <summary>
 ///   Initializes a new NavigationService.
 /// </summary>
 /// <param name="conductor"> The underlying screen conductor used to activate navigation targets. </param>
 public Navigator(IConductActiveItem conductor)
 {
     _conductor = conductor;
 }