@@ -392,16 +392,18 @@ void ShowArtifacts() {
392392}
393393
394394void ShowLicenses () {
395- enum class Products { Self, CompressedEmbed, WIL, FUI, Yoga };
396- constexpr std::array ProductLabels {
397- std::tuple {Products::Self, " OpenKneeboard Fresh Start" },
398- std::tuple {Products::CompressedEmbed, " compressed-embed" },
399- std::tuple {Products::FUI, " FredEmmott::GUI" },
400- std::tuple {Products::WIL, " Windows Implementation Library" },
401- std::tuple {Products::Yoga, " Yoga" },
395+ struct Product {
396+ std::string_view mName ;
397+ std::string_view mLicense ;
402398 };
403399 static const Licenses licenses {};
404- static auto key {Products::Self};
400+ static const std::array Products {
401+ Product {" OpenKneeboard Fresh Start" , licenses.SelfAsStringView ()},
402+ Product {" Compressed-Embed" , licenses.CompressedEmbedAsStringView ()},
403+ Product {" FredEmmott::GUI" , licenses.FUIAsStringView ()},
404+ Product {" Windows Implementation Library" , licenses.WILAsStringView ()},
405+ Product {" Yoga" , licenses.YogaAsStringView ()},
406+ };
405407
406408 const auto layout
407409 = BeginVStackPanel ().Styled (Style ().FlexGrow (1 ).Gap (12 )).Scoped ();
@@ -419,33 +421,15 @@ void ShowLicenses() {
419421 .Body ();
420422 }
421423
422- ComboBox (&key, ProductLabels)
424+ static std::size_t selectedIndex {};
425+ ComboBox (&selectedIndex, Products, &Product::mName )
423426 .Styled (Style ().AlignSelf (YGAlignStretch))
424427 .Caption (" Component" );
425428
426- std::string_view license;
427- switch (key) {
428- case Products::Self:
429- license = licenses.SelfAsStringView ();
430- break ;
431- case Products::CompressedEmbed:
432- license = licenses.CompressedEmbedAsStringView ();
433- break ;
434- case Products::WIL:
435- license = licenses.WILAsStringView ();
436- break ;
437- case Products::FUI:
438- license = licenses.FUIAsStringView ();
439- break ;
440- case Products::Yoga:
441- license = licenses.YogaAsStringView ();
442- break ;
443- }
444-
445429 const auto card = BeginCard ().Scoped ();
446430 const auto scroll
447431 = BeginVScrollView ().Scoped ().Styled (Style ().Width (800 ).Height (600 ));
448- TextBlock (license );
432+ TextBlock (Products. at (selectedIndex). mLicense );
449433}
450434
451435void ShowLicensesButton () {
0 commit comments