/// <summary> /// Populates the breadcrumb in the title bar. /// </summary> /// <param name="switcherItem">The switcher item to be added.</param> private void PopulateBreadCrumb(SwitcherItem switcherItem, bool resetBreadcrumb) { // Check if the breadcrumb collection already has items // Method: Add each item one by one to a new temp collection until the item which has been select (passed in) is found // Then overwrite the Breadcrumb collection with the temp collection - therefore any item after the selected item will be removed. if (resetBreadcrumb) { BreadcrumbCollection = new ObservableCollection <SwitcherItem>(); } if (BreadcrumbCollection.Any()) { ObservableCollection <SwitcherItem> tempCollection = new ObservableCollection <SwitcherItem>(); foreach (SwitcherItem s in BreadcrumbCollection) { if (s != switcherItem) { tempCollection.Add(s); } else { break; } } BreadcrumbCollection = tempCollection; } BreadcrumbCollection.Add(switcherItem); }
private void btnBack_Click(object sender, RoutedEventArgs e) { Button btn = (Button)sender; SwitcherItem selectedTile = (SwitcherItem)btn.DataContext; Messenger.Default.Send <GenericMessage <SwitcherItem> >(new GenericMessage <SwitcherItem>(this, selectedTile)); ResetWindowSize(); }
public void SelectApplications(GenericMessage <MenuItem> msg) { SwitcherItem selectedApp = (SwitcherItem)msg.Content.DataContext; string selectedMenuItem = msg.Content.Header.ToString(); foreach (SubApplication subApp in SelectedApplication.SubItems.Where(sa => sa.Name == selectedApp.ParentItem)) { //TODO This only goes one level deep on subapps. Should recurse through all subitems. foreach (SubApplication subApp2 in subApp.SubItems) //.Where(sa => sa.Name == selectedApp.ParentItem)) { subApp2.IsSelected = false; switch (selectedMenuItem) { case "select all": subApp2.IsSelected = true; break; //case "select none": // subApp.IsSelected = false; // break; case "select only this": if (subApp2 == selectedApp) { subApp2.IsSelected = true; } break; case "select all except this": if (subApp2 != selectedApp) { subApp2.IsSelected = true; } break; default: break; } } } }