Skip to content

A Swiss Army knife for developers.

Added draft of "Support the development"

Etienne Baudouxed0d5b66e9c7
diff --git a/src/app/dev/DevToys.Blazor/BuiltInTools/ExtensionsManager/ExtensionsManagerGuiTool.cs b/src/app/dev/DevToys.Blazor/BuiltInTools/ExtensionsManager/ExtensionsManagerGuiTool.cs
index 23faff607..be0f29dd5 100644
--- a/src/app/dev/DevToys.Blazor/BuiltInTools/ExtensionsManager/ExtensionsManagerGuiTool.cs
+++ b/src/app/dev/DevToys.Blazor/BuiltInTools/ExtensionsManager/ExtensionsManagerGuiTool.cs
@@ -6,7 +6,7 @@ using NuGet.Packaging.Core;
namespace DevToys.Blazor.BuiltInTools.ExtensionsManager;
[Export(typeof(IGuiTool))]
-[Name("Extensions Manager")]
+[Name(ExtensionmanagerToolName)]
[ToolDisplayInformation(
IconFontName = "FluentSystemIcons",
IconGlyph = '\uE9E8',
@@ -25,6 +25,8 @@ namespace DevToys.Blazor.BuiltInTools.ExtensionsManager;
[TargetPlatform(Platform.MacCatalyst)]
internal sealed class ExtensionsManagerGuiTool : IGuiTool
{
+ internal const string ExtensionmanagerToolName = "Extensions Manager";
+
private enum GridRows
{
TopButtons,
diff --git a/src/app/dev/DevToys.Tools/Tools/Test/Test.Designer.cs b/src/app/dev/DevToys.Blazor/BuiltInTools/SupportDevelopment/SupportDevelopment.Designer.cs
similarity index 85%
rename from src/app/dev/DevToys.Tools/Tools/Test/Test.Designer.cs
rename to src/app/dev/DevToys.Blazor/BuiltInTools/SupportDevelopment/SupportDevelopment.Designer.cs
index 18220a7af..dfde5cee8 100644
--- a/src/app/dev/DevToys.Tools/Tools/Test/Test.Designer.cs
+++ b/src/app/dev/DevToys.Blazor/BuiltInTools/SupportDevelopment/SupportDevelopment.Designer.cs
@@ -8,7 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
-namespace DevToys.Tools.Tools.Test {
+namespace DevToys.Blazor.BuiltInTools.SupportDevelopment {
using System;
@@ -22,14 +22,14 @@ namespace DevToys.Tools.Tools.Test {
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Test {
+ internal class SupportDevelopment {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Test() {
+ internal SupportDevelopment() {
}
/// <summary>
@@ -39,7 +39,7 @@ namespace DevToys.Tools.Tools.Test {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DevToys.Tools.Tools.Test.Test", typeof(Test).Assembly);
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DevToys.Blazor.BuiltInTools.SupportDevelopment.SupportDevelopment", typeof(SupportDevelopment).Assembly);
resourceMan = temp;
}
return resourceMan;
@@ -61,7 +61,7 @@ namespace DevToys.Tools.Tools.Test {
}
/// <summary>
- /// Looks up a localized string similar to Test.
+ /// Looks up a localized string similar to Support the development of DevToys.
/// </summary>
internal static string AccessibleName {
get {
@@ -70,7 +70,7 @@ namespace DevToys.Tools.Tools.Test {
}
/// <summary>
- /// Looks up a localized string similar to Test tool.
+ /// Looks up a localized string similar to See how you can help improving DevToys.
/// </summary>
internal static string Description {
get {
@@ -79,7 +79,7 @@ namespace DevToys.Tools.Tools.Test {
}
/// <summary>
- /// Looks up a localized string similar to Test.
+ /// Looks up a localized string similar to Support the development.
/// </summary>
internal static string ShortDisplayTitle {
get {
diff --git a/src/app/dev/DevToys.Tools/Tools/Test/Test.resx b/src/app/dev/DevToys.Blazor/BuiltInTools/SupportDevelopment/SupportDevelopment.resx
similarity index 97%
rename from src/app/dev/DevToys.Tools/Tools/Test/Test.resx
rename to src/app/dev/DevToys.Blazor/BuiltInTools/SupportDevelopment/SupportDevelopment.resx
index effc2c962..554ef7010 100644
--- a/src/app/dev/DevToys.Tools/Tools/Test/Test.resx
+++ b/src/app/dev/DevToys.Blazor/BuiltInTools/SupportDevelopment/SupportDevelopment.resx
@@ -118,12 +118,12 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="AccessibleName" xml:space="preserve">
- <value>Test</value>
+ <value>Support the development of DevToys</value>
</data>
<data name="Description" xml:space="preserve">
- <value>Test tool</value>
+ <value>See how you can help improving DevToys</value>
</data>
<data name="ShortDisplayTitle" xml:space="preserve">
- <value>Test</value>
+ <value>Support the development</value>
</data>
</root>
\ No newline at end of file
diff --git a/src/app/dev/DevToys.Blazor/BuiltInTools/SupportDevelopment/SupportDevelopmentGuidTools.cs b/src/app/dev/DevToys.Blazor/BuiltInTools/SupportDevelopment/SupportDevelopmentGuidTools.cs
new file mode 100644
index 000000000..2931147f7
--- /dev/null
+++ b/src/app/dev/DevToys.Blazor/BuiltInTools/SupportDevelopment/SupportDevelopmentGuidTools.cs
@@ -0,0 +1,174 @@
+using DevToys.Blazor.BuiltInTools.ExtensionsManager;
+
+namespace DevToys.Blazor.BuiltInTools.SupportDevelopment;
+
+[Export(typeof(IGuiTool))]
+[Name("SupportDevelopment")]
+[ToolDisplayInformation(
+ IconFontName = "FluentSystemIcons",
+ IconGlyph = '\uE6FF',
+ ResourceManagerAssemblyIdentifier = nameof(DevToysBlazorResourceManagerAssemblyIdentifier),
+ ResourceManagerBaseName = "DevToys.Blazor.BuiltInTools.SupportDevelopment.SupportDevelopment",
+ ShortDisplayTitleResourceName = nameof(SupportDevelopment.ShortDisplayTitle),
+ DescriptionResourceName = nameof(SupportDevelopment.Description),
+ AccessibleNameResourceName = nameof(SupportDevelopment.AccessibleName))]
+[MenuPlacement(MenuPlacement.Footer)]
+[NotFavorable]
+[NotSearchable]
+[NoCompactOverlaySupport]
+[Order(Before = ExtensionsManagerGuiTool.ExtensionmanagerToolName)]
+internal sealed class SupportDevelopmentGuidTools : IGuiTool
+{
+ // TODO: Finish this tool.
+ public UIToolView View
+ => new(
+ Stack()
+ .Vertical()
+ .MediumSpacing()
+ .WithChildren(
+
+ Label()
+ .Style(UILabelStyle.Caption)
+ .Text("This app is free, but its development has a cost (time, hardware and services). Here are many ways to support our work:"),
+
+ Card(
+ Stack()
+ .Vertical()
+ .SmallSpacing()
+ .WithChildren(
+
+ Label()
+ .Style(UILabelStyle.BodyStrong)
+ .Text("Buy extra features we made with ❤️"),
+
+ Wrap()
+ .WithChildren(
+
+ Button()
+ .HyperlinkAppearance()
+ .Text("My Extension 1"),
+
+ Button()
+ .HyperlinkAppearance()
+ .Text("My Extension 2")))),
+
+ Card(
+ Stack()
+ .Vertical()
+ .SmallSpacing()
+ .WithChildren(
+
+ Label()
+ .Style(UILabelStyle.BodyStrong)
+ .Text("Donate"),
+
+ Wrap()
+ .WithChildren(
+
+ Button()
+ .HyperlinkAppearance()
+ .Text("Sponsor our GitHub repository"),
+
+ Button()
+ .HyperlinkAppearance()
+ .Text("Donate with PayPal"),
+
+ Button()
+ .HyperlinkAppearance()
+ .Text("Donate with Buy Me A Coffee")))),
+
+ Card(
+ Stack()
+ .Vertical()
+ .SmallSpacing()
+ .WithChildren(
+
+ Label()
+ .Style(UILabelStyle.BodyStrong)
+ .Text("Talk about this app on social medias"),
+
+ Wrap()
+ .WithChildren(
+
+ Button()
+ .HyperlinkAppearance()
+ .Text("Share on X"),
+
+ Button()
+ .HyperlinkAppearance()
+ .Text("Share on Threads"),
+
+ Button()
+ .HyperlinkAppearance()
+ .Text("Share on LinkedIn"),
+
+ Button()
+ .HyperlinkAppearance()
+ .Text("Share on Reddit"),
+
+ Button()
+ .HyperlinkAppearance()
+ .Text("Share on Product Hunt"),
+
+ Button()
+ .HyperlinkAppearance()
+ .Text("Share on Hacker News")))),
+
+ Card(
+ Stack()
+ .Vertical()
+ .SmallSpacing()
+ .WithChildren(
+
+ Label()
+ .Style(UILabelStyle.BodyStrong)
+ .Text("Contribute to DevToys"),
+
+ Wrap()
+ .WithChildren(
+
+ Button()
+ .HyperlinkAppearance()
+ .Text("Translate the app"),
+
+ Button()
+ .HyperlinkAppearance()
+ .Text("Open an issue")))),
+
+ Card(
+ Stack()
+ .Vertical()
+ .SmallSpacing()
+ .WithChildren(
+
+ Label()
+ .Style(UILabelStyle.BodyStrong)
+ .Text("Rate the app"),
+
+ Wrap()
+ .WithChildren(
+
+ Button()
+ .HyperlinkAppearance()
+ .Text("Open Microsoft Store"),
+
+ Button()
+ .HyperlinkAppearance()
+ .Text("Open Apple AppStore"),
+
+ Button()
+ .HyperlinkAppearance()
+ .Text("Open Software Center"),
+
+ Button()
+ .HyperlinkAppearance()
+ .Text("Open WinGet"),
+
+ Button()
+ .HyperlinkAppearance()
+ .Text("Open Chocolatey"))))));
+
+ public void OnDataReceived(string dataTypeName, object? parsedData)
+ {
+ }
+}
diff --git a/src/app/dev/DevToys.Blazor/DevToys.Blazor.csproj b/src/app/dev/DevToys.Blazor/DevToys.Blazor.csproj
index ee73e6c16..9d81829eb 100644
--- a/src/app/dev/DevToys.Blazor/DevToys.Blazor.csproj
+++ b/src/app/dev/DevToys.Blazor/DevToys.Blazor.csproj
@@ -58,6 +58,10 @@
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
<Generator>ResXFileCodeGenerator</Generator>
</EmbeddedResource>
+ <EmbeddedResource Update="BuiltInTools\SupportDevelopment\SupportDevelopment.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>SupportDevelopment.Designer.cs</LastGenOutput>
+ </EmbeddedResource>
<Compile Update="BuiltInTools\ExtensionsManager\ExtensionsManager.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
@@ -68,6 +72,11 @@
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
</Compile>
+ <Compile Update="BuiltInTools\SupportDevelopment\SupportDevelopment.Designer.cs">
+ <DesignTime>True</DesignTime>
+ <AutoGen>True</AutoGen>
+ <DependentUpon>SupportDevelopment.resx</DependentUpon>
+ </Compile>
</ItemGroup>
<!-- Target ran on `dotnet restore -p:RestoreNpm=true` -->
diff --git a/src/app/dev/DevToys.Tools/DevToys.Tools.csproj b/src/app/dev/DevToys.Tools/DevToys.Tools.csproj
index 25b626041..fddb3b585 100644
--- a/src/app/dev/DevToys.Tools/DevToys.Tools.csproj
+++ b/src/app/dev/DevToys.Tools/DevToys.Tools.csproj
@@ -138,11 +138,6 @@
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
</Compile>
- <Compile Update="Tools\Test\Test.Designer.cs">
- <DependentUpon>Test.resx</DependentUpon>
- <DesignTime>True</DesignTime>
- <AutoGen>True</AutoGen>
- </Compile>
<Compile Update="Tools\Text\AnalyzerAndUtilities\AnalyzerAndUtilities.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
@@ -254,10 +249,6 @@
<LastGenOutput>ImageConverter.Designer.cs</LastGenOutput>
<Generator>ResXFileCodeGenerator</Generator>
</EmbeddedResource>
- <EmbeddedResource Update="Tools\Test\Test.resx">
- <LastGenOutput>Test.Designer.cs</LastGenOutput>
- <Generator>ResXFileCodeGenerator</Generator>
- </EmbeddedResource>
<EmbeddedResource Update="Tools\Text\AnalyzerAndUtilities\AnalyzerAndUtilities.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>AnalyzerAndUtilities.Designer.cs</LastGenOutput>
diff --git a/src/app/dev/DevToys.Tools/Tools/Test/TestGuiTool.cs b/src/app/dev/DevToys.Tools/Tools/Test/TestGuiTool.cs
deleted file mode 100644
index f4b7d411e..000000000
--- a/src/app/dev/DevToys.Tools/Tools/Test/TestGuiTool.cs
+++ /dev/null
@@ -1,245 +0,0 @@
-#if DEBUG
-using System.Text.Json;
-
-namespace DevToys.Tools.Tools.Test;
-
-[Export(typeof(IGuiTool))] // Register this class as a tool with a GUI.
-[Name("Test")] // Internal tool name.
-[ToolDisplayInformation(
- IconFontName = "FluentSystemIcons", // Font to use for the icon of the tool.
- IconGlyph = '\uE670', // Icon glyph
- ResourceManagerAssemblyIdentifier = nameof(DevToysToolsResourceManagerAssemblyIdentifier), // Reference to the IResourceManagerAssemblyIdentifier containing the resource manager
- ResourceManagerBaseName = "DevToys.Tools.Tools.Test.Test", // Full name to the .RESX.
- ShortDisplayTitleResourceName = nameof(Test.ShortDisplayTitle), // Name of the resource in the .RESX for the title of the tool.
- LongDisplayTitleResourceName = nameof(Test.ShortDisplayTitle),
- DescriptionResourceName = nameof(Test.Description),
- AccessibleNameResourceName = nameof(Test.AccessibleName))]
-[AcceptedDataTypeName(PredefinedCommonDataTypeNames.Json)] // Register this tool as supporting JSON from Smart Detection.
-[MenuPlacement(MenuPlacement.Footer)] // Place the tool in the footer of the menu
-internal sealed class TestGuiTool : IGuiTool
-{
- private enum GridTestRow
- {
- Header,
- Content,
- Footer
- }
-
- private enum GridTestColumn
- {
- Left,
- Right
- }
-
- private static readonly SettingDefinition<bool> DummyBooleanSetting
- = new(name: nameof(DummyBooleanSetting), defaultValue: true);
-
- public static readonly SettingDefinition<AvailableApplicationTheme> DummyListSetting
- = new(name: nameof(DummyListSetting), defaultValue: AvailableApplicationTheme.Default);
-
- private readonly ISettingsProvider _settingsProvider;
- private readonly IUIMultiLineTextInput _inputJsonEditor;
-
- [ImportingConstructor]
- public TestGuiTool(ISettingsProvider settingsProvider)
- {
- _settingsProvider = settingsProvider;
- _inputJsonEditor = MultilineTextInput();
- _inputJsonEditor.TextChanged += InputJsonEditor_TextChanged;
- }
-
- public UIToolView View
- => new(
- Grid()
- .ColumnLargeSpacing()
- .RowLargeSpacing()
-
- // Grid has 3 rows. One fit its content. One takes all the space available. One is 150px of height.
- .Rows(
- (GridTestRow.Header, Auto),
- (GridTestRow.Content, new UIGridLength(1, UIGridUnitType.Fraction)),
- (GridTestRow.Footer, 150))
-
- // Grid has 2 columns. One takes 2/3 of the space. One takes 1/3 of the space.
- .Columns(
- (GridTestColumn.Left, new UIGridLength(2, UIGridUnitType.Fraction)),
- (GridTestColumn.Right, new UIGridLength(1, UIGridUnitType.Fraction)))
-
- .Cells(
- // Cell that is at the top left in the grid.
- Cell(
- GridTestRow.Header,
- GridTestColumn.Left,
-
- Stack()
- .Vertical()
-
- .WithChildren(
- // Allow the user to import PNG, JPG, JPEG or BMP files.
- FileSelector()
- .CanSelectManyFiles()
- .LimitFileTypesTo("png", ".jpg", "*.jpeg", "BMP")
- .OnFilesSelected(OnFilesSelectedAsync),
-
- Wrap() // A horizontal Stack that wraps when needed.
- .WithChildren(
- Button().Text("Disable Input").OnClick(OnButtonClickAsync),
- Button().Text("Top Center button"),
- Button().Text("Top Right button")),
-
- Wrap() // A horizontal Stack that wraps when needed.
- .Disable()
- .WithChildren(
- Button().Text("Bottom Left button"),
- Button().Text("Bottom Center button"),
- Button().Text("Bottom Right button")))),
-
- // Cell that is at the top right in the grid.
- Cell(
- GridTestRow.Header,
- GridTestColumn.Right,
-
- DiffTextInput().Title("Just a diff editor")),
-
- // Cell that is at the Content Left in the grid.
- Cell(
- GridTestRow.Content,
- GridTestColumn.Left,
-
- Stack()
- .Vertical()
-
- .WithChildren(
- Label()
- .Style(UILabelStyle.Display)
- .Text("A large text"),
-
- SettingGroup()
- .Icon("FluentSystemIcons", '\uF6A9')
- .Title("Dummy list setting")
- .Description("Description")
-
- // Enum and struct settings can be handled automatically. Just need to set a list of items and associate them to a value.
- .Handle(
- _settingsProvider,
- DummyListSetting,
- OnDummyListSettingChangedAsync,
- Item("Use system settings", AvailableApplicationTheme.Default),
- Item("Light", AvailableApplicationTheme.Light),
- Item("Dark", AvailableApplicationTheme.Dark))
-
- .WithSettings(
- Setting()
- .Title("Dummy setting")
- // Boolean settings can also be handled automatically.
- .Handle(_settingsProvider, DummyBooleanSetting),
-
- Setting()
- .Title("Title")
- .Description("Description")
- // We can also set any kind of content in the setting card.
- .InteractiveElement(
- Button().Text("Button setting"))),
-
- InfoBar()
- .Title("Title")
- .Description("Description")
- .Informational()
- .WithActionButton("Click me", isAccent: false, actionOnClick: null)
- .Open())),
-
- // Cell that is at the Content Right in the grid.
- Cell(
- GridTestRow.Content,
- GridTestColumn.Right,
-
- Stack()
- .Vertical()
- .MediumSpacing()
-
- .WithChildren(
- SingleLineTextInput()
- .Title("Single-line input text"),
-
- NumberInput()
- .Title("Number input")
- .Maximum(100)
- .Minimum(0)
- .Step(0.5)
- .Value(1.5),
-
- SelectDropDownList()
- .AlignHorizontally(UIHorizontalAlignment.Left) // Align on the left.
- .Title("Left-aligned drop down list")
- .WithItems(
- Item("Item 1", value: null),
- Item("Item 2", value: null),
- Item("Item 3", value: null)))),
-
- // Cell that is in the Footer row and take the whole width of the grid (it takes the 2 columns).
- Cell(
- GridTestRow.Footer, GridTestRow.Footer, // This cell is in the last row
- GridTestColumn.Left, GridTestColumn.Right, // and spans from first to last column
-
- SplitGrid()
- .Vertical()
-
- .WithLeftPaneChild(
- _inputJsonEditor
- .Language("json")
- .Title("Input"))
-
- .WithRightPaneChild(
- DataGrid()
- .WithColumns("Column 1", "Column 2", "Column 3")
- .WithRows(
- Row(null, "Cell 1", "This is the Cell number 2", "Cell3"),
- Row(null, Cell("Cell 1"), Cell("Cell 2"), Cell(Button().Text("Cell 3"))),
- Row(null, Label().Text("Duis accusam sed eos veniam molestie invidunt vel invidunt magna kasd diam invidunt erat option diam. Ullamcorper euismod et justo ipsum lorem dolores nulla. Hendrerit odio ea dolor eos amet et ea vero. Ut consetetur et elitr nonumy."), "Cell 1", "This is the Cell number 2", "Cell3"),
- Row(null, "Cell 1", "This is the Cell number 2", "Cell3"),
- Row(null, "Cell 1", "This is the Cell number 2", "Cell3"),
- Row(null, "Cell 1", "This is the Cell number 2", "Cell3"),
- Row(null, "Cell 1", "This is the Cell number 2", "Cell3"),
- Row(null, "Cell 1", "This is the Cell number 2", "Cell3"))
- ))));
-
- // Smart detection handler.
- public void OnDataReceived(string dataTypeName, object? parsedData)
- {
- if (dataTypeName == PredefinedCommonDataTypeNames.Json && parsedData is Tuple<JsonDocument, string> strongTypedParsedData)
- {
- // Pass the JSON from Smart Detection into the Input text editor.
- _inputJsonEditor.Text(strongTypedParsedData.Item2);
- }
- }
-
- // Invoked when the user selects some files in the FileSelector.
- private ValueTask OnFilesSelectedAsync(SandboxedFileReader[] files)
- {
- for (int i = 0; i < files.Length; i++)
- {
- files[0].Dispose();
- }
- return ValueTask.CompletedTask;
- }
-
- // Invoked on click on "Disable Input" button.
- private ValueTask OnButtonClickAsync()
- {
- _inputJsonEditor.Disable();
- return ValueTask.CompletedTask;
- }
-
- // Invoked when user change the setting "DummyListSetting".
- private ValueTask OnDummyListSettingChangedAsync(AvailableApplicationTheme theme)
- {
- return ValueTask.CompletedTask;
- }
-
- // Invoked when Input text editor's text changed.
- private void InputJsonEditor_TextChanged(object? sender, EventArgs e)
- {
- string editorText = _inputJsonEditor.Text;
- }
-}
-#endif