public DocumentationLink(DocumentationLinkType type, string url, string?label) { Label = label ?? type.ToString(); Url = url; Type = type; Open = new AnotherCommandImplementation(Execute); }
public MainWindowViewModel(ISnackbarMessageQueue snackbarMessageQueue) { DemoItems = new ObservableCollection <DemoItem>(new[] { new DemoItem( "ホーム", typeof(Home), new[] { new DocumentationLink( DocumentationLinkType.Wiki, $"{ConfigurationManager.AppSettings["GitHub"]}/wiki", "WIKI"), DocumentationLink.DemoPageLink <Home>() } ) }); foreach (var item in GenerateDemoItems(snackbarMessageQueue).OrderBy(i => i.Name)) { DemoItems.Add(item); } _demoItemsView = CollectionViewSource.GetDefaultView(DemoItems); _demoItemsView.Filter = DemoItemsFilter; HomeCommand = new AnotherCommandImplementation(_ => { SelectedIndex = 0; }); MovePrevCommand = new AnotherCommandImplementation( _ => { if (!string.IsNullOrWhiteSpace(SearchKeyword)) { SearchKeyword = string.Empty; } SelectedIndex--; }, _ => SelectedIndex > 0); MoveNextCommand = new AnotherCommandImplementation( _ => { if (!string.IsNullOrWhiteSpace(SearchKeyword)) { SearchKeyword = string.Empty; } SelectedIndex++; }, _ => SelectedIndex < DemoItems.Count - 1); }