A Swiss Army knife for developers.
C# blazorcross-platformcsharpdesktopdesktop-appdesktop-applicationdeveloper-toolsextensiblefluentfluent-designlinuxmacosmicasyntax-highlightingtypescriptwindowswindows-10windows-11winui
Fixed font usage + added context menu to navigation view
Etienne Baudouxdcda3333cbca
diff --git a/src/dev/impl/DevTools.Impl/ViewModels/MainPageViewModel.cs b/src/dev/impl/DevTools.Impl/ViewModels/MainPageViewModel.csindex 649a2595b..324f866a8 100644--- a/src/dev/impl/DevTools.Impl/ViewModels/MainPageViewModel.cs+++ b/src/dev/impl/DevTools.Impl/ViewModels/MainPageViewModel.cs@@ -1,6 +1,7 @@#nullable enableusing DevTools.Impl.Models;+using DevTools.Localization;using DevTools.Providers;using Microsoft.Toolkit.Mvvm.ComponentModel;using Microsoft.Toolkit.Mvvm.Input;@@ -15,6 +16,8 @@ namespace DevTools.Impl.ViewModels{private readonly IToolProviderFactory _toolProviderFactory;+ internal MainPageStrings Strings = LanguageManager.Instance.MainPage;+/// <summary>/// Items at the top of the NavigationView./// </summary>diff --git a/src/dev/impl/DevTools.Impl/Views/MainPage.xaml b/src/dev/impl/DevTools.Impl/Views/MainPage.xamlindex f55603b4a..998bb302b 100644--- a/src/dev/impl/DevTools.Impl/Views/MainPage.xaml+++ b/src/dev/impl/DevTools.Impl/Views/MainPage.xaml@@ -2,7 +2,6 @@x:Class="DevTools.Impl.Views.MainPage"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"- xmlns:local="using:DevTools.Impl.Views"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:muxc="using:Microsoft.UI.Xaml.Controls"@@ -10,9 +9,12 @@xmlns:i="using:Microsoft.Xaml.Interactivity"xmlns:core="using:Microsoft.Xaml.Interactions.Core"xmlns:ex="using:DevTools.Impl.Core.UI.Extensions"+ xmlns:localization="using:DevTools.Localization"mc:Ignorable="d"muxc:BackdropMaterial.ApplyToRootOrPageBackground="True"><Page.Resources>+ <localization:LanguageManager x:Key="LanguageManager"/>+<!--This top margin is the height of the custom TitleBar--><Thickness x:Key="NavigationViewContentMargin">0,48,0,0</Thickness></Page.Resources>@@ -35,7 +37,6 @@Width="16"Height="16"/><TextBlock- x:Name="AppTitle"Text="DevTools"VerticalAlignment="Center"Margin="12,0,0,0"@@ -54,7 +55,6 @@<!-- Navigation view --><muxc:NavigationView- x:Name="nvSample"IsTitleBarAutoPaddingEnabled="False"IsSettingsVisible="False"IsBackButtonVisible="Collapsed"@@ -72,6 +72,15 @@<muxc:NavigationView.MenuItemTemplate><DataTemplate x:DataType="models:MatchedToolProviderViewData"><muxc:NavigationViewItem Icon="{x:Bind Icon}">+ <muxc:NavigationViewItem.ContextFlyout>+ <MenuFlyout>+ <MenuFlyoutItem Text="{Binding Instance.MainPage.OpenInNewWindow, Source={StaticResource LanguageManager}}">+ <MenuFlyoutItem.Icon>+ <FontIcon FontFamily="{StaticResource FluentSystemIcons}" Glyph="ø" />+ </MenuFlyoutItem.Icon>+ </MenuFlyoutItem>+ </MenuFlyout>+ </muxc:NavigationViewItem.ContextFlyout><muxc:NavigationViewItem.Content><RichTextBlockIsTextSelectionEnabled="False"@@ -91,7 +100,7 @@<AutoSuggestBoxx:Name="SearchBox"QueryIcon="Find"- PlaceholderText="Search"+ PlaceholderText="{x:Bind ViewModel.Strings.Search}"Text="{x:Bind ViewModel.SearchQuery, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"><i:Interaction.Behaviors><core:EventTriggerBehavior EventName="TextChanged">diff --git a/src/dev/impl/DevTools.Impl/Views/Settings/SettingsToolProvider.cs b/src/dev/impl/DevTools.Impl/Views/Settings/SettingsToolProvider.csindex 39f5b185e..a16f8baa3 100644--- a/src/dev/impl/DevTools.Impl/Views/Settings/SettingsToolProvider.cs+++ b/src/dev/impl/DevTools.Impl/Views/Settings/SettingsToolProvider.cs@@ -7,6 +7,7 @@ using Microsoft.UI.Xaml.Controls;using Microsoft.UI.Xaml.Controls.AnimatedVisuals;using System;using System.Composition;+using Windows.UI.Xaml;using Windows.UI.Xaml.Media;namespace DevTools.Impl.Views.Settings@@ -24,8 +25,8 @@ namespace DevTools.Impl.Views.SettingsSource = new AnimatedSettingsVisualSource(),FallbackIconSource = new FontIconSource{- FontFamily = new FontFamily("FluentSystemIcons-Regular"),- Glyph = ""+ FontFamily = (FontFamily)Application.Current.Resources["FluentSystemIcons"],+ Glyph = "\uF6A9"}};diff --git a/src/dev/impl/DevTools.Localization/LanguageManager.cs b/src/dev/impl/DevTools.Localization/LanguageManager.csindex 92942dda8..d7c135753 100644--- a/src/dev/impl/DevTools.Localization/LanguageManager.cs+++ b/src/dev/impl/DevTools.Localization/LanguageManager.cs@@ -96,9 +96,14 @@ namespace DevTools.Localizationprivate readonly ResourceLoader _resources = ResourceLoader.GetForViewIndependentUse("DevTools.Localization/MainPage");/// <summary>- /// Gets the resource Yes.+ /// Gets the resource OpenInNewWindow./// </summary>- public string Yes => _resources.GetString("Yes");+ public string OpenInNewWindow => _resources.GetString("OpenInNewWindow");++ /// <summary>+ /// Gets the resource Search.+ /// </summary>+ public string Search => _resources.GetString("Search");}public class SettingsStrings : ObservableObjectdiff --git a/src/dev/impl/DevTools.Localization/Resources.xaml b/src/dev/impl/DevTools.Localization/Resources.xamlindex b0037d22c..7762b4b81 100644--- a/src/dev/impl/DevTools.Localization/Resources.xaml+++ b/src/dev/impl/DevTools.Localization/Resources.xaml@@ -1,7 +1,7 @@<ResourceDictionaryxmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:localization="using:DevTools.Localization">- <FontFamily x:Key="FluentSystemIcons-Regular">/Assets/FluentSystemIcons-Regular.ttf#FluentSystemIcons-Regular</FontFamily>+ <FontFamily x:Key="FluentSystemIcons">ms-appx:///DevTools.Localization/Assets/FluentSystemIcons-Regular.ttf#FluentSystemIcons-Regular</FontFamily></ResourceDictionary>diff --git a/src/dev/impl/DevTools.Localization/Strings/en/MainPage.resw b/src/dev/impl/DevTools.Localization/Strings/en/MainPage.reswindex 89e45ecec..ed0cce862 100644--- a/src/dev/impl/DevTools.Localization/Strings/en/MainPage.resw+++ b/src/dev/impl/DevTools.Localization/Strings/en/MainPage.resw@@ -117,7 +117,10 @@<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>- <data name="Yes" xml:space="preserve">- <value>Yes</value>+ <data name="OpenInNewWindow" xml:space="preserve">+ <value>Open in new window</value>+ </data>+ <data name="Search" xml:space="preserve">+ <value>Search</value></data></root>\ No newline at end of file