/// <summary> /// Subscribe to the events of this NavMenu's TopMenus. We should monitor them and then bubble them upwards via this menu's own NavigationMenuEvent. /// </summary> /// <param name="topMenu">The TopMenu effecting the event.</param> /// <param name="eventType">The type of event handled.</param> public void TopMenuEventHandler(TopMenu topMenu, TopMenuEventType eventType) { // Determine the type of event and handle it accordingly switch (eventType) { // A TopMenu has been modified (buttons added or removed) case TopMenuEventType.MENU_MODIFIED: { if (_navMenuEvent != null) { // Bubble this event upwards _navMenuEvent(this, NavigationMenuEventType.MENU_MODIFIED); } break; } // One of the MenuItems in this TopMenu were selected case TopMenuEventType.MENUITEM_SELECTED: { if (_navMenuEvent != null) { _navMenuEvent(this, NavigationMenuEventType.MENUITEM_SELECTED); } break; } // The TopMenu itself was selected case TopMenuEventType.TOPMENU_SELECTED: { // De-select the old TopMenu _selectedTopMenu.IsSelected = false; // Set the new TopMenu _selectedTopMenu = topMenu; // Set the newly selected TopMenu to selected _selectedTopMenu.IsSelected = true; // Bubble the event up if (_navMenuEvent != null) { _navMenuEvent(this, NavigationMenuEventType.TOPMENU_SELECTED); } break; } } }
/// <summary> /// Subscribe to the events of this NavMenu's TopMenus. We should monitor them and then bubble them upwards via this menu's own NavigationMenuEvent. /// </summary> /// <param name="topMenu">The TopMenu effecting the event.</param> /// <param name="eventType">The type of event handled.</param> public void TopMenuEventHandler(TopMenu topMenu, TopMenuEventType eventType) { // Determine the type of event and handle it accordingly switch (eventType) { // A TopMenu has been modified (buttons added or removed) case TopMenuEventType.MENU_MODIFIED: { if (_navMenuEvent != null) { // Bubble this event upwards _navMenuEvent(this, NavigationMenuEventType.MENU_MODIFIED); } break; } // One of the MenuItems in this TopMenu were selected case TopMenuEventType.MENUITEM_SELECTED: { if (_navMenuEvent != null) { _navMenuEvent(this, NavigationMenuEventType.MENUITEM_SELECTED); } break; } // The TopMenu itself was selected case TopMenuEventType.TOPMENU_SELECTED: { // De-select the old TopMenu _selectedTopMenu.IsSelected = false; // Set the new TopMenu _selectedTopMenu = topMenu; // Set the newly selected TopMenu to selected _selectedTopMenu.IsSelected = true; // Bubble the event up if (_navMenuEvent != null) { _navMenuEvent(this, NavigationMenuEventType.TOPMENU_SELECTED); } break; } } }