/// <summary> /// Execute handler for the browse back command. /// Retrieves the previous navigation item from the history list and navigates to it. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BrowseBackCommand_Executed(object sender, ExecutedRoutedEventArgs e) { _ignoreViewSelectionChange = true; NavigationItem targetItem = _historsList.BrowseBack(); _context.ContextVisibility = Visibility.Collapsed; targetItem.Context.ContextVisibility = Visibility.Visible; _context.OnHierarchyDeactivated(); _context = targetItem.Context; _context.OnHierarchyActivated(targetItem.Id); NotifyPropertyChanged(new PropertyChangedEventArgs("")); _ignoreViewSelectionChange = false; }
/// <summary> /// Execute handler for the browse down command. /// Navigates to the lower hiearchy. /// E.g. from floor view to zone view. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BrowseDownCommand_Executed(object sender, ExecutedRoutedEventArgs e) { _ignoreViewSelectionChange = true; _context.ContextVisibility = Visibility.Collapsed; _context.Child.ContextVisibility = Visibility.Visible; _context.OnHierarchyDeactivated(); _context = _context.Child; _context.OnHierarchyActivated(e.Parameter as Address); //if ((e.Parameter != null) && (e.Parameter is Address)) // _context.Navigate(e.Parameter as Address); //else // _context.Navigate(null); _historsList.Append(new NavigationItem(_context, new Address(_context.ObjectId), _context.ObjectName)); NotifyPropertyChanged(new PropertyChangedEventArgs("")); _ignoreViewSelectionChange = false; }
/// <summary> /// The navigation object. /// </summary> /// <param name="context"></param> public Navigator(IHierarchyContext context) { this._context = context; CommandBinding binding = new CommandBinding(CustomCommands.BrowseNext, NextViewCommand_Executed, NextViewCommand_CanExecute); _bindings.Add(binding); binding = new CommandBinding(CustomCommands.BrowsePrevious, PreviousViewCommand_Executed, PreviousViewCommand_CanExecute); _bindings.Add(binding); binding = new CommandBinding(NavigationCommands.BrowseForward, BrowseForwardCommand_Executed, BrowseForwardCommand_CanExecute); _bindings.Add(binding); binding = new CommandBinding(NavigationCommands.BrowseBack, BrowseBackCommand_Executed, BrowseBackCommand_CanExecute); _bindings.Add(binding); binding = new CommandBinding(CustomCommands.BrowseDown, BrowseDownCommand_Executed, BrowseDownCommand_CanExecute); _bindings.Add(binding); binding = new CommandBinding(CustomCommands.BrowseUp, BrowseUpCommand_Executed, BrowseUpCommand_CanExecute); _bindings.Add(binding); }
/// <summary> /// Updates the context with the specified new zone context. /// </summary> /// <param name="context">The new zone context.</param> public void UpdateContext(IHierarchyContext context) { if ((context is ZoneContext) == false) { return; } _ignoreViewSelectionChange = true; ZoneContext newContext = context as ZoneContext; _zones = newContext._zones; _activeZone = _zones[0]; _sources = newContext._sources; NotifyPropertyChanged(new PropertyChangedEventArgs("")); _ignoreViewSelectionChange = false; }
/// <summary> /// Specifies a all attributes of a view at a point of time. /// </summary> /// <param name="context">The hierarchy. Right now this is either the main context, the floor context or the zone context</param> /// <param name="id">The address of the item shown in the view.</param> /// <param name="name">The name of the item shown in the view.</param> public NavigationItem(IHierarchyContext context, Address id, string name) { this._context = context; this._id = id; this._name = name; }
/// <summary> /// Updates the context with the specified parameter. /// </summary> /// <param name="context"></param> public void UpdateContext(IHierarchyContext context) { // not used }
/// <summary> /// Updates the context with the specified parameter. /// </summary> /// <param name="context"></param> public void UpdateContext(IHierarchyContext context) { // nothing to do }