From a3ea44977b196444ce94b8ebffeb23c9d65a4f31 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Mon, 9 Dec 2024 15:05:58 -0600 Subject: [PATCH] Windows.UI.Color considered harmful (#196) _targets #192_ Adds our own struct to the API for passing colors around. This is lifted straight out of the Terminal, which had to deal with this quite a lot. Since this color is a struct (so that it trivially marshals across the ABI), it can't be _null_. So we also added `OptionalColor`, which is explicitly "Maybe a color, maybe not". We were bit enough times by trying to have a special secret `INVALID_COLOR` value that it ultimately made sense just to put another bool in there. While I'm touching the SDK and breaking everyone, I figured I'd also do the `s/Loading/IsLoading/g` thing now too. --------- Co-authored-by: Mike Griese --- .../Pages/HackerNewsPage.cs | 9 +- .../MastodonExtensionPage.cs | 13 +- .../Microsoft.CmdPal.Ext.Apps/AllAppsPage.cs | 6 +- .../Pages/PokedexExtensionPage.cs | 847 +++++++++--------- .../ProcessListPage.cs | 2 +- .../Pages/SampleDynamicListPage.cs | 2 +- .../PageViewModel.cs | 10 +- .../TagViewModel.cs | 3 +- .../ExtViews/ListPage.xaml | 2 +- .../WindowsCommandPalette/MainListPage.cs | 11 +- .../WindowsCommandPalette/PageViewModel.cs | 16 +- .../WindowsCommandPalette/TagViewModel.cs | 32 +- .../Views/ListPageViewModel.xaml.cs | 23 +- .../doc/initial-sdk-spec/initial-sdk-spec.md | 45 +- .../ColorHelpers.cs | 16 + .../ListPage.cs | 4 +- .../Page.cs | 10 +- .../Tag.cs | 6 +- .../Microsoft.CmdPal.Extensions.idl | 22 +- 19 files changed, 564 insertions(+), 515 deletions(-) create mode 100644 src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ColorHelpers.cs diff --git a/src/modules/cmdpal/Exts/HackerNewsExtension/Pages/HackerNewsPage.cs b/src/modules/cmdpal/Exts/HackerNewsExtension/Pages/HackerNewsPage.cs index 4687a209d5..509480e353 100644 --- a/src/modules/cmdpal/Exts/HackerNewsExtension/Pages/HackerNewsPage.cs +++ b/src/modules/cmdpal/Exts/HackerNewsExtension/Pages/HackerNewsPage.cs @@ -13,7 +13,6 @@ using HackerNewsExtension.Commands; using HackerNewsExtension.Data; using Microsoft.CmdPal.Extensions; using Microsoft.CmdPal.Extensions.Helpers; -using Windows.UI; namespace HackerNewsExtension; @@ -23,8 +22,8 @@ internal sealed partial class HackerNewsPage : ListPage { Icon = new("https://news.ycombinator.com/favicon.ico"); Name = "Hacker News"; - AccentColor = Color.FromArgb(255, 255, 102, 0); - Loading = true; + AccentColor = ColorHelpers.FromRgb(255, 102, 0); + IsLoading = true; ShowDetails = true; } @@ -54,7 +53,7 @@ internal sealed partial class HackerNewsPage : ListPage { try { - Loading = true; + IsLoading = true; var t = DoGetItems(); t.ConfigureAwait(false); return t.Result; @@ -80,7 +79,7 @@ internal sealed partial class HackerNewsPage : ListPage private async Task DoGetItems() { var items = await GetHackerNewsTopPosts(); - this.Loading = false; + IsLoading = false; var s = items.Select((post) => new ListItem(new LinkCommand(post)) { Title = post.Title, diff --git a/src/modules/cmdpal/Exts/MastodonExtension/MastodonExtensionPage.cs b/src/modules/cmdpal/Exts/MastodonExtension/MastodonExtensionPage.cs index 4d2ac26ebb..030cc8c67a 100644 --- a/src/modules/cmdpal/Exts/MastodonExtension/MastodonExtensionPage.cs +++ b/src/modules/cmdpal/Exts/MastodonExtension/MastodonExtensionPage.cs @@ -14,7 +14,6 @@ using System.Threading.Tasks; using HtmlAgilityPack; using Microsoft.CmdPal.Extensions; using Microsoft.CmdPal.Extensions.Helpers; -using Windows.UI; namespace MastodonExtension; @@ -31,11 +30,11 @@ internal sealed partial class MastodonExtensionPage : ListPage Icon = new("https://mastodon.social/packs/media/icons/android-chrome-36x36-4c61fdb42936428af85afdbf8c6a45a8.png"); Name = "Mastodon"; ShowDetails = true; - HasMore = true; - Loading = true; + HasMoreItems = true; + IsLoading = true; // #6364ff - AccentColor = Color.FromArgb(255, 99, 100, 255); + AccentColor = ColorHelpers.FromRgb(99, 100, 255); } private void AddPosts(List posts) @@ -91,7 +90,7 @@ internal sealed partial class MastodonExtensionPage : ListPage public override void LoadMore() { - this.Loading = true; + this.IsLoading = true; ExtensionHost.LogMessage(new LogMessage() { Message = $"Loading 20 posts, starting with {_items.Count}..." }); var postsAsync = FetchExplorePage(20, this._items.Count); postsAsync.ContinueWith((res) => @@ -100,7 +99,7 @@ internal sealed partial class MastodonExtensionPage : ListPage this.AddPosts(posts); ExtensionHost.LogMessage(new LogMessage() { Message = $"... got {posts.Count} new posts" }); - this.Loading = false; + this.IsLoading = false; this.RaiseItemsChanged(this._items.Count); }).ConfigureAwait(false); } @@ -127,7 +126,7 @@ internal sealed partial class MastodonExtensionPage : ListPage Console.WriteLine($"An error occurred: {e.Message}"); } - Loading = false; + IsLoading = false; return statuses; } diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Apps/AllAppsPage.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Apps/AllAppsPage.cs index 1b6a074d1c..04f93abbba 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Apps/AllAppsPage.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Apps/AllAppsPage.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Linq; using Microsoft.CmdPal.Extensions; using Microsoft.CmdPal.Extensions.Helpers; -using Windows.UI; namespace Microsoft.CmdPal.Ext.Apps.Programs; @@ -20,9 +19,8 @@ public sealed partial class AllAppsPage : ListPage this.Name = "All Apps"; this.Icon = new("\ue71d"); this.ShowDetails = true; - this.Loading = true; + this.IsLoading = true; this.PlaceholderText = "Search installed apps..."; - this.AccentColor = Color.FromArgb(255, 255, 102, 0); } public override IListItem[] GetItems() @@ -30,7 +28,7 @@ public sealed partial class AllAppsPage : ListPage if (this.allAppsSection == null || allAppsSection.Length == 0) { var apps = GetPrograms(); - this.Loading = false; + this.IsLoading = false; this.allAppsSection = apps .Select((app) => new AppListItem(app)) .ToArray(); diff --git a/src/modules/cmdpal/Exts/PokedexExtension/Pages/PokedexExtensionPage.cs b/src/modules/cmdpal/Exts/PokedexExtension/Pages/PokedexExtensionPage.cs index 9851e0735e..48fc2ea85d 100644 --- a/src/modules/cmdpal/Exts/PokedexExtension/Pages/PokedexExtensionPage.cs +++ b/src/modules/cmdpal/Exts/PokedexExtension/Pages/PokedexExtensionPage.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Linq; using Microsoft.CmdPal.Extensions; using Microsoft.CmdPal.Extensions.Helpers; -using Windows.UI; namespace PokedexExtension; @@ -43,403 +42,403 @@ internal sealed partial class PokemonPage : NoOpCommand [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "This is sample code")] internal sealed partial class PokedexExtensionPage : ListPage { - private readonly List _kanto = new() - { - new Pokemon(1, "Bulbasaur", new List { "Grass", "Poison" }), - new Pokemon(2, "Ivysaur", new List { "Grass", "Poison" }), - new Pokemon(3, "Venusaur", new List { "Grass", "Poison" }), - new Pokemon(4, "Charmander", new List { "Fire" }), - new Pokemon(5, "Charmeleon", new List { "Fire" }), - new Pokemon(6, "Charizard", new List { "Fire", "Flying" }), - new Pokemon(7, "Squirtle", new List { "Water" }), - new Pokemon(8, "Wartortle", new List { "Water" }), - new Pokemon(9, "Blastoise", new List { "Water" }), - new Pokemon(10, "Caterpie", new List { "Bug" }), - new Pokemon(11, "Metapod", new List { "Bug" }), - new Pokemon(12, "Butterfree", new List { "Bug", "Flying" }), - new Pokemon(13, "Weedle", new List { "Bug", "Poison" }), - new Pokemon(14, "Kakuna", new List { "Bug", "Poison" }), - new Pokemon(15, "Beedrill", new List { "Bug", "Poison" }), - new Pokemon(16, "Pidgey", new List { "Normal", "Flying" }), - new Pokemon(17, "Pidgeotto", new List { "Normal", "Flying" }), - new Pokemon(18, "Pidgeot", new List { "Normal", "Flying" }), - new Pokemon(19, "Rattata", new List { "Normal" }), - new Pokemon(20, "Raticate", new List { "Normal" }), - new Pokemon(21, "Spearow", new List { "Normal", "Flying" }), - new Pokemon(22, "Fearow", new List { "Normal", "Flying" }), - new Pokemon(23, "Ekans", new List { "Poison" }), - new Pokemon(24, "Arbok", new List { "Poison" }), - new Pokemon(25, "Pikachu", new List { "Electric" }), - new Pokemon(26, "Raichu", new List { "Electric" }), - new Pokemon(27, "Sandshrew", new List { "Ground" }), - new Pokemon(28, "Sandslash", new List { "Ground" }), - new Pokemon(29, "Nidoran♀", new List { "Poison" }), - new Pokemon(30, "Nidorina", new List { "Poison" }), - new Pokemon(31, "Nidoqueen", new List { "Poison", "Ground" }), - new Pokemon(32, "Nidoran♂", new List { "Poison" }), - new Pokemon(33, "Nidorino", new List { "Poison" }), - new Pokemon(34, "Nidoking", new List { "Poison", "Ground" }), - new Pokemon(35, "Clefairy", new List { "Fairy" }), - new Pokemon(36, "Clefable", new List { "Fairy" }), - new Pokemon(37, "Vulpix", new List { "Fire" }), - new Pokemon(38, "Ninetales", new List { "Fire" }), - new Pokemon(39, "Jigglypuff", new List { "Normal", "Fairy" }), - new Pokemon(40, "Wigglytuff", new List { "Normal", "Fairy" }), - new Pokemon(41, "Zubat", new List { "Poison", "Flying" }), - new Pokemon(42, "Golbat", new List { "Poison", "Flying" }), - new Pokemon(43, "Oddish", new List { "Grass", "Poison" }), - new Pokemon(44, "Gloom", new List { "Grass", "Poison" }), - new Pokemon(45, "Vileplume", new List { "Grass", "Poison" }), - new Pokemon(46, "Paras", new List { "Bug", "Grass" }), - new Pokemon(47, "Parasect", new List { "Bug", "Grass" }), - new Pokemon(48, "Venonat", new List { "Bug", "Poison" }), - new Pokemon(49, "Venomoth", new List { "Bug", "Poison" }), - new Pokemon(50, "Diglett", new List { "Ground" }), - new Pokemon(51, "Dugtrio", new List { "Ground" }), - new Pokemon(52, "Meowth", new List { "Normal" }), - new Pokemon(53, "Persian", new List { "Normal" }), - new Pokemon(54, "Psyduck", new List { "Water" }), - new Pokemon(55, "Golduck", new List { "Water" }), - new Pokemon(56, "Mankey", new List { "Fighting" }), - new Pokemon(57, "Primeape", new List { "Fighting" }), - new Pokemon(58, "Growlithe", new List { "Fire" }), - new Pokemon(59, "Arcanine", new List { "Fire" }), - new Pokemon(60, "Poliwag", new List { "Water" }), - new Pokemon(61, "Poliwhirl", new List { "Water" }), - new Pokemon(62, "Poliwrath", new List { "Water", "Fighting" }), - new Pokemon(63, "Abra", new List { "Psychic" }), - new Pokemon(64, "Kadabra", new List { "Psychic" }), - new Pokemon(65, "Alakazam", new List { "Psychic" }), - new Pokemon(66, "Machop", new List { "Fighting" }), - new Pokemon(67, "Machoke", new List { "Fighting" }), - new Pokemon(68, "Machamp", new List { "Fighting" }), - new Pokemon(69, "Bellsprout", new List { "Grass", "Poison" }), - new Pokemon(70, "Weepinbell", new List { "Grass", "Poison" }), - new Pokemon(71, "Victreebel", new List { "Grass", "Poison" }), - new Pokemon(72, "Tentacool", new List { "Water", "Poison" }), - new Pokemon(73, "Tentacruel", new List { "Water", "Poison" }), - new Pokemon(74, "Geodude", new List { "Rock", "Ground" }), - new Pokemon(75, "Graveler", new List { "Rock", "Ground" }), - new Pokemon(76, "Golem", new List { "Rock", "Ground" }), - new Pokemon(77, "Ponyta", new List { "Fire" }), - new Pokemon(78, "Rapidash", new List { "Fire" }), - new Pokemon(79, "Slowpoke", new List { "Water", "Psychic" }), - new Pokemon(80, "Slowbro", new List { "Water", "Psychic" }), - new Pokemon(81, "Magnemite", new List { "Electric", "Steel" }), - new Pokemon(82, "Magneton", new List { "Electric", "Steel" }), - new Pokemon(83, "Farfetch'd", new List { "Normal", "Flying" }), - new Pokemon(84, "Doduo", new List { "Normal", "Flying" }), - new Pokemon(85, "Dodrio", new List { "Normal", "Flying" }), - new Pokemon(86, "Seel", new List { "Water" }), - new Pokemon(87, "Dewgong", new List { "Water", "Ice" }), - new Pokemon(88, "Grimer", new List { "Poison" }), - new Pokemon(89, "Muk", new List { "Poison" }), - new Pokemon(90, "Shellder", new List { "Water" }), - new Pokemon(91, "Cloyster", new List { "Water", "Ice" }), - new Pokemon(92, "Gastly", new List { "Ghost", "Poison" }), - new Pokemon(93, "Haunter", new List { "Ghost", "Poison" }), - new Pokemon(94, "Gengar", new List { "Ghost", "Poison" }), - new Pokemon(95, "Onix", new List { "Rock", "Ground" }), - new Pokemon(96, "Drowzee", new List { "Psychic" }), - new Pokemon(97, "Hypno", new List { "Psychic" }), - new Pokemon(98, "Krabby", new List { "Water" }), - new Pokemon(99, "Kingler", new List { "Water" }), - new Pokemon(100, "Voltorb", new List { "Electric" }), - new Pokemon(101, "Electrode", new List { "Electric" }), - new Pokemon(102, "Exeggcute", new List { "Grass", "Psychic" }), - new Pokemon(103, "Exeggutor", new List { "Grass", "Psychic" }), - new Pokemon(104, "Cubone", new List { "Ground" }), - new Pokemon(105, "Marowak", new List { "Ground" }), - new Pokemon(106, "Hitmonlee", new List { "Fighting" }), - new Pokemon(107, "Hitmonchan", new List { "Fighting" }), - new Pokemon(108, "Lickitung", new List { "Normal" }), - new Pokemon(109, "Koffing", new List { "Poison" }), - new Pokemon(110, "Weezing", new List { "Poison" }), - new Pokemon(111, "Rhyhorn", new List { "Ground", "Rock" }), - new Pokemon(112, "Rhydon", new List { "Ground", "Rock" }), - new Pokemon(113, "Chansey", new List { "Normal" }), - new Pokemon(114, "Tangela", new List { "Grass" }), - new Pokemon(115, "Kangaskhan", new List { "Normal" }), - new Pokemon(116, "Horsea", new List { "Water" }), - new Pokemon(117, "Seadra", new List { "Water" }), - new Pokemon(118, "Goldeen", new List { "Water" }), - new Pokemon(119, "Seaking", new List { "Water" }), - new Pokemon(120, "Staryu", new List { "Water" }), - new Pokemon(121, "Starmie", new List { "Water", "Psychic" }), - new Pokemon(122, "Mr. Mime", new List { "Psychic", "Fairy" }), - new Pokemon(123, "Scyther", new List { "Bug", "Flying" }), - new Pokemon(124, "Jynx", new List { "Ice", "Psychic" }), - new Pokemon(125, "Electabuzz", new List { "Electric" }), - new Pokemon(126, "Magmar", new List { "Fire" }), - new Pokemon(127, "Pinsir", new List { "Bug" }), - new Pokemon(128, "Tauros", new List { "Normal" }), - new Pokemon(129, "Magikarp", new List { "Water" }), - new Pokemon(130, "Gyarados", new List { "Water", "Flying" }), - new Pokemon(131, "Lapras", new List { "Water", "Ice" }), - new Pokemon(132, "Ditto", new List { "Normal" }), - new Pokemon(133, "Eevee", new List { "Normal" }), - new Pokemon(134, "Vaporeon", new List { "Water" }), - new Pokemon(135, "Jolteon", new List { "Electric" }), - new Pokemon(136, "Flareon", new List { "Fire" }), - new Pokemon(137, "Porygon", new List { "Normal" }), - new Pokemon(138, "Omanyte", new List { "Rock", "Water" }), - new Pokemon(139, "Omastar", new List { "Rock", "Water" }), - new Pokemon(140, "Kabuto", new List { "Rock", "Water" }), - new Pokemon(141, "Kabutops", new List { "Rock", "Water" }), - new Pokemon(142, "Aerodactyl", new List { "Rock", "Flying" }), - new Pokemon(143, "Snorlax", new List { "Normal" }), - new Pokemon(144, "Articuno", new List { "Ice", "Flying" }), - new Pokemon(145, "Zapdos", new List { "Electric", "Flying" }), - new Pokemon(146, "Moltres", new List { "Fire", "Flying" }), - new Pokemon(147, "Dratini", new List { "Dragon" }), - new Pokemon(148, "Dragonair", new List { "Dragon" }), - new Pokemon(149, "Dragonite", new List { "Dragon", "Flying" }), - new Pokemon(150, "Mewtwo", new List { "Psychic" }), - new Pokemon(151, "Mew", new List { "Psychic" }), - }; + private readonly List _kanto = + [ + new Pokemon(1, "Bulbasaur", ["Grass", "Poison"]), + new Pokemon(2, "Ivysaur", ["Grass", "Poison"]), + new Pokemon(3, "Venusaur", ["Grass", "Poison"]), + new Pokemon(4, "Charmander", ["Fire"]), + new Pokemon(5, "Charmeleon", ["Fire"]), + new Pokemon(6, "Charizard", ["Fire", "Flying"]), + new Pokemon(7, "Squirtle", ["Water"]), + new Pokemon(8, "Wartortle", ["Water"]), + new Pokemon(9, "Blastoise", ["Water"]), + new Pokemon(10, "Caterpie", ["Bug"]), + new Pokemon(11, "Metapod", ["Bug"]), + new Pokemon(12, "Butterfree", ["Bug", "Flying"]), + new Pokemon(13, "Weedle", ["Bug", "Poison"]), + new Pokemon(14, "Kakuna", ["Bug", "Poison"]), + new Pokemon(15, "Beedrill", ["Bug", "Poison"]), + new Pokemon(16, "Pidgey", ["Normal", "Flying"]), + new Pokemon(17, "Pidgeotto", ["Normal", "Flying"]), + new Pokemon(18, "Pidgeot", ["Normal", "Flying"]), + new Pokemon(19, "Rattata", ["Normal"]), + new Pokemon(20, "Raticate", ["Normal"]), + new Pokemon(21, "Spearow", ["Normal", "Flying"]), + new Pokemon(22, "Fearow", ["Normal", "Flying"]), + new Pokemon(23, "Ekans", ["Poison"]), + new Pokemon(24, "Arbok", ["Poison"]), + new Pokemon(25, "Pikachu", ["Electric"]), + new Pokemon(26, "Raichu", ["Electric"]), + new Pokemon(27, "Sandshrew", ["Ground"]), + new Pokemon(28, "Sandslash", ["Ground"]), + new Pokemon(29, "Nidoran♀", ["Poison"]), + new Pokemon(30, "Nidorina", ["Poison"]), + new Pokemon(31, "Nidoqueen", ["Poison", "Ground"]), + new Pokemon(32, "Nidoran♂", ["Poison"]), + new Pokemon(33, "Nidorino", ["Poison"]), + new Pokemon(34, "Nidoking", ["Poison", "Ground"]), + new Pokemon(35, "Clefairy", ["Fairy"]), + new Pokemon(36, "Clefable", ["Fairy"]), + new Pokemon(37, "Vulpix", ["Fire"]), + new Pokemon(38, "Ninetales", ["Fire"]), + new Pokemon(39, "Jigglypuff", ["Normal", "Fairy"]), + new Pokemon(40, "Wigglytuff", ["Normal", "Fairy"]), + new Pokemon(41, "Zubat", ["Poison", "Flying"]), + new Pokemon(42, "Golbat", ["Poison", "Flying"]), + new Pokemon(43, "Oddish", ["Grass", "Poison"]), + new Pokemon(44, "Gloom", ["Grass", "Poison"]), + new Pokemon(45, "Vileplume", ["Grass", "Poison"]), + new Pokemon(46, "Paras", ["Bug", "Grass"]), + new Pokemon(47, "Parasect", ["Bug", "Grass"]), + new Pokemon(48, "Venonat", ["Bug", "Poison"]), + new Pokemon(49, "Venomoth", ["Bug", "Poison"]), + new Pokemon(50, "Diglett", ["Ground"]), + new Pokemon(51, "Dugtrio", ["Ground"]), + new Pokemon(52, "Meowth", ["Normal"]), + new Pokemon(53, "Persian", ["Normal"]), + new Pokemon(54, "Psyduck", ["Water"]), + new Pokemon(55, "Golduck", ["Water"]), + new Pokemon(56, "Mankey", ["Fighting"]), + new Pokemon(57, "Primeape", ["Fighting"]), + new Pokemon(58, "Growlithe", ["Fire"]), + new Pokemon(59, "Arcanine", ["Fire"]), + new Pokemon(60, "Poliwag", ["Water"]), + new Pokemon(61, "Poliwhirl", ["Water"]), + new Pokemon(62, "Poliwrath", ["Water", "Fighting"]), + new Pokemon(63, "Abra", ["Psychic"]), + new Pokemon(64, "Kadabra", ["Psychic"]), + new Pokemon(65, "Alakazam", ["Psychic"]), + new Pokemon(66, "Machop", ["Fighting"]), + new Pokemon(67, "Machoke", ["Fighting"]), + new Pokemon(68, "Machamp", ["Fighting"]), + new Pokemon(69, "Bellsprout", ["Grass", "Poison"]), + new Pokemon(70, "Weepinbell", ["Grass", "Poison"]), + new Pokemon(71, "Victreebel", ["Grass", "Poison"]), + new Pokemon(72, "Tentacool", ["Water", "Poison"]), + new Pokemon(73, "Tentacruel", ["Water", "Poison"]), + new Pokemon(74, "Geodude", ["Rock", "Ground"]), + new Pokemon(75, "Graveler", ["Rock", "Ground"]), + new Pokemon(76, "Golem", ["Rock", "Ground"]), + new Pokemon(77, "Ponyta", ["Fire"]), + new Pokemon(78, "Rapidash", ["Fire"]), + new Pokemon(79, "Slowpoke", ["Water", "Psychic"]), + new Pokemon(80, "Slowbro", ["Water", "Psychic"]), + new Pokemon(81, "Magnemite", ["Electric", "Steel"]), + new Pokemon(82, "Magneton", ["Electric", "Steel"]), + new Pokemon(83, "Farfetch'd", ["Normal", "Flying"]), + new Pokemon(84, "Doduo", ["Normal", "Flying"]), + new Pokemon(85, "Dodrio", ["Normal", "Flying"]), + new Pokemon(86, "Seel", ["Water"]), + new Pokemon(87, "Dewgong", ["Water", "Ice"]), + new Pokemon(88, "Grimer", ["Poison"]), + new Pokemon(89, "Muk", ["Poison"]), + new Pokemon(90, "Shellder", ["Water"]), + new Pokemon(91, "Cloyster", ["Water", "Ice"]), + new Pokemon(92, "Gastly", ["Ghost", "Poison"]), + new Pokemon(93, "Haunter", ["Ghost", "Poison"]), + new Pokemon(94, "Gengar", ["Ghost", "Poison"]), + new Pokemon(95, "Onix", ["Rock", "Ground"]), + new Pokemon(96, "Drowzee", ["Psychic"]), + new Pokemon(97, "Hypno", ["Psychic"]), + new Pokemon(98, "Krabby", ["Water"]), + new Pokemon(99, "Kingler", ["Water"]), + new Pokemon(100, "Voltorb", ["Electric"]), + new Pokemon(101, "Electrode", ["Electric"]), + new Pokemon(102, "Exeggcute", ["Grass", "Psychic"]), + new Pokemon(103, "Exeggutor", ["Grass", "Psychic"]), + new Pokemon(104, "Cubone", ["Ground"]), + new Pokemon(105, "Marowak", ["Ground"]), + new Pokemon(106, "Hitmonlee", ["Fighting"]), + new Pokemon(107, "Hitmonchan", ["Fighting"]), + new Pokemon(108, "Lickitung", ["Normal"]), + new Pokemon(109, "Koffing", ["Poison"]), + new Pokemon(110, "Weezing", ["Poison"]), + new Pokemon(111, "Rhyhorn", ["Ground", "Rock"]), + new Pokemon(112, "Rhydon", ["Ground", "Rock"]), + new Pokemon(113, "Chansey", ["Normal"]), + new Pokemon(114, "Tangela", ["Grass"]), + new Pokemon(115, "Kangaskhan", ["Normal"]), + new Pokemon(116, "Horsea", ["Water"]), + new Pokemon(117, "Seadra", ["Water"]), + new Pokemon(118, "Goldeen", ["Water"]), + new Pokemon(119, "Seaking", ["Water"]), + new Pokemon(120, "Staryu", ["Water"]), + new Pokemon(121, "Starmie", ["Water", "Psychic"]), + new Pokemon(122, "Mr. Mime", ["Psychic", "Fairy"]), + new Pokemon(123, "Scyther", ["Bug", "Flying"]), + new Pokemon(124, "Jynx", ["Ice", "Psychic"]), + new Pokemon(125, "Electabuzz", ["Electric"]), + new Pokemon(126, "Magmar", ["Fire"]), + new Pokemon(127, "Pinsir", ["Bug"]), + new Pokemon(128, "Tauros", ["Normal"]), + new Pokemon(129, "Magikarp", ["Water"]), + new Pokemon(130, "Gyarados", ["Water", "Flying"]), + new Pokemon(131, "Lapras", ["Water", "Ice"]), + new Pokemon(132, "Ditto", ["Normal"]), + new Pokemon(133, "Eevee", ["Normal"]), + new Pokemon(134, "Vaporeon", ["Water"]), + new Pokemon(135, "Jolteon", ["Electric"]), + new Pokemon(136, "Flareon", ["Fire"]), + new Pokemon(137, "Porygon", ["Normal"]), + new Pokemon(138, "Omanyte", ["Rock", "Water"]), + new Pokemon(139, "Omastar", ["Rock", "Water"]), + new Pokemon(140, "Kabuto", ["Rock", "Water"]), + new Pokemon(141, "Kabutops", ["Rock", "Water"]), + new Pokemon(142, "Aerodactyl", ["Rock", "Flying"]), + new Pokemon(143, "Snorlax", ["Normal"]), + new Pokemon(144, "Articuno", ["Ice", "Flying"]), + new Pokemon(145, "Zapdos", ["Electric", "Flying"]), + new Pokemon(146, "Moltres", ["Fire", "Flying"]), + new Pokemon(147, "Dratini", ["Dragon"]), + new Pokemon(148, "Dragonair", ["Dragon"]), + new Pokemon(149, "Dragonite", ["Dragon", "Flying"]), + new Pokemon(150, "Mewtwo", ["Psychic"]), + new Pokemon(151, "Mew", ["Psychic"]), + ]; - private readonly List _johto = new() - { - new Pokemon(152, "Chikorita", new List { "Grass" }), - new Pokemon(153, "Bayleef", new List { "Grass" }), - new Pokemon(154, "Meganium", new List { "Grass" }), - new Pokemon(155, "Cyndaquil", new List { "Fire" }), - new Pokemon(156, "Quilava", new List { "Fire" }), - new Pokemon(157, "Typhlosion", new List { "Fire" }), - new Pokemon(158, "Totodile", new List { "Water" }), - new Pokemon(159, "Croconaw", new List { "Water" }), - new Pokemon(160, "Feraligatr", new List { "Water" }), - new Pokemon(161, "Sentret", new List { "Normal" }), - new Pokemon(162, "Furret", new List { "Normal" }), - new Pokemon(163, "Hoothoot", new List { "Normal", "Flying" }), - new Pokemon(164, "Noctowl", new List { "Normal", "Flying" }), - new Pokemon(165, "Ledyba", new List { "Bug", "Flying" }), - new Pokemon(166, "Ledian", new List { "Bug", "Flying" }), - new Pokemon(167, "Spinarak", new List { "Bug", "Poison" }), - new Pokemon(168, "Ariados", new List { "Bug", "Poison" }), - new Pokemon(169, "Crobat", new List { "Poison", "Flying" }), - new Pokemon(170, "Chinchou", new List { "Water", "Electric" }), - new Pokemon(171, "Lanturn", new List { "Water", "Electric" }), - new Pokemon(172, "Pichu", new List { "Electric" }), - new Pokemon(173, "Cleffa", new List { "Fairy" }), - new Pokemon(174, "Igglybuff", new List { "Normal", "Fairy" }), - new Pokemon(175, "Togepi", new List { "Fairy" }), - new Pokemon(176, "Togetic", new List { "Fairy", "Flying" }), - new Pokemon(177, "Natu", new List { "Psychic", "Flying" }), - new Pokemon(178, "Xatu", new List { "Psychic", "Flying" }), - new Pokemon(179, "Mareep", new List { "Electric" }), - new Pokemon(180, "Flaaffy", new List { "Electric" }), - new Pokemon(181, "Ampharos", new List { "Electric" }), - new Pokemon(182, "Bellossom", new List { "Grass" }), - new Pokemon(183, "Marill", new List { "Water", "Fairy" }), - new Pokemon(184, "Azumarill", new List { "Water", "Fairy" }), - new Pokemon(185, "Sudowoodo", new List { "Rock" }), - new Pokemon(186, "Politoed", new List { "Water" }), - new Pokemon(187, "Hoppip", new List { "Grass", "Flying" }), - new Pokemon(188, "Skiploom", new List { "Grass", "Flying" }), - new Pokemon(189, "Jumpluff", new List { "Grass", "Flying" }), - new Pokemon(190, "Aipom", new List { "Normal" }), - new Pokemon(191, "Sunkern", new List { "Grass" }), - new Pokemon(192, "Sunflora", new List { "Grass" }), - new Pokemon(193, "Yanma", new List { "Bug", "Flying" }), - new Pokemon(194, "Wooper", new List { "Water", "Ground" }), - new Pokemon(195, "Quagsire", new List { "Water", "Ground" }), - new Pokemon(196, "Espeon", new List { "Psychic" }), - new Pokemon(197, "Umbreon", new List { "Dark" }), - new Pokemon(198, "Murkrow", new List { "Dark", "Flying" }), - new Pokemon(199, "Slowking", new List { "Water", "Psychic" }), - new Pokemon(200, "Misdreavus", new List { "Ghost" }), - new Pokemon(201, "Unown", new List { "Psychic" }), - new Pokemon(202, "Wobbuffet", new List { "Psychic" }), - new Pokemon(203, "Girafarig", new List { "Normal", "Psychic" }), - new Pokemon(204, "Pineco", new List { "Bug" }), - new Pokemon(205, "Forretress", new List { "Bug", "Steel" }), - new Pokemon(206, "Dunsparce", new List { "Normal" }), - new Pokemon(207, "Gligar", new List { "Ground", "Flying" }), - new Pokemon(208, "Steelix", new List { "Steel", "Ground" }), - new Pokemon(209, "Snubbull", new List { "Fairy" }), - new Pokemon(210, "Granbull", new List { "Fairy" }), - new Pokemon(211, "Qwilfish", new List { "Water", "Poison" }), - new Pokemon(212, "Scizor", new List { "Bug", "Steel" }), - new Pokemon(213, "Shuckle", new List { "Bug", "Rock" }), - new Pokemon(214, "Heracross", new List { "Bug", "Fighting" }), - new Pokemon(215, "Sneasel", new List { "Dark", "Ice" }), - new Pokemon(216, "Teddiursa", new List { "Normal" }), - new Pokemon(217, "Ursaring", new List { "Normal" }), - new Pokemon(218, "Slugma", new List { "Fire" }), - new Pokemon(219, "Magcargo", new List { "Fire", "Rock" }), - new Pokemon(220, "Swinub", new List { "Ice", "Ground" }), - new Pokemon(221, "Piloswine", new List { "Ice", "Ground" }), - new Pokemon(222, "Corsola", new List { "Water", "Rock" }), - new Pokemon(223, "Remoraid", new List { "Water" }), - new Pokemon(224, "Octillery", new List { "Water" }), - new Pokemon(225, "Delibird", new List { "Ice", "Flying" }), - new Pokemon(226, "Mantine", new List { "Water", "Flying" }), - new Pokemon(227, "Skarmory", new List { "Steel", "Flying" }), - new Pokemon(228, "Houndour", new List { "Dark", "Fire" }), - new Pokemon(229, "Houndoom", new List { "Dark", "Fire" }), - new Pokemon(230, "Kingdra", new List { "Water", "Dragon" }), - new Pokemon(231, "Phanpy", new List { "Ground" }), - new Pokemon(232, "Donphan", new List { "Ground" }), - new Pokemon(233, "Porygon2", new List { "Normal" }), - new Pokemon(234, "Stantler", new List { "Normal" }), - new Pokemon(235, "Smeargle", new List { "Normal" }), - new Pokemon(236, "Tyrogue", new List { "Fighting" }), - new Pokemon(237, "Hitmontop", new List { "Fighting" }), - new Pokemon(238, "Smoochum", new List { "Ice", "Psychic" }), - new Pokemon(239, "Elekid", new List { "Electric" }), - new Pokemon(240, "Magby", new List { "Fire" }), - new Pokemon(241, "Miltank", new List { "Normal" }), - new Pokemon(242, "Blissey", new List { "Normal" }), - new Pokemon(243, "Raikou", new List { "Electric" }), - new Pokemon(244, "Entei", new List { "Fire" }), - new Pokemon(245, "Suicune", new List { "Water" }), - new Pokemon(246, "Larvitar", new List { "Rock", "Ground" }), - new Pokemon(247, "Pupitar", new List { "Rock", "Ground" }), - new Pokemon(248, "Tyranitar", new List { "Rock", "Dark" }), - new Pokemon(249, "Lugia", new List { "Psychic", "Flying" }), - new Pokemon(250, "Ho-Oh", new List { "Fire", "Flying" }), - new Pokemon(251, "Celebi", new List { "Psychic", "Grass" }), - }; + private readonly List _johto = + [ + new Pokemon(152, "Chikorita", ["Grass"]), + new Pokemon(153, "Bayleef", ["Grass"]), + new Pokemon(154, "Meganium", ["Grass"]), + new Pokemon(155, "Cyndaquil", ["Fire"]), + new Pokemon(156, "Quilava", ["Fire"]), + new Pokemon(157, "Typhlosion", ["Fire"]), + new Pokemon(158, "Totodile", ["Water"]), + new Pokemon(159, "Croconaw", ["Water"]), + new Pokemon(160, "Feraligatr", ["Water"]), + new Pokemon(161, "Sentret", ["Normal"]), + new Pokemon(162, "Furret", ["Normal"]), + new Pokemon(163, "Hoothoot", ["Normal", "Flying"]), + new Pokemon(164, "Noctowl", ["Normal", "Flying"]), + new Pokemon(165, "Ledyba", ["Bug", "Flying"]), + new Pokemon(166, "Ledian", ["Bug", "Flying"]), + new Pokemon(167, "Spinarak", ["Bug", "Poison"]), + new Pokemon(168, "Ariados", ["Bug", "Poison"]), + new Pokemon(169, "Crobat", ["Poison", "Flying"]), + new Pokemon(170, "Chinchou", ["Water", "Electric"]), + new Pokemon(171, "Lanturn", ["Water", "Electric"]), + new Pokemon(172, "Pichu", ["Electric"]), + new Pokemon(173, "Cleffa", ["Fairy"]), + new Pokemon(174, "Igglybuff", ["Normal", "Fairy"]), + new Pokemon(175, "Togepi", ["Fairy"]), + new Pokemon(176, "Togetic", ["Fairy", "Flying"]), + new Pokemon(177, "Natu", ["Psychic", "Flying"]), + new Pokemon(178, "Xatu", ["Psychic", "Flying"]), + new Pokemon(179, "Mareep", ["Electric"]), + new Pokemon(180, "Flaaffy", ["Electric"]), + new Pokemon(181, "Ampharos", ["Electric"]), + new Pokemon(182, "Bellossom", ["Grass"]), + new Pokemon(183, "Marill", ["Water", "Fairy"]), + new Pokemon(184, "Azumarill", ["Water", "Fairy"]), + new Pokemon(185, "Sudowoodo", ["Rock"]), + new Pokemon(186, "Politoed", ["Water"]), + new Pokemon(187, "Hoppip", ["Grass", "Flying"]), + new Pokemon(188, "Skiploom", ["Grass", "Flying"]), + new Pokemon(189, "Jumpluff", ["Grass", "Flying"]), + new Pokemon(190, "Aipom", ["Normal"]), + new Pokemon(191, "Sunkern", ["Grass"]), + new Pokemon(192, "Sunflora", ["Grass"]), + new Pokemon(193, "Yanma", ["Bug", "Flying"]), + new Pokemon(194, "Wooper", ["Water", "Ground"]), + new Pokemon(195, "Quagsire", ["Water", "Ground"]), + new Pokemon(196, "Espeon", ["Psychic"]), + new Pokemon(197, "Umbreon", ["Dark"]), + new Pokemon(198, "Murkrow", ["Dark", "Flying"]), + new Pokemon(199, "Slowking", ["Water", "Psychic"]), + new Pokemon(200, "Misdreavus", ["Ghost"]), + new Pokemon(201, "Unown", ["Psychic"]), + new Pokemon(202, "Wobbuffet", ["Psychic"]), + new Pokemon(203, "Girafarig", ["Normal", "Psychic"]), + new Pokemon(204, "Pineco", ["Bug"]), + new Pokemon(205, "Forretress", ["Bug", "Steel"]), + new Pokemon(206, "Dunsparce", ["Normal"]), + new Pokemon(207, "Gligar", ["Ground", "Flying"]), + new Pokemon(208, "Steelix", ["Steel", "Ground"]), + new Pokemon(209, "Snubbull", ["Fairy"]), + new Pokemon(210, "Granbull", ["Fairy"]), + new Pokemon(211, "Qwilfish", ["Water", "Poison"]), + new Pokemon(212, "Scizor", ["Bug", "Steel"]), + new Pokemon(213, "Shuckle", ["Bug", "Rock"]), + new Pokemon(214, "Heracross", ["Bug", "Fighting"]), + new Pokemon(215, "Sneasel", ["Dark", "Ice"]), + new Pokemon(216, "Teddiursa", ["Normal"]), + new Pokemon(217, "Ursaring", ["Normal"]), + new Pokemon(218, "Slugma", ["Fire"]), + new Pokemon(219, "Magcargo", ["Fire", "Rock"]), + new Pokemon(220, "Swinub", ["Ice", "Ground"]), + new Pokemon(221, "Piloswine", ["Ice", "Ground"]), + new Pokemon(222, "Corsola", ["Water", "Rock"]), + new Pokemon(223, "Remoraid", ["Water"]), + new Pokemon(224, "Octillery", ["Water"]), + new Pokemon(225, "Delibird", ["Ice", "Flying"]), + new Pokemon(226, "Mantine", ["Water", "Flying"]), + new Pokemon(227, "Skarmory", ["Steel", "Flying"]), + new Pokemon(228, "Houndour", ["Dark", "Fire"]), + new Pokemon(229, "Houndoom", ["Dark", "Fire"]), + new Pokemon(230, "Kingdra", ["Water", "Dragon"]), + new Pokemon(231, "Phanpy", ["Ground"]), + new Pokemon(232, "Donphan", ["Ground"]), + new Pokemon(233, "Porygon2", ["Normal"]), + new Pokemon(234, "Stantler", ["Normal"]), + new Pokemon(235, "Smeargle", ["Normal"]), + new Pokemon(236, "Tyrogue", ["Fighting"]), + new Pokemon(237, "Hitmontop", ["Fighting"]), + new Pokemon(238, "Smoochum", ["Ice", "Psychic"]), + new Pokemon(239, "Elekid", ["Electric"]), + new Pokemon(240, "Magby", ["Fire"]), + new Pokemon(241, "Miltank", ["Normal"]), + new Pokemon(242, "Blissey", ["Normal"]), + new Pokemon(243, "Raikou", ["Electric"]), + new Pokemon(244, "Entei", ["Fire"]), + new Pokemon(245, "Suicune", ["Water"]), + new Pokemon(246, "Larvitar", ["Rock", "Ground"]), + new Pokemon(247, "Pupitar", ["Rock", "Ground"]), + new Pokemon(248, "Tyranitar", ["Rock", "Dark"]), + new Pokemon(249, "Lugia", ["Psychic", "Flying"]), + new Pokemon(250, "Ho-Oh", ["Fire", "Flying"]), + new Pokemon(251, "Celebi", ["Psychic", "Grass"]), + ]; - private readonly List _hoenn = new() - { - new Pokemon(252, "Treecko", new List { "Grass" }), - new Pokemon(253, "Grovyle", new List { "Grass" }), - new Pokemon(254, "Sceptile", new List { "Grass" }), - new Pokemon(255, "Torchic", new List { "Fire" }), - new Pokemon(256, "Combusken", new List { "Fire", "Fighting" }), - new Pokemon(257, "Blaziken", new List { "Fire", "Fighting" }), - new Pokemon(258, "Mudkip", new List { "Water" }), - new Pokemon(259, "Marshtomp", new List { "Water", "Ground" }), - new Pokemon(260, "Swampert", new List { "Water", "Ground" }), - new Pokemon(261, "Poochyena", new List { "Dark" }), - new Pokemon(262, "Mightyena", new List { "Dark" }), - new Pokemon(263, "Zigzagoon", new List { "Normal" }), - new Pokemon(264, "Linoone", new List { "Normal" }), - new Pokemon(265, "Wurmple", new List { "Bug" }), - new Pokemon(266, "Silcoon", new List { "Bug" }), - new Pokemon(267, "Beautifly", new List { "Bug", "Flying" }), - new Pokemon(268, "Cascoon", new List { "Bug" }), - new Pokemon(269, "Dustox", new List { "Bug", "Poison" }), - new Pokemon(270, "Lotad", new List { "Water", "Grass" }), - new Pokemon(271, "Lombre", new List { "Water", "Grass" }), - new Pokemon(272, "Ludicolo", new List { "Water", "Grass" }), - new Pokemon(273, "Seedot", new List { "Grass" }), - new Pokemon(274, "Nuzleaf", new List { "Grass", "Dark" }), - new Pokemon(275, "Shiftry", new List { "Grass", "Dark" }), - new Pokemon(276, "Taillow", new List { "Normal", "Flying" }), - new Pokemon(277, "Swellow", new List { "Normal", "Flying" }), - new Pokemon(278, "Wingull", new List { "Water", "Flying" }), - new Pokemon(279, "Pelipper", new List { "Water", "Flying" }), - new Pokemon(280, "Ralts", new List { "Psychic", "Fairy" }), - new Pokemon(281, "Kirlia", new List { "Psychic", "Fairy" }), - new Pokemon(282, "Gardevoir", new List { "Psychic", "Fairy" }), - new Pokemon(283, "Surskit", new List { "Bug", "Water" }), - new Pokemon(284, "Masquerain", new List { "Bug", "Flying" }), - new Pokemon(285, "Shroomish", new List { "Grass" }), - new Pokemon(286, "Breloom", new List { "Grass", "Fighting" }), - new Pokemon(287, "Slakoth", new List { "Normal" }), - new Pokemon(288, "Vigoroth", new List { "Normal" }), - new Pokemon(289, "Slaking", new List { "Normal" }), - new Pokemon(290, "Nincada", new List { "Bug", "Ground" }), - new Pokemon(291, "Ninjask", new List { "Bug", "Flying" }), - new Pokemon(292, "Shedinja", new List { "Bug", "Ghost" }), - new Pokemon(293, "Whismur", new List { "Normal" }), - new Pokemon(294, "Loudred", new List { "Normal" }), - new Pokemon(295, "Exploud", new List { "Normal" }), - new Pokemon(296, "Makuhita", new List { "Fighting" }), - new Pokemon(297, "Hariyama", new List { "Fighting" }), - new Pokemon(298, "Azurill", new List { "Normal", "Fairy" }), - new Pokemon(299, "Nosepass", new List { "Rock" }), - new Pokemon(300, "Skitty", new List { "Normal" }), - new Pokemon(301, "Delcatty", new List { "Normal" }), - new Pokemon(302, "Sableye", new List { "Dark", "Ghost" }), - new Pokemon(303, "Mawile", new List { "Steel", "Fairy" }), - new Pokemon(304, "Aron", new List { "Steel", "Rock" }), - new Pokemon(305, "Lairon", new List { "Steel", "Rock" }), - new Pokemon(306, "Aggron", new List { "Steel", "Rock" }), - new Pokemon(307, "Meditite", new List { "Fighting", "Psychic" }), - new Pokemon(308, "Medicham", new List { "Fighting", "Psychic" }), - new Pokemon(309, "Electrike", new List { "Electric" }), - new Pokemon(310, "Manectric", new List { "Electric" }), - new Pokemon(311, "Plusle", new List { "Electric" }), - new Pokemon(312, "Minun", new List { "Electric" }), - new Pokemon(313, "Volbeat", new List { "Bug" }), - new Pokemon(314, "Illumise", new List { "Bug" }), - new Pokemon(315, "Roselia", new List { "Grass", "Poison" }), - new Pokemon(316, "Gulpin", new List { "Poison" }), - new Pokemon(317, "Swalot", new List { "Poison" }), - new Pokemon(318, "Carvanha", new List { "Water", "Dark" }), - new Pokemon(319, "Sharpedo", new List { "Water", "Dark" }), - new Pokemon(320, "Wailmer", new List { "Water" }), - new Pokemon(321, "Wailord", new List { "Water" }), - new Pokemon(322, "Numel", new List { "Fire", "Ground" }), - new Pokemon(323, "Camerupt", new List { "Fire", "Ground" }), - new Pokemon(324, "Torkoal", new List { "Fire" }), - new Pokemon(325, "Spoink", new List { "Psychic" }), - new Pokemon(326, "Grumpig", new List { "Psychic" }), - new Pokemon(327, "Spinda", new List { "Normal" }), - new Pokemon(328, "Trapinch", new List { "Ground" }), - new Pokemon(329, "Vibrava", new List { "Ground", "Dragon" }), - new Pokemon(330, "Flygon", new List { "Ground", "Dragon" }), - new Pokemon(331, "Cacnea", new List { "Grass" }), - new Pokemon(332, "Cacturne", new List { "Grass", "Dark" }), - new Pokemon(333, "Swablu", new List { "Normal", "Flying" }), - new Pokemon(334, "Altaria", new List { "Dragon", "Flying" }), - new Pokemon(335, "Zangoose", new List { "Normal" }), - new Pokemon(336, "Seviper", new List { "Poison" }), - new Pokemon(337, "Lunatone", new List { "Rock", "Psychic" }), - new Pokemon(338, "Solrock", new List { "Rock", "Psychic" }), - new Pokemon(339, "Barboach", new List { "Water", "Ground" }), - new Pokemon(340, "Whiscash", new List { "Water", "Ground" }), - new Pokemon(341, "Corphish", new List { "Water" }), - new Pokemon(342, "Crawdaunt", new List { "Water", "Dark" }), - new Pokemon(343, "Baltoy", new List { "Ground", "Psychic" }), - new Pokemon(344, "Claydol", new List { "Ground", "Psychic" }), - new Pokemon(345, "Lileep", new List { "Rock", "Grass" }), - new Pokemon(346, "Cradily", new List { "Rock", "Grass" }), - new Pokemon(347, "Anorith", new List { "Rock", "Bug" }), - new Pokemon(348, "Armaldo", new List { "Rock", "Bug" }), - new Pokemon(349, "Feebas", new List { "Water" }), - new Pokemon(350, "Milotic", new List { "Water" }), - new Pokemon(351, "Castform", new List { "Normal" }), - new Pokemon(352, "Kecleon", new List { "Normal" }), - new Pokemon(353, "Shuppet", new List { "Ghost" }), - new Pokemon(354, "Banette", new List { "Ghost" }), - new Pokemon(355, "Duskull", new List { "Ghost" }), - new Pokemon(356, "Dusclops", new List { "Ghost" }), - new Pokemon(357, "Tropius", new List { "Grass", "Flying" }), - new Pokemon(358, "Chimecho", new List { "Psychic" }), - new Pokemon(359, "Absol", new List { "Dark" }), - new Pokemon(360, "Wynaut", new List { "Psychic" }), - new Pokemon(361, "Snorunt", new List { "Ice" }), - new Pokemon(362, "Glalie", new List { "Ice" }), - new Pokemon(363, "Spheal", new List { "Ice", "Water" }), - new Pokemon(364, "Sealeo", new List { "Ice", "Water" }), - new Pokemon(365, "Walrein", new List { "Ice", "Water" }), - new Pokemon(366, "Clamperl", new List { "Water" }), - new Pokemon(367, "Huntail", new List { "Water" }), - new Pokemon(368, "Gorebyss", new List { "Water" }), - new Pokemon(369, "Relicanth", new List { "Water", "Rock" }), - new Pokemon(370, "Luvdisc", new List { "Water" }), - new Pokemon(371, "Bagon", new List { "Dragon" }), - new Pokemon(372, "Shelgon", new List { "Dragon" }), - new Pokemon(373, "Salamence", new List { "Dragon", "Flying" }), - new Pokemon(374, "Beldum", new List { "Steel", "Psychic" }), - new Pokemon(375, "Metang", new List { "Steel", "Psychic" }), - new Pokemon(376, "Metagross", new List { "Steel", "Psychic" }), - new Pokemon(377, "Regirock", new List { "Rock" }), - new Pokemon(378, "Regice", new List { "Ice" }), - new Pokemon(379, "Registeel", new List { "Steel" }), - new Pokemon(380, "Latias", new List { "Dragon", "Psychic" }), - new Pokemon(381, "Latios", new List { "Dragon", "Psychic" }), - new Pokemon(382, "Kyogre", new List { "Water" }), - new Pokemon(383, "Groudon", new List { "Ground" }), - new Pokemon(384, "Rayquaza", new List { "Dragon", "Flying" }), - new Pokemon(385, "Jirachi", new List { "Steel", "Psychic" }), - new Pokemon(386, "Deoxys", new List { "Psychic" }), - }; + private readonly List _hoenn = + [ + new Pokemon(252, "Treecko", ["Grass"]), + new Pokemon(253, "Grovyle", ["Grass"]), + new Pokemon(254, "Sceptile", ["Grass"]), + new Pokemon(255, "Torchic", ["Fire"]), + new Pokemon(256, "Combusken", ["Fire", "Fighting"]), + new Pokemon(257, "Blaziken", ["Fire", "Fighting"]), + new Pokemon(258, "Mudkip", ["Water"]), + new Pokemon(259, "Marshtomp", ["Water", "Ground"]), + new Pokemon(260, "Swampert", ["Water", "Ground"]), + new Pokemon(261, "Poochyena", ["Dark"]), + new Pokemon(262, "Mightyena", ["Dark"]), + new Pokemon(263, "Zigzagoon", ["Normal"]), + new Pokemon(264, "Linoone", ["Normal"]), + new Pokemon(265, "Wurmple", ["Bug"]), + new Pokemon(266, "Silcoon", ["Bug"]), + new Pokemon(267, "Beautifly", ["Bug", "Flying"]), + new Pokemon(268, "Cascoon", ["Bug"]), + new Pokemon(269, "Dustox", ["Bug", "Poison"]), + new Pokemon(270, "Lotad", ["Water", "Grass"]), + new Pokemon(271, "Lombre", ["Water", "Grass"]), + new Pokemon(272, "Ludicolo", ["Water", "Grass"]), + new Pokemon(273, "Seedot", ["Grass"]), + new Pokemon(274, "Nuzleaf", ["Grass", "Dark"]), + new Pokemon(275, "Shiftry", ["Grass", "Dark"]), + new Pokemon(276, "Taillow", ["Normal", "Flying"]), + new Pokemon(277, "Swellow", ["Normal", "Flying"]), + new Pokemon(278, "Wingull", ["Water", "Flying"]), + new Pokemon(279, "Pelipper", ["Water", "Flying"]), + new Pokemon(280, "Ralts", ["Psychic", "Fairy"]), + new Pokemon(281, "Kirlia", ["Psychic", "Fairy"]), + new Pokemon(282, "Gardevoir", ["Psychic", "Fairy"]), + new Pokemon(283, "Surskit", ["Bug", "Water"]), + new Pokemon(284, "Masquerain", ["Bug", "Flying"]), + new Pokemon(285, "Shroomish", ["Grass"]), + new Pokemon(286, "Breloom", ["Grass", "Fighting"]), + new Pokemon(287, "Slakoth", ["Normal"]), + new Pokemon(288, "Vigoroth", ["Normal"]), + new Pokemon(289, "Slaking", ["Normal"]), + new Pokemon(290, "Nincada", ["Bug", "Ground"]), + new Pokemon(291, "Ninjask", ["Bug", "Flying"]), + new Pokemon(292, "Shedinja", ["Bug", "Ghost"]), + new Pokemon(293, "Whismur", ["Normal"]), + new Pokemon(294, "Loudred", ["Normal"]), + new Pokemon(295, "Exploud", ["Normal"]), + new Pokemon(296, "Makuhita", ["Fighting"]), + new Pokemon(297, "Hariyama", ["Fighting"]), + new Pokemon(298, "Azurill", ["Normal", "Fairy"]), + new Pokemon(299, "Nosepass", ["Rock"]), + new Pokemon(300, "Skitty", ["Normal"]), + new Pokemon(301, "Delcatty", ["Normal"]), + new Pokemon(302, "Sableye", ["Dark", "Ghost"]), + new Pokemon(303, "Mawile", ["Steel", "Fairy"]), + new Pokemon(304, "Aron", ["Steel", "Rock"]), + new Pokemon(305, "Lairon", ["Steel", "Rock"]), + new Pokemon(306, "Aggron", ["Steel", "Rock"]), + new Pokemon(307, "Meditite", ["Fighting", "Psychic"]), + new Pokemon(308, "Medicham", ["Fighting", "Psychic"]), + new Pokemon(309, "Electrike", ["Electric"]), + new Pokemon(310, "Manectric", ["Electric"]), + new Pokemon(311, "Plusle", ["Electric"]), + new Pokemon(312, "Minun", ["Electric"]), + new Pokemon(313, "Volbeat", ["Bug"]), + new Pokemon(314, "Illumise", ["Bug"]), + new Pokemon(315, "Roselia", ["Grass", "Poison"]), + new Pokemon(316, "Gulpin", ["Poison"]), + new Pokemon(317, "Swalot", ["Poison"]), + new Pokemon(318, "Carvanha", ["Water", "Dark"]), + new Pokemon(319, "Sharpedo", ["Water", "Dark"]), + new Pokemon(320, "Wailmer", ["Water"]), + new Pokemon(321, "Wailord", ["Water"]), + new Pokemon(322, "Numel", ["Fire", "Ground"]), + new Pokemon(323, "Camerupt", ["Fire", "Ground"]), + new Pokemon(324, "Torkoal", ["Fire"]), + new Pokemon(325, "Spoink", ["Psychic"]), + new Pokemon(326, "Grumpig", ["Psychic"]), + new Pokemon(327, "Spinda", ["Normal"]), + new Pokemon(328, "Trapinch", ["Ground"]), + new Pokemon(329, "Vibrava", ["Ground", "Dragon"]), + new Pokemon(330, "Flygon", ["Ground", "Dragon"]), + new Pokemon(331, "Cacnea", ["Grass"]), + new Pokemon(332, "Cacturne", ["Grass", "Dark"]), + new Pokemon(333, "Swablu", ["Normal", "Flying"]), + new Pokemon(334, "Altaria", ["Dragon", "Flying"]), + new Pokemon(335, "Zangoose", ["Normal"]), + new Pokemon(336, "Seviper", ["Poison"]), + new Pokemon(337, "Lunatone", ["Rock", "Psychic"]), + new Pokemon(338, "Solrock", ["Rock", "Psychic"]), + new Pokemon(339, "Barboach", ["Water", "Ground"]), + new Pokemon(340, "Whiscash", ["Water", "Ground"]), + new Pokemon(341, "Corphish", ["Water"]), + new Pokemon(342, "Crawdaunt", ["Water", "Dark"]), + new Pokemon(343, "Baltoy", ["Ground", "Psychic"]), + new Pokemon(344, "Claydol", ["Ground", "Psychic"]), + new Pokemon(345, "Lileep", ["Rock", "Grass"]), + new Pokemon(346, "Cradily", ["Rock", "Grass"]), + new Pokemon(347, "Anorith", ["Rock", "Bug"]), + new Pokemon(348, "Armaldo", ["Rock", "Bug"]), + new Pokemon(349, "Feebas", ["Water"]), + new Pokemon(350, "Milotic", ["Water"]), + new Pokemon(351, "Castform", ["Normal"]), + new Pokemon(352, "Kecleon", ["Normal"]), + new Pokemon(353, "Shuppet", ["Ghost"]), + new Pokemon(354, "Banette", ["Ghost"]), + new Pokemon(355, "Duskull", ["Ghost"]), + new Pokemon(356, "Dusclops", ["Ghost"]), + new Pokemon(357, "Tropius", ["Grass", "Flying"]), + new Pokemon(358, "Chimecho", ["Psychic"]), + new Pokemon(359, "Absol", ["Dark"]), + new Pokemon(360, "Wynaut", ["Psychic"]), + new Pokemon(361, "Snorunt", ["Ice"]), + new Pokemon(362, "Glalie", ["Ice"]), + new Pokemon(363, "Spheal", ["Ice", "Water"]), + new Pokemon(364, "Sealeo", ["Ice", "Water"]), + new Pokemon(365, "Walrein", ["Ice", "Water"]), + new Pokemon(366, "Clamperl", ["Water"]), + new Pokemon(367, "Huntail", ["Water"]), + new Pokemon(368, "Gorebyss", ["Water"]), + new Pokemon(369, "Relicanth", ["Water", "Rock"]), + new Pokemon(370, "Luvdisc", ["Water"]), + new Pokemon(371, "Bagon", ["Dragon"]), + new Pokemon(372, "Shelgon", ["Dragon"]), + new Pokemon(373, "Salamence", ["Dragon", "Flying"]), + new Pokemon(374, "Beldum", ["Steel", "Psychic"]), + new Pokemon(375, "Metang", ["Steel", "Psychic"]), + new Pokemon(376, "Metagross", ["Steel", "Psychic"]), + new Pokemon(377, "Regirock", ["Rock"]), + new Pokemon(378, "Regice", ["Ice"]), + new Pokemon(379, "Registeel", ["Steel"]), + new Pokemon(380, "Latias", ["Dragon", "Psychic"]), + new Pokemon(381, "Latios", ["Dragon", "Psychic"]), + new Pokemon(382, "Kyogre", ["Water"]), + new Pokemon(383, "Groudon", ["Ground"]), + new Pokemon(384, "Rayquaza", ["Dragon", "Flying"]), + new Pokemon(385, "Jirachi", ["Steel", "Psychic"]), + new Pokemon(386, "Deoxys", ["Psychic"]), + ]; public PokedexExtensionPage() { @@ -447,10 +446,7 @@ internal sealed partial class PokedexExtensionPage : ListPage Name = "Pokedex"; } - public override IListItem[] GetItems() - { - return _kanto.AsEnumerable().Concat(_johto.AsEnumerable()).Concat(_hoenn.AsEnumerable()).Select(p => GetPokemonListItem(p)).ToArray(); - } + public override IListItem[] GetItems() => _kanto.AsEnumerable().Concat(_johto.AsEnumerable()).Concat(_hoenn.AsEnumerable()).Select(GetPokemonListItem).ToArray(); private static ListItem GetPokemonListItem(Pokemon pokemon) { @@ -462,38 +458,31 @@ internal sealed partial class PokedexExtensionPage : ListPage } // Dictionary mapping Pokémon types to their corresponding colors - private static readonly Dictionary TypeColors = new() + private static readonly Dictionary TypeColors = new() { - { "Normal", Color.FromArgb(255, 168, 168, 120) }, // Light Brownish Grey - { "Fire", Color.FromArgb(255, 240, 128, 48) }, // Orange-Red - { "Water", Color.FromArgb(255, 104, 144, 240) }, // Medium Blue - { "Electric", Color.FromArgb(255, 248, 208, 48) }, // Yellow - { "Grass", Color.FromArgb(255, 120, 200, 80) }, // Green - { "Ice", Color.FromArgb(255, 152, 216, 216) }, // Cyan - { "Fighting", Color.FromArgb(255, 192, 48, 40) }, // Red - { "Poison", Color.FromArgb(255, 160, 64, 160) }, // Purple - { "Ground", Color.FromArgb(255, 224, 192, 104) }, // Yellowish Brown - { "Flying", Color.FromArgb(255, 168, 144, 240) }, // Light Blue - { "Psychic", Color.FromArgb(255, 248, 88, 136) }, // Pink - { "Bug", Color.FromArgb(255, 168, 184, 32) }, // Greenish Yellow - { "Rock", Color.FromArgb(255, 184, 160, 56) }, // Brown - { "Ghost", Color.FromArgb(255, 112, 88, 152) }, // Dark Purple - { "Dragon", Color.FromArgb(255, 112, 56, 248) }, // Blue-Violet - { "Dark", Color.FromArgb(255, 112, 88, 72) }, // Dark Brown - { "Steel", Color.FromArgb(255, 184, 184, 208) }, // Light Grey - { "Fairy", Color.FromArgb(255, 238, 153, 172) }, // Light Pink + { "Normal", ColorHelpers.FromArgb(255, 168, 168, 120) }, // Light Brownish Grey + { "Fire", ColorHelpers.FromArgb(255, 240, 128, 48) }, // Orange-Red + { "Water", ColorHelpers.FromArgb(255, 104, 144, 240) }, // Medium Blue + { "Electric", ColorHelpers.FromArgb(255, 248, 208, 48) }, // Yellow + { "Grass", ColorHelpers.FromArgb(255, 120, 200, 80) }, // Green + { "Ice", ColorHelpers.FromArgb(255, 152, 216, 216) }, // Cyan + { "Fighting", ColorHelpers.FromArgb(255, 192, 48, 40) }, // Red + { "Poison", ColorHelpers.FromArgb(255, 160, 64, 160) }, // Purple + { "Ground", ColorHelpers.FromArgb(255, 224, 192, 104) }, // Yellowish Brown + { "Flying", ColorHelpers.FromArgb(255, 168, 144, 240) }, // Light Blue + { "Psychic", ColorHelpers.FromArgb(255, 248, 88, 136) }, // Pink + { "Bug", ColorHelpers.FromArgb(255, 168, 184, 32) }, // Greenish Yellow + { "Rock", ColorHelpers.FromArgb(255, 184, 160, 56) }, // Brown + { "Ghost", ColorHelpers.FromArgb(255, 112, 88, 152) }, // Dark Purple + { "Dragon", ColorHelpers.FromArgb(255, 112, 56, 248) }, // Blue-Violet + { "Dark", ColorHelpers.FromArgb(255, 112, 88, 72) }, // Dark Brown + { "Steel", ColorHelpers.FromArgb(255, 184, 184, 208) }, // Light Grey + { "Fairy", ColorHelpers.FromArgb(255, 238, 153, 172) }, // Light Pink }; // Method to get the color for a given type - public static Color GetColorForType(string type) - { - // Check if the type exists in the dictionary - if (TypeColors.TryGetValue(type, out var color)) - { - return color; - } + public static OptionalColor GetColorForType(string type) => - // Default color (e.g., white) if the type is not found - return Color.FromArgb(255, 255, 255, 255); - } + // Check if the type exists in the dictionary + TypeColors.TryGetValue(type, out var color) ? color : ColorHelpers.NoColor(); } diff --git a/src/modules/cmdpal/Exts/ProcessMonitorExtension/ProcessListPage.cs b/src/modules/cmdpal/Exts/ProcessMonitorExtension/ProcessListPage.cs index 49c5637968..480e236b92 100644 --- a/src/modules/cmdpal/Exts/ProcessMonitorExtension/ProcessListPage.cs +++ b/src/modules/cmdpal/Exts/ProcessMonitorExtension/ProcessListPage.cs @@ -26,7 +26,7 @@ internal sealed partial class ProcessListPage : ListPage private IListItem[] DoGetItems() { var items = GetRunningProcesses(); - this.Loading = false; + this.IsLoading = false; var s = items .OrderByDescending(p => p.Memory) .Select((process) => new ListItem(new SwitchToProcess(process)) diff --git a/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleDynamicListPage.cs b/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleDynamicListPage.cs index 226c463590..add997e570 100644 --- a/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleDynamicListPage.cs +++ b/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleDynamicListPage.cs @@ -15,7 +15,7 @@ internal sealed partial class SampleDynamicListPage : DynamicListPage { Icon = new(string.Empty); Name = "Dynamic List"; - Loading = true; + IsLoading = true; } public override void UpdateSearchText(string oldSearch, string newSearch) => RaiseItemsChanged(newSearch.Length); diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/PageViewModel.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/PageViewModel.cs index 76c94436a5..146de651f0 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/PageViewModel.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/PageViewModel.cs @@ -31,7 +31,7 @@ public partial class PageViewModel : ExtensionObjectViewModel // on the UI thread. public string Name { get; private set; } = string.Empty; - public bool Loading { get; private set; } = true; + public bool IsLoading { get; private set; } = true; public PageViewModel(IPage model, TaskScheduler scheduler) { @@ -69,11 +69,11 @@ public partial class PageViewModel : ExtensionObjectViewModel } Name = page.Name; - Loading = page.Loading; + IsLoading = page.IsLoading; // Let the UI know about our initial properties too. UpdateProperty(nameof(Name)); - UpdateProperty(nameof(Loading)); + UpdateProperty(nameof(IsLoading)); page.PropChanged += Model_PropChanged; } @@ -104,8 +104,8 @@ public partial class PageViewModel : ExtensionObjectViewModel case nameof(Name): this.Name = model.Name ?? string.Empty; break; - case nameof(Loading): - this.Loading = model.Loading; + case nameof(IsLoading): + this.IsLoading = model.IsLoading; break; } diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TagViewModel.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TagViewModel.cs index 81ff9d9d2c..ec5b2da7ee 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TagViewModel.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TagViewModel.cs @@ -4,7 +4,6 @@ using Microsoft.CmdPal.Extensions; using Microsoft.CmdPal.UI.ViewModels.Models; -using Windows.UI; namespace Microsoft.CmdPal.UI.ViewModels; @@ -18,7 +17,7 @@ public partial class TagViewModel(ITag _tag, TaskScheduler Scheduler) : Extensio public string Tooltip { get; private set; } = string.Empty; - public Color Color { get; private set; } + public OptionalColor Color { get; private set; } // TODO Icon public ExtensionObject Command { get; private set; } = new(null); diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/ExtViews/ListPage.xaml b/src/modules/cmdpal/Microsoft.CmdPal.UI/ExtViews/ListPage.xaml index 9954a92108..f02158a330 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/ExtViews/ListPage.xaml +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/ExtViews/ListPage.xaml @@ -113,7 +113,7 @@ + Visibility="{x:Bind ViewModel.IsLoading, Mode=OneWay}" /> interface ITag { IconDataType Icon { get; }; String Text { get; }; - Windows.UI.Color Color { get; }; + OptionalColor Color { get; }; String ToolTip { get; }; ICommand Command { get; }; }; @@ -1542,7 +1569,7 @@ class HackerNewsPage: Microsoft.Windows.Run.Extensions.ListPage { public bool Loading => true; IListItem[] GetItems(String query) { List items = /* do some RSS feed stuff */; - this.Loading = false; + this.IsLoading = false; return items .Select((post) => new NewsListItem(post)) .ToArray(); @@ -1776,7 +1803,7 @@ classDiagram IPage --|> ICommand class IPage { String Title - Boolean Loading + Boolean IsLoading } IInvokableCommand --|> ICommand @@ -1884,7 +1911,7 @@ classDiagram class ITag { IconDataType Icon String Text - Windows.UI.Color Color + Color Color String ToolTip ICommand Command } diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ColorHelpers.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ColorHelpers.cs new file mode 100644 index 0000000000..78d815974e --- /dev/null +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ColorHelpers.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Microsoft.CmdPal.Extensions.Helpers; + +public sealed class ColorHelpers +{ + public static OptionalColor FromArgb(byte a, byte r, byte g, byte b) => new(true, new(r, g, b, a)); + + public static OptionalColor FromRgb(byte r, byte g, byte b) => new(true, new(r, g, b, 255)); + + public static OptionalColor Transparent() => new(true, new(0, 0, 0, 0)); + + public static OptionalColor NoColor() => new(false, new(0, 0, 0, 0)); +} diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ListPage.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ListPage.cs index 081d64486b..3c0d8656a7 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ListPage.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ListPage.cs @@ -47,13 +47,13 @@ public class ListPage : Page, IListPage } } - public bool HasMore + public bool HasMoreItems { get => _hasMore; set { _hasMore = value; - OnPropertyChanged(nameof(HasMore)); + OnPropertyChanged(nameof(HasMoreItems)); } } diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Page.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Page.cs index 32b582922d..60955bf310 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Page.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Page.cs @@ -2,23 +2,21 @@ // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Windows.UI; - namespace Microsoft.CmdPal.Extensions.Helpers; public partial class Page : Command, IPage { private bool _loading; private string _title = string.Empty; - private Color _accentColor; + private OptionalColor _accentColor; - public bool Loading + public bool IsLoading { get => _loading; set { _loading = value; - OnPropertyChanged(nameof(Loading)); + OnPropertyChanged(nameof(IsLoading)); } } @@ -32,7 +30,7 @@ public partial class Page : Command, IPage } } - public Color AccentColor + public OptionalColor AccentColor { get => _accentColor; set diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Tag.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Tag.cs index 5b1b8e5f6a..6ab2df4590 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Tag.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Tag.cs @@ -2,19 +2,17 @@ // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Windows.UI; - namespace Microsoft.CmdPal.Extensions.Helpers; public class Tag : BaseObservable, ITag { - private Color _color; + private OptionalColor _color; private IconDataType _icon = new(string.Empty); private string _text = string.Empty; private string _toolTip = string.Empty; private ICommand? _command; - public Color Color + public OptionalColor Color { get => _color; set diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions/Microsoft.CmdPal.Extensions.idl b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions/Microsoft.CmdPal.Extensions.idl index e028a807a0..2fe65990c1 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions/Microsoft.CmdPal.Extensions.idl +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions/Microsoft.CmdPal.Extensions.idl @@ -114,11 +114,25 @@ namespace Microsoft.CmdPal.Extensions IFilterItem[] Filters(); } + struct Color + { + UInt8 R; + UInt8 G; + UInt8 B; + UInt8 A; + }; + + struct OptionalColor + { + Boolean HasValue; + Microsoft.CmdPal.Extensions.Color Color; + }; + [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] interface ITag { IconDataType Icon { get; }; String Text { get; }; - Windows.UI.Color Color { get; }; + OptionalColor Color { get; }; String ToolTip { get; }; ICommand Command { get; }; }; @@ -197,9 +211,9 @@ namespace Microsoft.CmdPal.Extensions [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] interface IPage requires ICommand { String Title { get; }; - Boolean Loading { get; }; + Boolean IsLoading { get; }; - Windows.UI.Color AccentColor { get; }; + OptionalColor AccentColor { get; }; } [uuid("c78b9851-e76b-43ee-8f76-da5ba14e69a4")] @@ -247,7 +261,7 @@ namespace Microsoft.CmdPal.Extensions Boolean ShowDetails{ get; }; IFilters Filters { get; }; IGridProperties GridProperties { get; }; - Boolean HasMore { get; }; + Boolean HasMoreItems { get; }; IListItem[] GetItems(); void LoadMore();