From 852085a6d659b9744ffafb6dc45bdc54826610f1 Mon Sep 17 00:00:00 2001 From: "Zhaopeng Wang (from Dev Box)" Date: Mon, 24 Nov 2025 16:55:27 +0800 Subject: [PATCH 1/6] fix ADO ID 58944503 --- AIDevGallery/App.xaml.cs | 3 +++ AIDevGallery/MainWindow.xaml | 2 +- AIDevGallery/MainWindow.xaml.cs | 41 ++++++++++++++++++++++++++++++++- 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/AIDevGallery/App.xaml.cs b/AIDevGallery/App.xaml.cs index 10015566..24e83927 100644 --- a/AIDevGallery/App.xaml.cs +++ b/AIDevGallery/App.xaml.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using AIDevGallery.Controls.ModelPickerViews; using AIDevGallery.Helpers; using AIDevGallery.Models; using AIDevGallery.Samples; @@ -8,9 +9,11 @@ using AIDevGallery.Utils; using Microsoft.UI.Xaml; using Microsoft.Windows.AppLifecycle; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Windows.UI.ViewManagement; namespace AIDevGallery; diff --git a/AIDevGallery/MainWindow.xaml b/AIDevGallery/MainWindow.xaml index d0bcb242..25e269c0 100644 --- a/AIDevGallery/MainWindow.xaml +++ b/AIDevGallery/MainWindow.xaml @@ -19,7 +19,7 @@ - + diff --git a/AIDevGallery/MainWindow.xaml.cs b/AIDevGallery/MainWindow.xaml.cs index 9b8c2e8f..d913160b 100644 --- a/AIDevGallery/MainWindow.xaml.cs +++ b/AIDevGallery/MainWindow.xaml.cs @@ -1,7 +1,8 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using AIDevGallery.Controls; +using AIDevGallery.Controls.ModelPickerViews; using AIDevGallery.Helpers; using AIDevGallery.Models; using AIDevGallery.Pages; @@ -20,6 +21,7 @@ using System.Threading; using System.Threading.Tasks; using Windows.System; +using Windows.UI.ViewManagement; using WinUIEx; namespace AIDevGallery; @@ -29,6 +31,7 @@ internal sealed partial class MainWindow : WindowEx private AppContentIndexer? _indexer; private CancellationTokenSource? _searchCts; // Added for search cancellation public ModelOrApiPicker ModelPicker => modelOrApiPicker; + private UISettings uiSettings; public MainWindow(object? obj = null) { @@ -62,6 +65,13 @@ public MainWindow(object? obj = null) } App.AppData.PropertyChanged += AppData_PropertyChanged; + uiSettings = new UISettings(); + } + + private void MainWindow_Loaded(object? sender, RoutedEventArgs e) + { + uiSettings.ColorValuesChanged += Accessibility_HighContrastChanged; + UpdateResources(); } private async Task LoadAppSearchIndex() @@ -452,4 +462,33 @@ public static void IndexAppSearchIndexStatic() var mainWindow = (MainWindow)App.MainWindow; mainWindow?.IndexContentsWithAppContentSearch(); } + + private void Accessibility_HighContrastChanged(object sender, object e) + { + UpdateResources(); + } + + private void UpdateResources() + { + var dispatcherQueue = this.DispatcherQueue; + dispatcherQueue.TryEnqueue(() => + { + var appResources = Application.Current.Resources; + + if (appResources["GitHubIconImage"] is Microsoft.UI.Xaml.Media.Imaging.SvgImageSource svg) + { + svg.UriSource = new Uri($"ms-appx:///Assets/ModelIcons/GitHub{AppUtils.GetThemeAssetSuffix()}.svg"); + } + else + { + appResources["GitHubIconImage"] = + new Microsoft.UI.Xaml.Media.Imaging.SvgImageSource( + new Uri($"ms-appx:///Assets/ModelIcons/GitHub{AppUtils.GetThemeAssetSuffix()}.svg")); + } + + ModelPickerDefinition.Definitions["onnx"].Icon = $"ms-appx:///Assets/ModelIcons/CustomModel{AppUtils.GetThemeAssetSuffix()}.png"; + ModelPickerDefinition.Definitions["ollama"].Icon = $"ms-appx:///Assets/ModelIcons/Ollama{AppUtils.GetThemeAssetSuffix()}.png"; + ModelPickerDefinition.Definitions["openai"].Icon = $"ms-appx:///Assets/ModelIcons/OpenAI{AppUtils.GetThemeAssetSuffix()}.png"; + }); + } } \ No newline at end of file From d5a5653d84bb05e7a1d97b4231838b62d0f96b04 Mon Sep 17 00:00:00 2001 From: "Zhaopeng Wang (from Dev Box)" Date: Mon, 24 Nov 2025 18:21:32 +0800 Subject: [PATCH 2/6] fix ADO ID 59150995 --- .../Language Models/CustomSystemPrompt.xaml | 22 +++++++++++++------ .../CustomSystemPrompt.xaml.cs | 2 ++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/AIDevGallery/Samples/Open Source Models/Language Models/CustomSystemPrompt.xaml b/AIDevGallery/Samples/Open Source Models/Language Models/CustomSystemPrompt.xaml index 547511b6..0ecb3b61 100644 --- a/AIDevGallery/Samples/Open Source Models/Language Models/CustomSystemPrompt.xaml +++ b/AIDevGallery/Samples/Open Source Models/Language Models/CustomSystemPrompt.xaml @@ -61,26 +61,34 @@ - + Value="0" + AutomationProperties.Name="{x:Bind GetAutomationName(MinLengthSlider.Name, MinLengthSlider.Value), Mode=OneWay}" /> + Value="{x:Bind defaultMaxLength, Mode=OneTime}" + AutomationProperties.Name="{x:Bind GetAutomationName(MaxLengthSlider.Name, MaxLengthSlider.Value), Mode=OneWay}" /> + Value="{x:Bind defaultTopP, Mode=OneTime}" + AutomationProperties.Name="{x:Bind GetAutomationName(TopPSlider.Name, TopPSlider.Value), Mode=OneWay}" /> + Value="{x:Bind defaultTopK, Mode=OneTime}" + AutomationProperties.Name="{x:Bind GetAutomationName(TopKSlider.Name, TopKSlider.Value), Mode=OneWay}" /> + Value="{x:Bind defaultTemperature, Mode=OneTime}" + AutomationProperties.Name="{x:Bind GetAutomationName(TemperatureSlider.Name, TemperatureSlider.Value), Mode=OneWay}" /> diff --git a/AIDevGallery/Samples/Open Source Models/Language Models/CustomSystemPrompt.xaml.cs b/AIDevGallery/Samples/Open Source Models/Language Models/CustomSystemPrompt.xaml.cs index d2a7eb42..96ac2829 100644 --- a/AIDevGallery/Samples/Open Source Models/Language Models/CustomSystemPrompt.xaml.cs +++ b/AIDevGallery/Samples/Open Source Models/Language Models/CustomSystemPrompt.xaml.cs @@ -136,6 +136,8 @@ private void CleanUp() chatClient?.Dispose(); } + public string GetAutomationName(string name, double value) => $"{name} {value:F0}"; + public ChatOptions GetDefaultChatOptions(IChatClient? chatClient) { var chatOptions = chatClient?.GetService(); From 334a1872c3ddc7ef95f1229d227625f91f7afbd5 Mon Sep 17 00:00:00 2001 From: "Zhaopeng Wang (from Dev Box)" Date: Mon, 24 Nov 2025 18:41:26 +0800 Subject: [PATCH 3/6] fix ADO ID 59123689 --- AIDevGallery/App.xaml.cs | 3 --- AIDevGallery/Pages/HomePage.xaml | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/AIDevGallery/App.xaml.cs b/AIDevGallery/App.xaml.cs index 24e83927..10015566 100644 --- a/AIDevGallery/App.xaml.cs +++ b/AIDevGallery/App.xaml.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using AIDevGallery.Controls.ModelPickerViews; using AIDevGallery.Helpers; using AIDevGallery.Models; using AIDevGallery.Samples; @@ -9,11 +8,9 @@ using AIDevGallery.Utils; using Microsoft.UI.Xaml; using Microsoft.Windows.AppLifecycle; -using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Windows.UI.ViewManagement; namespace AIDevGallery; diff --git a/AIDevGallery/Pages/HomePage.xaml b/AIDevGallery/Pages/HomePage.xaml index 584dfad4..6f9eed24 100644 --- a/AIDevGallery/Pages/HomePage.xaml +++ b/AIDevGallery/Pages/HomePage.xaml @@ -47,7 +47,8 @@ - + Date: Mon, 24 Nov 2025 18:47:28 +0800 Subject: [PATCH 4/6] fix ADO ID 59119557 --- AIDevGallery/Pages/APIs/APIPage.xaml | 78 ++++++++++++++-------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/AIDevGallery/Pages/APIs/APIPage.xaml b/AIDevGallery/Pages/APIs/APIPage.xaml index 664ec8cb..6ce2c751 100644 --- a/AIDevGallery/Pages/APIs/APIPage.xaml +++ b/AIDevGallery/Pages/APIs/APIPage.xaml @@ -155,45 +155,6 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + From 91569a35510b385b72c1edf30a2c5e6a0d26a3bd Mon Sep 17 00:00:00 2001 From: "Zhaopeng Wang (from Dev Box)" Date: Tue, 25 Nov 2025 15:23:03 +0800 Subject: [PATCH 5/6] fix ADO ID 59155027 --- AIDevGallery/Controls/Card.xaml | 1 + 1 file changed, 1 insertion(+) diff --git a/AIDevGallery/Controls/Card.xaml b/AIDevGallery/Controls/Card.xaml index b33e6669..42d1b7d2 100644 --- a/AIDevGallery/Controls/Card.xaml +++ b/AIDevGallery/Controls/Card.xaml @@ -48,6 +48,7 @@ VerticalAlignment="Center" FontSize="14" FontWeight="SemiBold" + AutomationProperties.Level="1" Text="{x:Bind Title, Mode=OneWay}" /> Date: Tue, 25 Nov 2025 16:15:49 +0800 Subject: [PATCH 6/6] fix UI show error --- AIDevGallery/Controls/SampleContainer.xaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AIDevGallery/Controls/SampleContainer.xaml b/AIDevGallery/Controls/SampleContainer.xaml index 84ce2a45..70a60a71 100644 --- a/AIDevGallery/Controls/SampleContainer.xaml +++ b/AIDevGallery/Controls/SampleContainer.xaml @@ -32,7 +32,7 @@ CornerRadius="{x:Bind CornerRadius, Mode=OneWay}"> - + @@ -92,9 +92,9 @@ Orientation="Horizontal" Visibility="Visible">