/// <summary> /// Method which gets invoked when navigation selection gets changed. /// </summary> private void OnNavigationSelectionChanged() { if (this.SelectedItem == null) { return; } this.SelectedRootMenuItem = null; if (this.SelectedItem is ControlInfo controlInfo) { this.IsThemeVisible = false; this.Header = controlInfo.Name; this.IsHeaderVisible = true; NavigationService.Frame.Navigate(typeof(SectionGroupPage), this); } else if (this.SelectedItem is DemoInfo demoInfo) { this.Header = demoInfo.Name; this.IsHeaderVisible = true; this.IsThemeVisible = true; this.DemoInfo = demoInfo; NavigationService.Frame.Navigate(typeof(DemoPage), this); } else if ((this.SelectedItem as NavigationViewItem).Content.ToString() == Constants.Settings) { this.Header = Constants.Settings; this.IsThemeVisible = false; this.IsHeaderVisible = true; NavigationService.Frame.Navigate(typeof(SettingsPage), this); } }
/// <summary> /// Method which gets invoked when root menu items selection gets changed. /// </summary> private void RootMenuItemSelectionChanged() { if (this.SelectedRootMenuItem == null) { return; } this.IsThemeVisible = false; this.SelectedItem = null; this.DemoInfo = null; var selectedItem = this.SelectedRootMenuItem as BrowserModel; if (selectedItem.Content.ToString() == Constants.Showcase) { this.Header = string.Empty; this.IsHeaderVisible = false; NavigationService.Frame.Navigate(typeof(SectionPage), this); } else if (selectedItem.Content.ToString() == Constants.AllControls || selectedItem.Content.ToString() == Constants.WhatsNew) { this.Header = selectedItem.Content.ToString(); this.IsHeaderVisible = false; NavigationService.Frame.Navigate(typeof(SectionGroupPage), this); } this.MenuItems = DemoHelper.ControlInfos; }
/// <summary> /// Method which gets invoked when tile is selected. /// </summary> /// <param name="controlInfo"></param> internal void OnTileSelected(object selectedItem) { if (selectedItem == null) { return; } DemoInfo demoInfo = selectedItem as DemoInfo; if (demoInfo != null) { var controlInfo = DemoHelper.GetControlInfo(demoInfo); var menuItems = new List <object>(); menuItems.Add(new CategoryGroup() { Category = controlInfo.Name }); var categories = controlInfo.Demos.GroupBy(x => x.Category); if (categories.Count() > 1) { foreach (var category in categories) { var featureGroup = new CategoryGroup() { Category = category.Key }; menuItems.Add(featureGroup); menuItems.AddRange(category.ToList()); } } else { menuItems.AddRange(controlInfo.Demos); } this.MenuItems = menuItems; this.SelectedItem = demoInfo; } else if (selectedItem is ControlInfo controlInfo) { //var menuItems = new List<object>(); //menuItems.Add(controlInfo); //var categories = controlInfo.Demos.GroupBy(x => x.Category); //if (categories.Count() > 1) //{ // foreach (var category in categories) // { // var featureGroup = new CategoryGroup() { CategoryName = category.Key }; // menuItems.Add(featureGroup); // menuItems.AddRange(category.ToList()); // } //} //this.MenuItems = menuItems; this.SelectedItem = controlInfo; } }
/// <summary> /// A method to identify the control information of the demo info /// </summary> /// <param name="demoInfo">demo info</param> /// <returns>Control info</returns> internal static ControlInfo GetControlInfo(DemoInfo demoInfo) { foreach (var control in DemoHelper.ControlInfos) { var demo = control.Demos.FirstOrDefault(x => x.Equals(demoInfo)); if (demo != null) { return(control); } } return(null); }
/// <summary> /// Method which gets invoked when demo is selected. /// </summary> /// <param name="control"></param> internal void SelectDemo(DemoInfo control) { this.SelectedItem = control; this.OnTileSelected(control); }