A Swiss Army knife for developers.
C# blazorcross-platformcsharpdesktopdesktop-appdesktop-applicationdeveloper-toolsextensiblefluentfluent-designlinuxmacosmicasyntax-highlightingtypescriptwindowswindows-10windows-11winui
Started to add NavigationView
Etienne Baudouxccd37bc28c06
diff --git a/src/app/dev/DevToys.Localization/DevToys.Localization.csproj b/src/app/dev/DevToys.Localization/DevToys.Localization.csprojindex 7a0c241cc..aa010c109 100644--- a/src/app/dev/DevToys.Localization/DevToys.Localization.csproj+++ b/src/app/dev/DevToys.Localization/DevToys.Localization.csproj@@ -10,12 +10,14 @@<PackageReference Include="System.ComponentModel.Composition" /></ItemGroup><ItemGroup>- <ProjectReference- Include="..\..\..\generators\ResxHelperGenerator\ResxHelperGenerator.csproj"- OutputItemType="Analyzer"- ReferenceOutputAssembly="false" />+ <ProjectReference Include="..\..\..\generators\ResxHelperGenerator\ResxHelperGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" /></ItemGroup><ItemGroup>+ <Compile Update="Strings\MainWindow\MainWindow.Designer.cs">+ <DesignTime>True</DesignTime>+ <AutoGen>True</AutoGen>+ <DependentUpon>MainWindow.resx</DependentUpon>+ </Compile><Compile Update="Strings\Settings\Settings.Designer.cs"><DesignTime>True</DesignTime><AutoGen>True</AutoGen>@@ -23,6 +25,10 @@</Compile></ItemGroup><ItemGroup>+ <EmbeddedResource Update="Strings\MainWindow\MainWindow.resx">+ <Generator>PublicResXFileCodeGenerator</Generator>+ <LastGenOutput>MainWindow.Designer.cs</LastGenOutput>+ </EmbeddedResource><EmbeddedResource Update="Strings\Settings\Settings.resx"><Generator>PublicResXFileCodeGenerator</Generator><LastGenOutput>Settings.Designer.cs</LastGenOutput>diff --git a/src/app/dev/DevToys.Localization/Strings/MainWindow/MainWindow.Designer.cs b/src/app/dev/DevToys.Localization/Strings/MainWindow/MainWindow.Designer.csnew file mode 100644index 000000000..52759012d--- /dev/null+++ b/src/app/dev/DevToys.Localization/Strings/MainWindow/MainWindow.Designer.cs@@ -0,0 +1,72 @@+//------------------------------------------------------------------------------+// <auto-generated>+// This code was generated by a tool.+// Runtime Version:4.0.30319.42000+//+// Changes to this file may cause incorrect behavior and will be lost if+// the code is regenerated.+// </auto-generated>+//------------------------------------------------------------------------------++namespace DevToys.Localization.Strings.MainWindow {+ using System;+++ /// <summary>+ /// A strongly-typed resource class, for looking up localized strings, etc.+ /// </summary>+ // This class was auto-generated by the StronglyTypedResourceBuilder+ // class via a tool like ResGen or Visual Studio.+ // To add or remove a member, edit your .ResX file then rerun ResGen+ // with the /str option, or rebuild your VS project.+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]+ public class MainWindow {++ private static global::System.Resources.ResourceManager resourceMan;++ private static global::System.Globalization.CultureInfo resourceCulture;++ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]+ internal MainWindow() {+ }++ /// <summary>+ /// Returns the cached ResourceManager instance used by this class.+ /// </summary>+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]+ public static global::System.Resources.ResourceManager ResourceManager {+ get {+ if (object.ReferenceEquals(resourceMan, null)) {+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DevToys.Localization.Strings.MainWindow.MainWindow", typeof(MainWindow).Assembly);+ resourceMan = temp;+ }+ return resourceMan;+ }+ }++ /// <summary>+ /// Overrides the current thread's CurrentUICulture property for all+ /// resource lookups using this strongly typed resource class.+ /// </summary>+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]+ public static global::System.Globalization.CultureInfo Culture {+ get {+ return resourceCulture;+ }+ set {+ resourceCulture = value;+ }+ }++ /// <summary>+ /// Looks up a localized string similar to Type to search for tools....+ /// </summary>+ public static string Search {+ get {+ return ResourceManager.GetString("Search", resourceCulture);+ }+ }+ }+}diff --git a/src/app/dev/DevToys.Localization/Strings/MainWindow/MainWindow.resx b/src/app/dev/DevToys.Localization/Strings/MainWindow/MainWindow.resxnew file mode 100644index 000000000..b2a60c619--- /dev/null+++ b/src/app/dev/DevToys.Localization/Strings/MainWindow/MainWindow.resx@@ -0,0 +1,123 @@+<?xml version="1.0" encoding="utf-8"?>+<root>+ <!--+ Microsoft ResX Schema++ Version 2.0++ The primary goals of this format is to allow a simple XML format+ that is mostly human readable. The generation and parsing of the+ various data types are done through the TypeConverter classes+ associated with the data types.++ Example:++ ... ado.net/XML headers & schema ...+ <resheader name="resmimetype">text/microsoft-resx</resheader>+ <resheader name="version">2.0</resheader>+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">+ <value>[base64 mime encoded serialized .NET Framework object]</value>+ </data>+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>+ <comment>This is a comment</comment>+ </data>++ There are any number of "resheader" rows that contain simple+ name/value pairs.++ Each data row contains a name, and value. The row also contains a+ type or mimetype. Type corresponds to a .NET class that support+ text/value conversion through the TypeConverter architecture.+ Classes that don't support this are serialized and stored with the+ mimetype set.++ The mimetype is used for serialized objects, and tells the+ ResXResourceReader how to depersist the object. This is currently not+ extensible. For a given mimetype the value must be set accordingly:++ Note - application/x-microsoft.net.object.binary.base64 is the format+ that the ResXResourceWriter will generate, however the reader can+ read any of the formats listed below.++ mimetype: application/x-microsoft.net.object.binary.base64+ value : The object must be serialized with+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter+ : and then encoded with base64 encoding.++ mimetype: application/x-microsoft.net.object.soap.base64+ value : The object must be serialized with+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter+ : and then encoded with base64 encoding.++ mimetype: application/x-microsoft.net.object.bytearray.base64+ value : The object must be serialized into a byte array+ : using a System.ComponentModel.TypeConverter+ : and then encoded with base64 encoding.+ -->+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />+ <xsd:element name="root" msdata:IsDataSet="true">+ <xsd:complexType>+ <xsd:choice maxOccurs="unbounded">+ <xsd:element name="metadata">+ <xsd:complexType>+ <xsd:sequence>+ <xsd:element name="value" type="xsd:string" minOccurs="0" />+ </xsd:sequence>+ <xsd:attribute name="name" use="required" type="xsd:string" />+ <xsd:attribute name="type" type="xsd:string" />+ <xsd:attribute name="mimetype" type="xsd:string" />+ <xsd:attribute ref="xml:space" />+ </xsd:complexType>+ </xsd:element>+ <xsd:element name="assembly">+ <xsd:complexType>+ <xsd:attribute name="alias" type="xsd:string" />+ <xsd:attribute name="name" type="xsd:string" />+ </xsd:complexType>+ </xsd:element>+ <xsd:element name="data">+ <xsd:complexType>+ <xsd:sequence>+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />+ </xsd:sequence>+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />+ <xsd:attribute ref="xml:space" />+ </xsd:complexType>+ </xsd:element>+ <xsd:element name="resheader">+ <xsd:complexType>+ <xsd:sequence>+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />+ </xsd:sequence>+ <xsd:attribute name="name" type="xsd:string" use="required" />+ </xsd:complexType>+ </xsd:element>+ </xsd:choice>+ </xsd:complexType>+ </xsd:element>+ </xsd:schema>+ <resheader name="resmimetype">+ <value>text/microsoft-resx</value>+ </resheader>+ <resheader name="version">+ <value>2.0</value>+ </resheader>+ <resheader name="reader">+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>+ </resheader>+ <resheader name="writer">+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>+ </resheader>+ <data name="Search" xml:space="preserve">+ <value>Type to search for tools...</value>+ </data>+</root>\ No newline at end of filediff --git a/src/app/dev/DevToys.UI/Views/MainWindow.xaml b/src/app/dev/DevToys.UI/Views/MainWindow.xamlindex 7566be45d..77322b610 100644--- a/src/app/dev/DevToys.UI/Views/MainWindow.xaml+++ b/src/app/dev/DevToys.UI/Views/MainWindow.xaml@@ -5,6 +5,7 @@xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:controls="using:DevToys.UI.Framework.Controls"+ xmlns:strings="using:DevToys.Localization.Strings.MainWindow"xmlns:muxc="using:Microsoft.UI.Xaml.Controls"xmlns:wasm="http://uno.ui/wasm"xmlns:macos="http://uno.ui/macos"@@ -12,21 +13,82 @@xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:not_win="http://uno.ui/not_win"mc:Ignorable="d wasm not_win macos ios">+ <Page.Resources>+ <!--This top margin is the height of the custom TitleBar-->+ <Thickness x:Key="NavigationViewContentMargin">0,46,0,0</Thickness>+ <Thickness x:Key="NavigationViewContentGridBorderThickness">1,1,0,0</Thickness>+ <CornerRadius x:Key="NavigationViewContentGridCornerRadius">8,0,0,0</CornerRadius>+ </Page.Resources><Grid not_win:Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" ios:Margin="0,38,0,0">- <Grid.RowDefinitions>- <RowDefinition Height="32"/>- <RowDefinition Height="*"/>- </Grid.RowDefinitions>+ <Grid.BackgroundTransition>+ <BrushTransition />+ </Grid.BackgroundTransition>- <Grid x:Name="AppTitleBar" Grid.Row="0">- <Grid.ColumnDefinitions>- <ColumnDefinition Width="Auto"/>- <ColumnDefinition Width="*"/>- </Grid.ColumnDefinitions>- <Button Content="Hello world" Grid.Column="0"/>- <Grid x:Name="DraggableArea" Grid.Column="1" controls:BackdropWindow.IsWindowDraggableArea="True"/>- </Grid>- <Button Content="Hello world" Grid.Column="0"/>+ <!-- Draggable area of the title bar. -->+ <!--<Grid x:Name="DraggableArea" Grid.Column="1" controls:BackdropWindow.IsWindowDraggableArea="True"/>-->++ <!-- Navigation view -->+ <NavigationView+ IsTitleBarAutoPaddingEnabled="False"+ IsSettingsVisible="False"+ IsBackButtonVisible="Visible"+ IsBackEnabled="False"+ CompactModeThresholdWidth="640"+ ExpandedModeThresholdWidth="1008"+ IsTabStop="False"+ AlwaysShowHeader="True"+ IsPaneToggleButtonVisible="True">++ <NavigationView.AutoSuggestBox>+ <AutoSuggestBox+ Name="SearchBox"+ MinWidth="200"+ TabIndex="0"+ KeyboardAcceleratorPlacementMode="Hidden"+ QueryIcon="Find"+ HorizontalAlignment="Stretch"+ VerticalAlignment="Center"+ PlaceholderText="{x:Bind strings:MainWindow.Search}">+ <!-- TODO -->+ <!--<i:Interaction.Behaviors>+ <core:EventTriggerBehavior EventName="TextChanged">+ <core:InvokeCommandAction Command="{x:Bind ViewModel.SearchBoxTextChangedCommand}"/>+ </core:EventTriggerBehavior>+ <core:EventTriggerBehavior EventName="QuerySubmitted">+ <core:InvokeCommandAction Command="{x:Bind ViewModel.SearchBoxQuerySubmittedCommand}"/>+ </core:EventTriggerBehavior>+ </i:Interaction.Behaviors>-->+ <AutoSuggestBox.KeyboardAccelerators>+ <KeyboardAccelerator+ Key="F"+ Modifiers="Control"+ Invoked="SearchBoxKeyboardAccelerator_Invoked"/>+ </AutoSuggestBox.KeyboardAccelerators>+ <!-- TODO -->+ <!--<AutoSuggestBox.ItemTemplate>+ <DataTemplate x:DataType="tools:ToolProviderViewItem">+ <RichTextBlock+ HorizontalAlignment="Stretch"+ IsTextSelectionEnabled="False"+ TextWrapping="NoWrap"+ TextTrimming="CharacterEllipsis"+ ex:HighlighterExtension.Highlighters="{x:Bind MatchedSpans, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">+ <Paragraph>+ <Run Text="{x:Bind ToolProvider.SearchDisplayName}"/>+ </Paragraph>+ </RichTextBlock>+ </DataTemplate>+ </AutoSuggestBox.ItemTemplate>-->+ </AutoSuggestBox>+ </NavigationView.AutoSuggestBox>++ <NavigationView.MenuItems>+ <NavigationViewItem+ x:Name="NewControlsItem"+ Content="Home"+ Icon="Home" />+ </NavigationView.MenuItems>+ </NavigationView></Grid></controls:BackdropPage>diff --git a/src/app/dev/DevToys.UI/Views/MainWindow.xaml.cs b/src/app/dev/DevToys.UI/Views/MainWindow.xaml.csindex 9e81a9a91..c42859851 100644--- a/src/app/dev/DevToys.UI/Views/MainWindow.xaml.cs+++ b/src/app/dev/DevToys.UI/Views/MainWindow.xaml.cs@@ -1,5 +1,7 @@using DevToys.Api.Core.Theme;using DevToys.UI.Framework.Controls;+using Microsoft.UI.Xaml;+using Microsoft.UI.Xaml.Input;namespace DevToys.UI.Views;@@ -16,8 +18,13 @@ public sealed partial class MainWindow : BackdropPagepublic MainWindow(BackdropWindow backdropWindow, IThemeListener themeListener): base(backdropWindow, themeListener){- this.InitializeComponent();- this.WindowStartupLocation = WindowStartupLocation.CenterScreen;- this.Resize(1200, 800);+ InitializeComponent();+ WindowStartupLocation = WindowStartupLocation.CenterScreen;+ Resize(1200, 800);+ }++ private void SearchBoxKeyboardAccelerator_Invoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args)+ {+ SearchBox.Focus(FocusState.Keyboard);}}diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Shared/MainLayout.razor b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Shared/MainLayout.razorindex 70a76513c..17748c776 100644--- a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Shared/MainLayout.razor+++ b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Shared/MainLayout.razor@@ -1,6 +1,9 @@@inherits MefLayoutComponentBase-<FluentDesignSystemProvider BaseLayerLuminance=@_baseLayerLuminanceValue>+<FluentDesignSystemProvider+ AccentBaseColor="#0078D4"+ NeutralBaseColor="000000"+ BaseLayerLuminance=@_baseLayerLuminanceValue><div id="container"><NavigationView><MenuItemsSource>diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Shared/MainLayout.razor.css b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Shared/MainLayout.razor.cssindex 7b8fc5759..166f70e8e 100644--- a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Shared/MainLayout.razor.css+++ b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Shared/MainLayout.razor.css@@ -2,6 +2,7 @@width: 100%;height: 100%;position: fixed;+ padding-top: 30px;top: 0;left: 0;background-color: var(--neutral-layer-3);