diff --git a/.gitattributes b/.gitattributes index 361484f1..91a10970 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,2 @@ *.ico filter=lfs diff=lfs merge=lfs -text +**/Assets/*.png filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore index 55b656d2..22d3a9c3 100644 --- a/.gitignore +++ b/.gitignore @@ -458,4 +458,6 @@ $RECYCLE.BIN/ ## Custom ### Packages -nupkg/* \ No newline at end of file +nupkg/* + +**/*.Designer.cs \ No newline at end of file diff --git a/README.md b/README.md index 03538b47..724467d0 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,11 @@ Click [here][downloadPage] to get to the download section of this project on Git ## Found a bug or got a question? -Please head over to the [issue page][issuePage]. +Please head over to the [issue page][issuePage]. + +## Want to contribute? + +Either search for Tickets marked with help wanted or improve the translation on [crowdin] ## Plugins @@ -98,6 +102,7 @@ Technically the plugin will run with the user rights you did start the applicati [image-main-view-light]: https://i.imgur.com/lqmlo5U.png [downloadPage]: https://bitbucket.org/XanatosX/modulartoolmanager/downloads/ [issuePage]: https://bitbucket.org/XanatosX/modulartoolmanager/issues +[crowdin]: https://crowdin.com/project/modular-tool-manager [screenshot-1-dark]: https://imgur.com/mr3Folx.png [screenshot-1-light]: https://i.imgur.com/Fxgu18M.png [screenshot-2-dark]: https://i.imgur.com/LhMGcEx.png diff --git a/crowdin.yml b/crowdin.yml new file mode 100644 index 00000000..16aecbae --- /dev/null +++ b/crowdin.yml @@ -0,0 +1,5 @@ +files: + - source: src/ModularToolManager/Properties/Resources.resx + translation: /src/ModularToolManager/Properties/%file_name%.%two_letters_code%.%file_extension% + - source: src/DefaultPlugins/Translations/en-EN.json + translation: /src/DefaultPlugins/Translations/%locale%.%file_extension% diff --git a/src/DefaultPlugins/ScriptExecutionPlugin.cs b/src/DefaultPlugins/ScriptExecutionPlugin.cs index e49cc7a5..475a4a75 100644 --- a/src/DefaultPlugins/ScriptExecutionPlugin.cs +++ b/src/DefaultPlugins/ScriptExecutionPlugin.cs @@ -1,7 +1,6 @@ using DefaultPlugins.Information; using DefaultPlugins.ProcessStartStrategies; using ModularToolManagerPlugin.Attributes; -using ModularToolManagerPlugin.Enums; using ModularToolManagerPlugin.Models; using ModularToolManagerPlugin.Plugin; using ModularToolManagerPlugin.Services; @@ -10,7 +9,7 @@ namespace DefaultPlugins; /// -/// Plugin to run scripts on windows maschines +/// Plugin to run scripts on windows machines /// public sealed class ScriptExecutionPlugin : AbstractFunctionPlugin { @@ -22,7 +21,7 @@ public sealed class ScriptExecutionPlugin : AbstractFunctionPlugin /// /// The factory to use for creating starter objects /// - private DefaultScriptStarterFactory starterFactory; + private readonly DefaultScriptStarterFactory starterFactory; /// /// Fallback text if a translation is missing diff --git a/src/DefaultPlugins/Translations/de-DE.json b/src/DefaultPlugins/Translations/de-DE.json index ed21ae1d..f0c05fe5 100644 --- a/src/DefaultPlugins/Translations/de-DE.json +++ b/src/DefaultPlugins/Translations/de-DE.json @@ -1,50 +1,14 @@ -[ - { - "key": "script-displayname", - "value": "Skript ausführung" - }, - { - "key": "script-description", - "value": "Diese Plugin erlaubt Ihnen Skript-Dateien mit dem Modular Tool Manager auszuführen" - }, - { - "key": "binary-displayname", - "value": "Ausführbare Datei starten" - }, - { - "key": "binary-description", - "value": "Diese Plugin erlaubt es Ihnen Binäre Dateien mit dem Modular Tool Manager auszuführen" - }, - { - "key": "batch", - "value": "Batch-Skript" - }, - { - "key": "cmd", - "value": "CMD-Skript" - }, - { - "key": "powershell", - "value": "PowerShell-Skript" - }, - { - "key": "executable", - "value": "Ausführbare-Datei" - }, - { - "key": "error_cant_find_script_file", - "value": "Konnte das auszuführende Skript '{0}' nicht finden" - }, - { - "key": "error_cant_find_binary_file", - "value": "Konnte ausführbare datei '{0}' nicht finden" - }, - { - "key": "hide", - "value": "Terminal verstecken" - }, - { - "key": "adminRequired", - "value": "Als Administrator ausführen" - } -] \ No newline at end of file +{ + "script-displayname": "Skriptausführung", + "script-description": "Dieses Plugin erlaubt es Ihnen Skript-Dateien mit dem Modular Tool Manager auszuführen", + "binary-displayname": "Ausführbare Datei starten", + "binary-description": "Dieses Plugin erlaubt es Ihnen binäre Dateien mit dem Modular Tool Manager auszuführen", + "batch": "Batch-Skript", + "cmd": "CMD-Skript", + "powershell": "PowerShell-Skript", + "executable": "Ausführbare-Datei", + "error_cant_find_script_file": "Konnte das auszuführende Skript '{0}' nicht finden", + "error_cant_find_binary_file": "Konnte ausführbare Datei '{0}' nicht finden", + "hide": "Terminal verstecken", + "adminRequired": "Als Administrator ausführen" +} \ No newline at end of file diff --git a/src/DefaultPlugins/Translations/en-EN.json b/src/DefaultPlugins/Translations/en-EN.json index 373bef08..45649428 100644 --- a/src/DefaultPlugins/Translations/en-EN.json +++ b/src/DefaultPlugins/Translations/en-EN.json @@ -1,50 +1,14 @@ -[ - { - "key": "script-displayname", - "value": "Script execution" - }, - { - "key": "script-description", - "value": "This plugin will allow you to run scrip files with the modular tool manager" - }, - { - "key": "binary-displayname", - "value": "Start executable binary file" - }, - { - "key": "binary-description", - "value": "This plugin will allow you to run binary executable with the modular tool manager" - }, - { - "key": "batch", - "value": "Batch-Script" - }, - { - "key": "cmd", - "value": "CMD-Script" - }, - { - "key": "powershell", - "value": "PowerShell-Script" - }, - { - "key": "executable", - "value": "Executable-File" - }, - { - "key": "error_cant_find_script_file", - "value": "Could not find script '{0}' to execute" - }, - { - "key": "error_cant_find_binary_file", - "value": "Could not find binary file '{0}' to run" - }, - { - "key": "hide", - "value": "Hide command line" - }, - { - "key": "adminRequired", - "value": "Run as Administrator" - } -] \ No newline at end of file +{ + "script-displayname": "Script execution", + "script-description": "This plugin will allow you to run scrip files with the modular tool manager", + "binary-displayname": "Start executable binary file", + "binary-description": "This plugin will allow you to run binary executable with the modular tool manager", + "batch": "Batch-Script", + "cmd": "CMD-Script", + "powershell": "PowerShell-Script", + "executable": "Executable-File", + "error_cant_find_script_file": "Could not find script '{0}' to execute", + "error_cant_find_binary_file": "Could not find binary file '{0}' to run", + "hide": "Hide command line", + "adminRequired": "Run as Administrator" +} \ No newline at end of file diff --git a/src/ModularToolManager/App.axaml b/src/ModularToolManager/App.axaml index 4da76b88..da51b512 100644 --- a/src/ModularToolManager/App.axaml +++ b/src/ModularToolManager/App.axaml @@ -9,6 +9,7 @@ + diff --git a/src/ModularToolManager/App.axaml.cs b/src/ModularToolManager/App.axaml.cs index d09b0002..0bf836f6 100644 --- a/src/ModularToolManager/App.axaml.cs +++ b/src/ModularToolManager/App.axaml.cs @@ -4,9 +4,10 @@ using Avalonia.Markup.Xaml; using CommunityToolkit.Mvvm.Messaging; using Microsoft.Extensions.DependencyInjection; -using ModularToolManager.DependencyInjection; using ModularToolManager.Models.Messages; +using ModularToolManager.Services; using ModularToolManager.Services.Settings; +using ModularToolManager.Strategies; using ModularToolManager.ViewModels; using ModularToolManager.Views; using ModularToolManagerModel.Services.IO; @@ -37,12 +38,13 @@ private IServiceCollection BuildServiceCollection() { IServiceCollection collection = new ServiceCollection(); return collection.AddServices() - .AddViewModels() - .AddViews() - .AddLogging(config => - { - config.AddSerilog(CreateLoggerConfig(collection)); - }); + .AddViewModels() + .AddViews() + .AddStrategies() + .AddLogging(config => + { + config.AddSerilog(CreateLoggerConfig(collection)); + }); } /// @@ -77,7 +79,7 @@ private Serilog.ILogger CreateLoggerConfig(IServiceCollection collection) public override void OnFrameworkInitializationCompleted() { var provider = BuildServiceCollection().BuildServiceProvider(); - WeakReferenceMessenger.Default.Register(this, (_, e) => + WeakReferenceMessenger.Default.Register(this, (_, _) => { if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { diff --git a/src/ModularToolManager/Assets/built-with-avalonia.png b/src/ModularToolManager/Assets/built-with-avalonia.png new file mode 100644 index 00000000..b6d62854 --- /dev/null +++ b/src/ModularToolManager/Assets/built-with-avalonia.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:acd3ef1d9a149a2838e2fc5cd50a54043a0749c950b5b5c74dff849f62547db0 +size 49140 diff --git a/src/ModularToolManager/Converters/Serialization/ColorConverter.cs b/src/ModularToolManager/Converters/Serialization/ColorConverter.cs index 4efd2c6e..369b7aaa 100644 --- a/src/ModularToolManager/Converters/Serialization/ColorConverter.cs +++ b/src/ModularToolManager/Converters/Serialization/ColorConverter.cs @@ -69,7 +69,6 @@ public override Color Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSe case CurrentColorMode.Blue: blue = number; break; - default: break; } } } diff --git a/src/ModularToolManager/Converters/Serialization/CultureInfoJsonConverter.cs b/src/ModularToolManager/Converters/Serialization/CultureInfoJsonConverter.cs index 4b2ab2b1..8fe26547 100644 --- a/src/ModularToolManager/Converters/Serialization/CultureInfoJsonConverter.cs +++ b/src/ModularToolManager/Converters/Serialization/CultureInfoJsonConverter.cs @@ -21,10 +21,11 @@ internal class CultureInfoJsonConverter : JsonConverter CultureInfo? culture = null; try { - culture = CultureInfo.GetCultureInfo(isoThreeCode ?? String.Empty); + culture = CultureInfo.GetCultureInfo(isoThreeCode ?? string.Empty); } catch (Exception) { + // Culture not detected, returning null! } return culture; } diff --git a/src/ModularToolManager/DependencyInjection/DependencyInjectionExtension.cs b/src/ModularToolManager/DependencyInjection/DependencyInjectionExtension.cs deleted file mode 100644 index 1c28a223..00000000 --- a/src/ModularToolManager/DependencyInjection/DependencyInjectionExtension.cs +++ /dev/null @@ -1,107 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using ModularToolManager.Services.Dependencies; -using ModularToolManager.Services.IO; -using ModularToolManager.Services.Language; -using ModularToolManager.Services.Serialization; -using ModularToolManager.Services.Settings; -using ModularToolManager.Services.Styling; -using ModularToolManager.Services.Ui; -using ModularToolManager.ViewModels; -using ModularToolManager.Views; -using ModularToolManagerModel.DependencyInjection; -using ModularToolManagerModel.Services.Dependency; -using ModularToolManagerModel.Services.Functions; -using ModularToolManagerModel.Services.IO; -using ModularToolManagerModel.Services.Language; -using ModularToolManagerModel.Services.Logging; -using ModularToolManagerModel.Services.Plugin; -using ModularToolManagerModel.Services.Serialization; -using ModularToolManagerPlugin.Services; -using System; -using System.Text.Json; - -namespace ModularToolManager.DependencyInjection; - -/// -/// Static class to add services to depdency injeciton -/// Class will provide extensions methods for this use case -/// -internal static class DependencyInjectionExtension -{ - /// - /// Add all the avalonia default requirements - /// - /// The collection to extend - /// The extended collection - [Obsolete] - public static IServiceCollection AddAvaloniaDefault(this IServiceCollection collection) - { - return collection; - } - - /// - /// Add all the view model - /// - /// The collection to extend - /// The extended collection - public static IServiceCollection AddViewModels(this IServiceCollection collection) - { - return collection.AddTransient() - .AddTransient() - .AddTransient() - .AddTransient() - .AddTransient() - .AddTransient() - .AddTransient() - .AddTransient() - .AddTransient() - .AddTransient() - .AddTransient() - .AddTransient() - .AddTransient(); - } - - /// - /// Add all the views - /// - /// The collection to extend - /// The extended collection - public static IServiceCollection AddViews(this IServiceCollection collection) - { - return collection.AddTransient(resolver => new MainWindow( - resolver.GetRequiredService(), - resolver.GetRequiredService(), - resolver.GetRequiredService()) - { - DataContext = resolver?.GetService(), - }) - .AddTransient(); - } - - /// - /// Add all the services - /// - /// The collection to extend - /// The extended collection - public static IServiceCollection AddServices(this IServiceCollection collection) - { - return collection.AddAllModelDependencies() - .AddSingleton() - .AddSingleton() - .AddSingleton() - .AddSingleton() - .AddSingleton() - .AddSingleton() - .AddSingleton, JsonSerializationOptionFactory>() - .AddSingleton() - .AddSingleton() - .AddSingleton() - .AddSingleton() - .AddSingleton() - .AddSingleton() - .AddTransient() - .AddTransient() - .AddTransient() - .AddTransient(); - } -} diff --git a/src/ModularToolManager/Models/ApplicationSettings.cs b/src/ModularToolManager/Models/ApplicationSettings.cs index 6b5be4fe..8bd49940 100644 --- a/src/ModularToolManager/Models/ApplicationSettings.cs +++ b/src/ModularToolManager/Models/ApplicationSettings.cs @@ -1,4 +1,6 @@ -using System.Collections.Generic; +using ModularToolManager.Enums; +using ModularToolManager.Strategies.Filters; +using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text.Json.Serialization; @@ -61,6 +63,18 @@ public class ApplicationSettings [JsonPropertyName("search_autocomplete")] public bool EnableAutocompleteForFunctionSearch { get; set; } + /// + /// Setting to get the search filter name to use as a default + /// + [JsonPropertyName("search_filter")] + public string SearchFilterTypeName { get; set; } = nameof(FunctionButtonFuzzyFilter); + + /// + /// The window position to use by the application. Set to bottom right by default + /// + [JsonPropertyName("window_position")] + public WindowPositionEnum WindowPosition { get; set; } = WindowPositionEnum.BottomRight; + /// /// Create a new instance of this class /// diff --git a/src/ModularToolManager/ModularToolManager.csproj b/src/ModularToolManager/ModularToolManager.csproj index 29030eb6..a6022233 100644 --- a/src/ModularToolManager/ModularToolManager.csproj +++ b/src/ModularToolManager/ModularToolManager.csproj @@ -4,18 +4,46 @@ net7.0 enable Assets\application-logo.ico + PrepareResources;$(CompileDependsOn) + + + + + MSBuild:Compile + true + Resources.Designer.cs + $(IntermediateOutputPath)\Resources.Designer.cs + CSharp + ModularToolManager.Properties + Resources + + + + + + MSBuild:Compile + true + Properties.Designer.cs + $(IntermediateOutputPath)\Properties.Designer.cs + CSharp + ModularToolManager.Properties + Properties + + + + @@ -30,6 +58,7 @@ + @@ -53,6 +82,9 @@ AllPluginsView.axaml + + FunctionSearchFilterView.axaml + HotkeysView.axaml diff --git a/src/ModularToolManager/Properties/Properties.Designer.cs b/src/ModularToolManager/Properties/Properties.Designer.cs deleted file mode 100644 index c082c481..00000000 --- a/src/ModularToolManager/Properties/Properties.Designer.cs +++ /dev/null @@ -1,189 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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. -// -//------------------------------------------------------------------------------ - -namespace ModularToolManager.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // 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()] - internal class Properties { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Properties() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ModularToolManager.Properties.Properties", typeof(Properties).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to Modular Tool Manager. - /// - internal static string ApplicationName { - get { - return ResourceManager.GetString("ApplicationName", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to eng. - /// - internal static string FallbackLanguage { - get { - return ResourceManager.GetString("FallbackLanguage", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to functions.dat. - /// - internal static string FunctionsFile { - get { - return ResourceManager.GetString("FunctionsFile", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to https://github.com/XanatosX/ModularToolManager/issues. - /// - internal static string GitHubIssueUrl { - get { - return ResourceManager.GetString("GitHubIssueUrl", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to https://github.com/XanatosX/ModularToolManager/. - /// - internal static string GitHubUrl { - get { - return ResourceManager.GetString("GitHubUrl", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to https://xanatosx.github.io/ModularToolManager/user/user-manual.html. - /// - internal static string GitHubUserManual { - get { - return ResourceManager.GetString("GitHubUserManual", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to question_circle_regular. - /// - internal static string Icon_About { - get { - return ResourceManager.GetString("Icon_About", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to edit_regular. - /// - internal static string Icon_edit_function { - get { - return ResourceManager.GetString("Icon_edit_function", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to eye_hide_regular. - /// - internal static string Icon_hide { - get { - return ResourceManager.GetString("Icon_hide", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to keyboard_regular. - /// - internal static string Icon_Keyboard { - get { - return ResourceManager.GetString("Icon_Keyboard", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to flag_regular. - /// - internal static string Icon_language { - get { - return ResourceManager.GetString("Icon_language", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to add_circle_regular. - /// - internal static string Icon_new_function { - get { - return ResourceManager.GetString("Icon_new_function", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to settings_regular. - /// - internal static string Icon_settings { - get { - return ResourceManager.GetString("Icon_settings", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to settings.set. - /// - internal static string SettingsFile { - get { - return ResourceManager.GetString("SettingsFile", resourceCulture); - } - } - } -} diff --git a/src/ModularToolManager/Properties/Properties.resx b/src/ModularToolManager/Properties/Properties.resx index caae8829..9ff37f96 100644 --- a/src/ModularToolManager/Properties/Properties.resx +++ b/src/ModularToolManager/Properties/Properties.resx @@ -120,6 +120,9 @@ Modular Tool Manager + + https://avaloniaui.net/ + eng diff --git a/src/ModularToolManager/Properties/Resources.Designer.cs b/src/ModularToolManager/Properties/Resources.Designer.cs deleted file mode 100644 index 37d228db..00000000 --- a/src/ModularToolManager/Properties/Resources.Designer.cs +++ /dev/null @@ -1,873 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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. -// -//------------------------------------------------------------------------------ - -namespace ModularToolManager.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // 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 Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [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("ModularToolManager.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to Dependencies. - /// - public static string About_Dependency { - get { - return ResourceManager.GetString("About_Dependency", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to User Manual. - /// - public static string About_GitHubUserManual { - get { - return ResourceManager.GetString("About_GitHubUserManual", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to License. - /// - public static string About_License { - get { - return ResourceManager.GetString("About_License", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Repository:. - /// - public static string About_Repository_Colon { - get { - return ResourceManager.GetString("About_Repository_Colon", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Version:. - /// - public static string About_Version_Colon { - get { - return ResourceManager.GetString("About_Version_Colon", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Path to function. - /// - public static string AddFunction_FunctionPathWatermark { - get { - return ResourceManager.GetString("AddFunction_FunctionPathWatermark", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Information. - /// - public static string AllPlugins_Header_Information { - get { - return ResourceManager.GetString("AllPlugins_Header_Information", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Enter function order mode. - /// - public static string AllPlugins_Header_OrderModeEnter { - get { - return ResourceManager.GetString("AllPlugins_Header_OrderModeEnter", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Does enter the order mode, this allows you to sort the functions as you like based on a number value. - /// - public static string AllPlugins_Header_OrderModeEnter_Tooltip { - get { - return ResourceManager.GetString("AllPlugins_Header_OrderModeEnter_Tooltip", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Leave function order mode. - /// - public static string AllPlugins_Header_OrderModeLeave { - get { - return ResourceManager.GetString("AllPlugins_Header_OrderModeLeave", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Does leave the order mode, without saving it. - /// - public static string AllPlugins_Header_OrderModeLeave_Tooltip { - get { - return ResourceManager.GetString("AllPlugins_Header_OrderModeLeave_Tooltip", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Save new function order. - /// - public static string AllPlugins_Header_OrderModeSave { - get { - return ResourceManager.GetString("AllPlugins_Header_OrderModeSave", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Does leave the order mode and does save the changes. - /// - public static string AllPlugins_Header_OrderModeSave_Tooltip { - get { - return ResourceManager.GetString("AllPlugins_Header_OrderModeSave_Tooltip", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Settings. - /// - public static string AllPlugins_Header_Settings { - get { - return ResourceManager.GetString("AllPlugins_Header_Settings", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Blue Theme. - /// - public static string App_Blue_Theme { - get { - return ResourceManager.GetString("App_Blue_Theme", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to A Theme which mainly uses the color blue as a background. - /// - public static string App_Blue_Theme_Description { - get { - return ResourceManager.GetString("App_Blue_Theme_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Dark mode. - /// - public static string App_Dark_Theme { - get { - return ResourceManager.GetString("App_Dark_Theme", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Dark theme for the application. - /// - public static string App_Dark_Theme_Description { - get { - return ResourceManager.GetString("App_Dark_Theme_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Green Theme. - /// - public static string App_Green_Theme { - get { - return ResourceManager.GetString("App_Green_Theme", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to A Theme which mainly uses the color green as a background. - /// - public static string App_Green_Theme_Description { - get { - return ResourceManager.GetString("App_Green_Theme_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Light mode. - /// - public static string App_Light_Theme { - get { - return ResourceManager.GetString("App_Light_Theme", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Light theme for the application. - /// - public static string App_Light_Theme_Description { - get { - return ResourceManager.GetString("App_Light_Theme_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Orange Theme. - /// - public static string App_Orange_Theme { - get { - return ResourceManager.GetString("App_Orange_Theme", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to A Theme which mainly uses the color orange as a background. - /// - public static string App_Orange_Theme_Description { - get { - return ResourceManager.GetString("App_Orange_Theme_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Red Theme. - /// - public static string App_Red_Theme { - get { - return ResourceManager.GetString("App_Red_Theme", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to A Theme which mainly uses the color red as a background. - /// - public static string App_Red_Theme_Description { - get { - return ResourceManager.GetString("App_Red_Theme_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Modular Tool Manager. - /// - public static string Application_Name { - get { - return ResourceManager.GetString("Application_Name", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Open project website. - /// - public static string Button_Open_Project { - get { - return ResourceManager.GetString("Button_Open_Project", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Delete. - /// - public static string Default_Delete { - get { - return ResourceManager.GetString("Default_Delete", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Edit. - /// - public static string Default_Edit { - get { - return ResourceManager.GetString("Default_Edit", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Abort. - /// - public static string DefaultButton_Abort { - get { - return ResourceManager.GetString("DefaultButton_Abort", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Ok. - /// - public static string DefaultButton_Ok { - get { - return ResourceManager.GetString("DefaultButton_Ok", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to .... - /// - public static string DefaultButton_OpenFile { - get { - return ResourceManager.GetString("DefaultButton_OpenFile", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Save. - /// - public static string DefaultButton_Save { - get { - return ResourceManager.GetString("DefaultButton_Save", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to License. - /// - public static string Dependency_License { - get { - return ResourceManager.GetString("Dependency_License", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Project. - /// - public static string Dependency_Project { - get { - return ResourceManager.GetString("Dependency_Project", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Either the path saved on this function is missing, the extension is wrong or the plugin for execution was removed. Please edit the function to fix the error.. - /// - public static string FunctionButton_Method_Error { - get { - return ResourceManager.GetString("FunctionButton_Method_Error", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Sorting Order. - /// - public static string FunctionButton_Sort_Watermark { - get { - return ResourceManager.GetString("FunctionButton_Sort_Watermark", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Search for function. - /// - public static string FunctionSelection_SearchForFunction { - get { - return ResourceManager.GetString("FunctionSelection_SearchForFunction", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Abort the current action or close the current modal. - /// - public static string Hotkey_Abort_Description { - get { - return ResourceManager.GetString("Hotkey_Abort_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Abort. - /// - public static string Hotkey_Abort_Name { - get { - return ResourceManager.GetString("Hotkey_Abort_Name", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Change Language, Add/Edit Function, Settings. - /// - public static string Hotkey_Abort_WorkingOn { - get { - return ResourceManager.GetString("Hotkey_Abort_WorkingOn", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Working at the following places:. - /// - public static string Hotkey_Abort_WorkingOn_Prefix_Colon { - get { - return ResourceManager.GetString("Hotkey_Abort_WorkingOn_Prefix_Colon", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Open the about page of the application. - /// - public static string Hotkey_About_Description { - get { - return ResourceManager.GetString("Hotkey_About_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to About page. - /// - public static string Hotkey_About_Name { - get { - return ResourceManager.GetString("Hotkey_About_Name", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Hide the application into the system tray. - /// - public static string Hotkey_Hide_Description { - get { - return ResourceManager.GetString("Hotkey_Hide_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Hide Application. - /// - public static string Hotkey_Hide_Name { - get { - return ResourceManager.GetString("Hotkey_Hide_Name", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Open the change language dialog. - /// - public static string Hotkey_Language_Description { - get { - return ResourceManager.GetString("Hotkey_Language_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Change Application language. - /// - public static string Hotkey_Language_Name { - get { - return ResourceManager.GetString("Hotkey_Language_Name", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Main Window. - /// - public static string Hotkey_Main_Window_WorkinOn { - get { - return ResourceManager.GetString("Hotkey_Main_Window_WorkinOn", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Create a new function. - /// - public static string Hotkey_New_Description { - get { - return ResourceManager.GetString("Hotkey_New_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to New Function. - /// - public static string Hotkey_New_Name { - get { - return ResourceManager.GetString("Hotkey_New_Name", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Report a bug found within the application. - /// - public static string Hotkey_Report_Bug_Description { - get { - return ResourceManager.GetString("Hotkey_Report_Bug_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Report bug. - /// - public static string Hotkey_Report_Bug_Name { - get { - return ResourceManager.GetString("Hotkey_Report_Bug_Name", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to ctrl. - /// - public static string Key_Ctrl { - get { - return ResourceManager.GetString("Key_Ctrl", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Esc. - /// - public static string Key_Esc { - get { - return ResourceManager.GetString("Key_Esc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to F1. - /// - public static string Key_F1 { - get { - return ResourceManager.GetString("Key_F1", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to F12. - /// - public static string Key_F12 { - get { - return ResourceManager.GetString("Key_F12", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to h. - /// - public static string Key_H { - get { - return ResourceManager.GetString("Key_H", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to l. - /// - public static string Key_L { - get { - return ResourceManager.GetString("Key_L", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to n. - /// - public static string Key_N { - get { - return ResourceManager.GetString("Key_N", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to File. - /// - public static string Menu_File { - get { - return ResourceManager.GetString("Menu_File", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Help. - /// - public static string Menu_Help { - get { - return ResourceManager.GetString("Menu_Help", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Function Description. - /// - public static string NewFunction_Description { - get { - return ResourceManager.GetString("NewFunction_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Function Display Name. - /// - public static string NewFunction_Name { - get { - return ResourceManager.GetString("NewFunction_Name", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Function Parameters. - /// - public static string NewFunction_Parameters { - get { - return ResourceManager.GetString("NewFunction_Parameters", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Authors:. - /// - public static string Plugin_Authors_Colon { - get { - return ResourceManager.GetString("Plugin_Authors_Colon", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Description:. - /// - public static string Plugin_Description_Colon { - get { - return ResourceManager.GetString("Plugin_Description_Colon", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Name:. - /// - public static string Plugin_DisplayName_Colon { - get { - return ResourceManager.GetString("Plugin_DisplayName_Colon", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to License:. - /// - public static string Plugin_License_Colon { - get { - return ResourceManager.GetString("Plugin_License_Colon", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Project url:. - /// - public static string Plugin_Url_Colon { - get { - return ResourceManager.GetString("Plugin_Url_Colon", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Running with Avalonia UI. - /// - public static string RunningWith { - get { - return ResourceManager.GetString("RunningWith", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Enable Autocomplete for function search. - /// - public static string Settings_AllowAutocompleteForFunctionSearch { - get { - return ResourceManager.GetString("Settings_AllowAutocompleteForFunctionSearch", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Clear function search if function was executed. - /// - public static string Settings_ClearSearchAfterFunctionExecute { - get { - return ResourceManager.GetString("Settings_ClearSearchAfterFunctionExecute", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Close if a function was executed. - /// - public static string Settings_CloseOnFunctionExecute { - get { - return ResourceManager.GetString("Settings_CloseOnFunctionExecute", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Keep on Top. - /// - public static string Settings_KeepOnTop { - get { - return ResourceManager.GetString("Settings_KeepOnTop", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Show in Taskbar. - /// - public static string Settings_ShowInTaskbar { - get { - return ResourceManager.GetString("Settings_ShowInTaskbar", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Start minimized. - /// - public static string Settings_StartMinimized { - get { - return ResourceManager.GetString("Settings_StartMinimized", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to About. - /// - public static string SubMenu_About { - get { - return ResourceManager.GetString("SubMenu_About", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Exit. - /// - public static string SubMenu_Exit { - get { - return ResourceManager.GetString("SubMenu_Exit", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Hide. - /// - public static string SubMenu_Hide { - get { - return ResourceManager.GetString("SubMenu_Hide", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Hotkeys. - /// - public static string SubMenu_Hotkeys { - get { - return ResourceManager.GetString("SubMenu_Hotkeys", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Language. - /// - public static string SubMenu_Language { - get { - return ResourceManager.GetString("SubMenu_Language", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to New Function. - /// - public static string SubMenu_NewFunction { - get { - return ResourceManager.GetString("SubMenu_NewFunction", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Plugins. - /// - public static string SubMenu_Plugins { - get { - return ResourceManager.GetString("SubMenu_Plugins", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Report Bug. - /// - public static string SubMenu_ReportBug { - get { - return ResourceManager.GetString("SubMenu_ReportBug", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Settings. - /// - public static string SubMenu_Settings { - get { - return ResourceManager.GetString("SubMenu_Settings", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Hide the application. - /// - public static string Tooltip_Hide { - get { - return ResourceManager.GetString("Tooltip_Hide", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Show the application. - /// - public static string Tooltip_Show { - get { - return ResourceManager.GetString("Tooltip_Show", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Edit function. - /// - public static string Window_EditFunction { - get { - return ResourceManager.GetString("Window_EditFunction", resourceCulture); - } - } - } -} diff --git a/src/ModularToolManager/Properties/Resources.de.resx b/src/ModularToolManager/Properties/Resources.de.resx index 84dcffb1..cd80fe14 100644 --- a/src/ModularToolManager/Properties/Resources.de.resx +++ b/src/ModularToolManager/Properties/Resources.de.resx @@ -59,46 +59,46 @@ : using a System.ComponentModel.TypeConverter : and then encoded with base64 encoding. --> - - + + - + - - - - + + + + - - + + - - + + - - - - + + + + - + - + @@ -120,7 +120,7 @@ Abhängigkeiten - + Benutzerhandbuch @@ -145,25 +145,28 @@ Den Funktionen Sortiermodus aktivieren, dieser Modus erlaubt es eine Sortiernummer an den Funktionen zu hinterlegen. Diese Nummer wird für die Sortierung genutzt - Neue Funktions Sortierung verwerfen + Neue Funktionssortierung verwerfen - Den Funktionen Sortiermodus verlassen ohne die Änderungen zu speichern + Den Funktionen Sortiermodus verlassen, ohne die Änderungen zu speichern Neue Sortierung speichern - Speichern der neuen Funktionen sortierung + Speichern der neuen Sortierung Einstellungen + + Modular Tool Manager + Blaues Thema - Ein Theme welches um die Farbe Blau aufgebaut ist. Diese wirkt sich hauptsächlich auf den Hintergrund aus. + Ein Theme welches um die Farbe Blau aufgebaut ist. Diese wirkt sich hauptsächlich auf den Hintergrund aus Dunkler Modus @@ -175,7 +178,7 @@ Grünes Thema - Ein Theme welches um die Farbe Grün aufgebaut ist. Diese wirkt sich hauptsächlich auf den Hintergrund aus. + Ein Theme welches um die Farbe Grün aufgebaut ist. Diese wirkt sich hauptsächlich auf den Hintergrund aus Heller Modus @@ -187,13 +190,13 @@ Orangenes Thema - Ein Theme welches um die Farbe Orange aufgebaut ist. Diese wirkt sich hauptsächlich auf den Hintergrund aus. + Ein Theme welches um die Farbe Orange aufgebaut ist. Diese wirkt sich hauptsächlich auf den Hintergrund aus Rotes Thema - Ein Theme welches um die Farbe Rot aufgebaut ist. Diese wirkt sich hauptsächlich auf den Hintergrund aus. + Ein Theme welches um die Farbe Rot aufgebaut ist. Diese wirkt sich hauptsächlich auf den Hintergrund aus Projekt Website im Browser öffnen @@ -204,6 +207,9 @@ Ok + + ... + Speichern @@ -213,20 +219,41 @@ Editieren + + Lizenz + + + Projekt + + + Ein Filter welcher prüft ob das komplette Wort innerhalb des Namens vorkommt + + + Beinhaltet Filter + + + Ein Filter welcher eine "Fuzzy search" auf die Einträge durchführt + + + Fuzzy Filter + Entweder der Dateipfad ist falsch, die Dateiendung entspricht nicht der erwarteten oder das entsprechend Plugin wurde entfernt. Bitte editieren Sie die Funktion um den Fehler zu beheben. + + Sortieranordnung + Nach Funktion suchen - Aktuelle aktion abbrechen + Aktuelle Aktion abbrechen - Abbrechen des aktuellen vorgangs + Abbrechen des aktuellen Vorgangs - Sprache ändern, Funktion hinzufügen/Ändern, Einstellungs Fenster + Sprache ändern, Funktion hinzufügen/Ändern, Einstellungsfenster Funktioniert an folgenden Stellen: @@ -259,11 +286,32 @@ Neuer Funktion - Report a bug found within the application + Fehler innerhalb der Anwendung melden Fehler melden + + strg + + + Esc + + + F1 + + + F12 + + + h + + + l + + + n + Datei @@ -277,7 +325,7 @@ Funktionsanzeigename - Funktions Parameter + Funktionsparameter Autoren: @@ -298,13 +346,13 @@ Läuft mit Avalonia UI - Automatische vervollständigung für Funktionsfilter aktivieren + Automatische Vervollständigung für Funktionsfilter aktivieren - Suche löschen nachdem eine Funktion ausgeführt wurde + Suche löschen, nachdem eine Funktion ausgeführt wurde - Applikation schließen nachdem Funktion ausgeführt wurde + Applikation schließen, nachdem Funktion ausgeführt wurde Immer über anderen Fenstern @@ -315,6 +363,18 @@ Minimiert starten + + Unten links + + + Unten rechts + + + Oben links + + + Oben rechts + Über @@ -333,6 +393,9 @@ Neue Funktion + + Plugins + Fehler Melden @@ -340,10 +403,10 @@ Einstellungen - Application minimieren + Applikation minimieren - Application anzeigen + Applikation anzeigen Funktion anpassen diff --git a/src/ModularToolManager/Properties/Resources.resx b/src/ModularToolManager/Properties/Resources.resx index 74781a69..188e5b66 100644 --- a/src/ModularToolManager/Properties/Resources.resx +++ b/src/ModularToolManager/Properties/Resources.resx @@ -225,6 +225,18 @@ Project + + A filter checking if the item does contain the search string as a whole + + + Contains Filter + + + A filter using fuzzy search to check if an item is valid + + + Fuzzy Filter + Either the path saved on this function is missing, the extension is wrong or the plugin for execution was removed. Please edit the function to fix the error. @@ -351,6 +363,18 @@ Start minimized + + Bottom Left + + + Bottom Right + + + Top Left + + + Top Right + About diff --git a/src/ModularToolManager/Resources/ImageButtonStyle.axaml b/src/ModularToolManager/Resources/ImageButtonStyle.axaml new file mode 100644 index 00000000..c73a750a --- /dev/null +++ b/src/ModularToolManager/Resources/ImageButtonStyle.axaml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + diff --git a/src/ModularToolManager/Resources/LinkButtonStyle.axaml b/src/ModularToolManager/Resources/LinkButtonStyle.axaml index c124d74c..cbf9d009 100644 --- a/src/ModularToolManager/Resources/LinkButtonStyle.axaml +++ b/src/ModularToolManager/Resources/LinkButtonStyle.axaml @@ -27,4 +27,8 @@ + + diff --git a/src/ModularToolManager/Services/DepedencyInjection.cs b/src/ModularToolManager/Services/DepedencyInjection.cs new file mode 100644 index 00000000..035afeac --- /dev/null +++ b/src/ModularToolManager/Services/DepedencyInjection.cs @@ -0,0 +1,49 @@ +using Microsoft.Extensions.DependencyInjection; +using ModularToolManager.Services.Dependencies; +using ModularToolManager.Services.IO; +using ModularToolManager.Services.Language; +using ModularToolManager.Services.Settings; +using ModularToolManager.Services.Styling; +using ModularToolManager.Services.Ui; +using ModularToolManagerModel.DependencyInjection; +using ModularToolManagerModel.Services.Dependency; +using ModularToolManagerModel.Services.IO; +using ModularToolManagerModel.Services.Language; +using ModularToolManagerModel.Services.Serialization; +using ModularToolManagerPlugin.Services; +using System.Text.Json; + +namespace ModularToolManager.Services; + +/// +/// Dependency Injection for services +/// +public static class DependencyInjection +{ + /// + /// Add all the services + /// + /// The collection to extend + /// The extended collection + public static IServiceCollection AddServices(this IServiceCollection collection) + { + return collection.AddAllModelDependencies() + .AddSingleton() + .AddSingleton() + .AddSingleton() + .AddSingleton() + .AddSingleton() + .AddSingleton() + .AddSingleton, JsonSerializationOptionFactory>() + .AddSingleton() + .AddSingleton() + .AddSingleton() + .AddSingleton() + .AddSingleton() + .AddSingleton() + .AddTransient() + .AddTransient() + .AddTransient() + .AddTransient(); + } +} \ No newline at end of file diff --git a/src/ModularToolManager/Services/IO/GetApplicationInformationService.cs b/src/ModularToolManager/Services/IO/GetApplicationInformationService.cs index 51af6acd..a08ac3b2 100644 --- a/src/ModularToolManager/Services/IO/GetApplicationInformationService.cs +++ b/src/ModularToolManager/Services/IO/GetApplicationInformationService.cs @@ -149,4 +149,11 @@ public IEnumerable GetHotkeys() return returnHotkeys; } + + /// + /// Get the url for the avalonia UI project + /// + /// The avalonia ui project url + public string GetAvaloniaProjectUrl() => Properties.Properties.AvaloniaProjectUrl; + } diff --git a/src/ModularToolManager/Services/Language/PluginTranslationService.cs b/src/ModularToolManager/Services/Language/PluginTranslationService.cs index 0e3e239f..8ce27f63 100644 --- a/src/ModularToolManager/Services/Language/PluginTranslationService.cs +++ b/src/ModularToolManager/Services/Language/PluginTranslationService.cs @@ -167,7 +167,20 @@ private string GetLanguageFromPath(string path) /// A list with all possible translations private List GetTranslationsFromFile(Assembly assembly, string cultureFile) { - return JsonSerializer.Deserialize>(LoadResourceData(assembly, cultureFile)) ?? new(); + List translations = new(); + try + { + var data = JsonSerializer.Deserialize>(LoadResourceData(assembly, cultureFile)); + foreach (var item in data) + { + translations.Add(new TranslationModel { Key = item.Key, Value = item.Value }); + } + } + catch (System.Exception e) + { + logger.LogError(e, "Error trying to parse translation file"); + } + return translations; } /// diff --git a/src/ModularToolManager/Services/Language/ResourceCultureService.cs b/src/ModularToolManager/Services/Language/ResourceCultureService.cs index 1b7d55ec..c7c1c8f1 100644 --- a/src/ModularToolManager/Services/Language/ResourceCultureService.cs +++ b/src/ModularToolManager/Services/Language/ResourceCultureService.cs @@ -113,8 +113,9 @@ public List GetAvailableCultures() { returnCulture = CultureInfo.GetCultureInfo(Properties.Properties.FallbackLanguage); } - catch (System.Exception) + catch (System.Exception e) { + logger.LogWarning($"Could not get culture fallback with error {e.Message}"); } return returnCulture; } diff --git a/src/ModularToolManager/Services/Settings/ISettingsService.cs b/src/ModularToolManager/Services/Settings/ISettingsService.cs index 5f97aa40..5b03c752 100644 --- a/src/ModularToolManager/Services/Settings/ISettingsService.cs +++ b/src/ModularToolManager/Services/Settings/ISettingsService.cs @@ -17,9 +17,9 @@ public interface ISettingsService /// /// Change the application settings /// - /// The current settings to change + /// The current settings to change /// True if changing was successful - bool ChangeSettings(Action changeSettings); + bool ChangeSettings(Action changeSettingsAction); /// /// Save the application settings diff --git a/src/ModularToolManager/Services/Settings/SerializedSettingsService.cs b/src/ModularToolManager/Services/Settings/SerializedSettingsService.cs index a16dcbef..c5ba93cd 100644 --- a/src/ModularToolManager/Services/Settings/SerializedSettingsService.cs +++ b/src/ModularToolManager/Services/Settings/SerializedSettingsService.cs @@ -48,14 +48,14 @@ public SerializedSettingsService(ISerializeService serializer, } /// - public bool ChangeSettings(Action changeSettings) + public bool ChangeSettings(Action changeSettingsAction) { - if (changeSettings is null) + if (changeSettingsAction is null) { return false; } ApplicationSettings settings = GetApplicationSettings(); - changeSettings(settings); + changeSettingsAction(settings); return settings is not null ? SaveApplicationSettings(settings) : false; } @@ -66,7 +66,7 @@ public ApplicationSettings GetApplicationSettings() { return cachedApplicationSettings; } - ApplicationSettings returnData = new ApplicationSettings() + ApplicationSettings returnData = new ApplicationSettings { ShowInTaskbar = true, EnableAutocompleteForFunctionSearch = true, diff --git a/src/ModularToolManager/Services/Styling/DefaultStyleService.cs b/src/ModularToolManager/Services/Styling/DefaultStyleService.cs index abfd2d75..f3130303 100644 --- a/src/ModularToolManager/Services/Styling/DefaultStyleService.cs +++ b/src/ModularToolManager/Services/Styling/DefaultStyleService.cs @@ -43,8 +43,6 @@ public IEnumerable GetCurrentAppIncludeStyles() { return Enumerable.Empty(); } - var styles = App.Current.Styles.Where(style => style.GetType() == typeof(Styles)).ToList(); ; - var types = styles.Select(style => style.GetType()); return App.Current?.Styles.Where(style => style.GetType() == typeof(Styles)) ?? Enumerable.Empty(); } @@ -54,7 +52,6 @@ public IEnumerable GetCurrentAppIncludeStyles() /// public T? GetStyleByName(IStyle? style, string name) where T : AvaloniaObject { - var test = GetCurrentAppIncludeStyles(); return GetAllStylesWithinResource(style) .Where(style => style.Resources.Count > 0) .Where(style => style.Resources.ContainsKey(name)) diff --git a/src/ModularToolManager/Services/Ui/DefaultWindowPositionStrategyFactory.cs b/src/ModularToolManager/Services/Ui/DefaultWindowPositionStrategyFactory.cs index 66510cee..879fdf56 100644 --- a/src/ModularToolManager/Services/Ui/DefaultWindowPositionStrategyFactory.cs +++ b/src/ModularToolManager/Services/Ui/DefaultWindowPositionStrategyFactory.cs @@ -14,6 +14,9 @@ public class DefaultWindowPositionStrategyFactory : IWindowPositionFactory return positionEnum switch { WindowPositionEnum.BottomRight => new BottomRightStrategy(), + WindowPositionEnum.BottomLeft => new BottomLeftStrategy(), + WindowPositionEnum.TopLeft => new TopLeftStrategy(), + WindowPositionEnum.TopRight => new TopRightStrategy(), _ => new BottomRightStrategy() }; } diff --git a/src/ModularToolManager/Services/Ui/WindowManagementService.cs b/src/ModularToolManager/Services/Ui/WindowManagementService.cs index 94a12fe8..915c565a 100644 --- a/src/ModularToolManager/Services/Ui/WindowManagementService.cs +++ b/src/ModularToolManager/Services/Ui/WindowManagementService.cs @@ -145,7 +145,7 @@ public async Task ShowModalWindowAsync(ShowWindowModel modalData, Window? parent public async Task ShowOpenFileDialogAsync(ShowOpenFileDialogModel fileDialogModel, Window parent) { IStorageFolder? initialDirectory = await parent.StorageProvider.TryGetFolderFromPathAsync(fileDialogModel.InitialDirectory ?? string.Empty); - var files = await parent.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions() { + var files = await parent.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions { AllowMultiple = fileDialogModel.AllowMultipleSelection, FileTypeFilter = fileDialogModel.FileDialogFilters.ToList(), SuggestedStartLocation = initialDirectory diff --git a/src/ModularToolManager/Strategies/DependencyInjection.cs b/src/ModularToolManager/Strategies/DependencyInjection.cs new file mode 100644 index 00000000..3721291d --- /dev/null +++ b/src/ModularToolManager/Strategies/DependencyInjection.cs @@ -0,0 +1,21 @@ +using Microsoft.Extensions.DependencyInjection; +using ModularToolManager.Strategies.Filters; + +namespace ModularToolManager.Strategies; + +/// +/// Dependency Injection for strategies +/// +public static class DependencyInjection +{ + /// + /// Add all the strategies + /// + /// The collection to extend + /// The extended collection + public static IServiceCollection AddStrategies(this IServiceCollection collection) + { + return collection.AddSingleton() + .AddSingleton(); + } +} diff --git a/src/ModularToolManager/Strategies/Filters/FunctionButtonContainsNeedleFilter.cs b/src/ModularToolManager/Strategies/Filters/FunctionButtonContainsNeedleFilter.cs new file mode 100644 index 00000000..306b6f92 --- /dev/null +++ b/src/ModularToolManager/Strategies/Filters/FunctionButtonContainsNeedleFilter.cs @@ -0,0 +1,49 @@ +using System.Collections.Generic; +using System.Linq; +using ModularToolManager.ViewModels; + +namespace ModularToolManager.Strategies.Filters; + +/// +/// A function button filter which does a contains filter on the function name +/// +internal class FunctionButtonContainsNeedleFilter : IFunctionFilter +{ + /// + public IEnumerable GetFiltered(IEnumerable items, string? needle) + { + if (string.IsNullOrEmpty(needle)) + { + return items; + } + return items.Where(function => (function.DisplayName ?? string.Empty).ToLower().Contains(needle.ToLower())); + } + + /// + public IEnumerable GetFiltered(IEnumerable items, params string[] needles) + { + if (!needles.Any()) + { + return items; + } + List returnItems = new List(); + foreach (var item in items) + { + bool containsAll = true; + foreach (var needle in needles) + { + string displayName = item.DisplayName ?? string.Empty; + if (!displayName.ToLower().Contains(needle.ToLower())) + { + containsAll = false; + break; + } + } + if (containsAll) + { + returnItems.Add(item); + } + } + return returnItems; + } +} \ No newline at end of file diff --git a/src/ModularToolManager/Strategies/Filters/FunctionButtonFuzzyFilter.cs b/src/ModularToolManager/Strategies/Filters/FunctionButtonFuzzyFilter.cs new file mode 100644 index 00000000..75cd938e --- /dev/null +++ b/src/ModularToolManager/Strategies/Filters/FunctionButtonFuzzyFilter.cs @@ -0,0 +1,60 @@ +using FuzzySharp; +using ModularToolManager.ViewModels; +using System.Collections.Generic; +using System.Linq; + +namespace ModularToolManager.Strategies.Filters; + +/// +/// A function button filter which does fuzzy matching on the function name +/// +internal class FunctionButtonFuzzyFilter : IFunctionFilter +{ + /// + public IEnumerable GetFiltered(IEnumerable items, string? needle) + { + if (string.IsNullOrEmpty(needle)) + { + return items; + } + return needle.Length < 3 ? DoContainsMatch(items, needle) : DoFuzzyMatch(items, needle); + } + + /// + /// Method to do a simple contains match + /// + /// The items to search through + /// The needle to search for + /// The filtered data + private IEnumerable DoContainsMatch(IEnumerable items, string needle) + { + return items.Where(function => (function.DisplayName ?? string.Empty).ToLower().Contains(needle.ToLower())); + } + + /// + /// The fuzzy search algorithm + /// + /// The items to search through + /// The needle to search for + /// + private IEnumerable DoFuzzyMatch(IEnumerable items, string needle) + { + var results = Process.ExtractAll(needle, items.Select(item => item.DisplayName), null, null, 60); + if (results is null) + { + return items; + } + List returnList = new List(); + foreach (var result in results) + { + returnList.Add(items.ElementAt(result.Index)); + } + return returnList.OfType(); + } + + /// + public IEnumerable GetFiltered(IEnumerable items, params string[] needles) + { + return GetFiltered(items, string.Join(string.Empty, needles)); + } +} \ No newline at end of file diff --git a/src/ModularToolManager/Strategies/Filters/IFilterStrategy.cs b/src/ModularToolManager/Strategies/Filters/IFilterStrategy.cs new file mode 100644 index 00000000..02289e18 --- /dev/null +++ b/src/ModularToolManager/Strategies/Filters/IFilterStrategy.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; + +namespace ModularToolManager.Strategies.Filters; + +/// +/// An interface to define a filter for different situations +/// +/// The type of data which should be filtered +/// The type of the needle for filtering +public interface IFilterStrategy +{ + /// + /// Get the filtered items from the provided dataset based on the provided needle + /// + /// The items to filter + /// The needle to search in the data set + /// A list with items matching this filter instance + IEnumerable GetFiltered(IEnumerable items, N? needle); + + /// + /// Get the filtered items from the provided dataset based on the provided needles + /// + /// The items to filter + /// The needles to search in the data set + /// A list with items matching this filter instance + IEnumerable GetFiltered(IEnumerable items, params N[] needles); +} \ No newline at end of file diff --git a/src/ModularToolManager/Strategies/Filters/IFunctionFilter.cs b/src/ModularToolManager/Strategies/Filters/IFunctionFilter.cs new file mode 100644 index 00000000..f50b7f1a --- /dev/null +++ b/src/ModularToolManager/Strategies/Filters/IFunctionFilter.cs @@ -0,0 +1,10 @@ +using ModularToolManager.ViewModels; + +namespace ModularToolManager.Strategies.Filters; + +/// +/// A filter strategy for filtering s. +/// +public interface IFunctionFilter : IFilterStrategy +{ +} \ No newline at end of file diff --git a/src/ModularToolManager/Strategies/WindowPosition/BottomLeftStrategy.cs b/src/ModularToolManager/Strategies/WindowPosition/BottomLeftStrategy.cs new file mode 100644 index 00000000..67643be2 --- /dev/null +++ b/src/ModularToolManager/Strategies/WindowPosition/BottomLeftStrategy.cs @@ -0,0 +1,25 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Platform; + +namespace ModularToolManager.Strategies.WindowPosition; + + +/// +/// Strategy to position the given window in the bottom left corner of the screen. +/// +public class BottomLeftStrategy : IWindowPositionStrategy +{ + // + public void PositionWindow(Window window, Screen? screen) + { + if (screen is null) + { + return; + } + PixelRect workingArea = screen.WorkingArea; + double newXPos = workingArea.X; + double newYPos = workingArea.Bottom - window.Height; + window.Position = new PixelPoint((int)newXPos, (int)newYPos); + } +} diff --git a/src/ModularToolManager/Strategies/WindowPosition/BottomRightStrategy.cs b/src/ModularToolManager/Strategies/WindowPosition/BottomRightStrategy.cs index 76fd860a..deb682e8 100644 --- a/src/ModularToolManager/Strategies/WindowPosition/BottomRightStrategy.cs +++ b/src/ModularToolManager/Strategies/WindowPosition/BottomRightStrategy.cs @@ -17,8 +17,8 @@ public void PositionWindow(Window window, Screen? screen) return; } PixelRect workingArea = screen.WorkingArea; - double newXPos = workingArea.X + workingArea.Width - window.Width; - double newYPos = workingArea.Y + workingArea.Height - window.Height; + double newXPos = workingArea.Right - window.Width; + double newYPos = workingArea.Bottom - window.Height; window.Position = new PixelPoint((int)newXPos, (int)newYPos); } } diff --git a/src/ModularToolManager/Strategies/WindowPosition/TopLeftStrategy.cs b/src/ModularToolManager/Strategies/WindowPosition/TopLeftStrategy.cs new file mode 100644 index 00000000..7d3440e5 --- /dev/null +++ b/src/ModularToolManager/Strategies/WindowPosition/TopLeftStrategy.cs @@ -0,0 +1,25 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Platform; + +namespace ModularToolManager.Strategies.WindowPosition; + +/// +/// Position a Window in the bottom left of a given screen +/// +public class TopLeftStrategy : IWindowPositionStrategy +{ + /// + public void PositionWindow(Window window, Screen? screen) + { + if (screen is null ) + { + return; + } + + PixelRect workingArea = screen.WorkingArea; + double newXPos = workingArea.X; + double newYPos = workingArea.Y; + window.Position = new PixelPoint((int)newXPos, (int)newYPos); + } +} diff --git a/src/ModularToolManager/Strategies/WindowPosition/TopRightStrategy.cs b/src/ModularToolManager/Strategies/WindowPosition/TopRightStrategy.cs new file mode 100644 index 00000000..10939edb --- /dev/null +++ b/src/ModularToolManager/Strategies/WindowPosition/TopRightStrategy.cs @@ -0,0 +1,25 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Platform; + +namespace ModularToolManager.Strategies.WindowPosition; + +/// +/// Position a Window in the top left of a given screen +/// +public class TopRightStrategy : IWindowPositionStrategy +{ + /// + public void PositionWindow(Window window, Screen? screen) + { + if (screen is null) + { + return; + } + + PixelRect workingArea = screen.WorkingArea; + double newXPos = workingArea.Right - window.Width; + double newYPos = workingArea.Y; + window.Position = new PixelPoint((int)newXPos, (int)newYPos); + } +} diff --git a/src/ModularToolManager/ViewModels/AboutViewModel.cs b/src/ModularToolManager/ViewModels/AboutViewModel.cs index 7b8368d7..3b4bf931 100644 --- a/src/ModularToolManager/ViewModels/AboutViewModel.cs +++ b/src/ModularToolManager/ViewModels/AboutViewModel.cs @@ -46,6 +46,12 @@ internal partial class AboutViewModel : ObservableObject [ObservableProperty] private string? gitHubUserManualUrl; + /// + /// The url to open for the avalonia project + /// + [ObservableProperty] + private string? avaloniaProjectUrl; + /// /// Service used to open url /// @@ -66,6 +72,7 @@ public AboutViewModel(GetApplicationInformationService applicationInformationSer Version = applicationInformationService.GetVersion()?.ToString(); GitHubUrl = applicationInformationService.GetGithubUrl(); GitHubUserManualUrl = applicationInformationService.GetGithubUserManualUrl(); + AvaloniaProjectUrl = applicationInformationService.GetAvaloniaProjectUrl(); Dependencies = applicationInformationService.GetDependencies() .OrderBy(d => d.Name) .Select(dep => dependencyResolverService.GetDependency(provider => diff --git a/src/ModularToolManager/ViewModels/DepedencyInjection.cs b/src/ModularToolManager/ViewModels/DepedencyInjection.cs new file mode 100644 index 00000000..e2cd1d7b --- /dev/null +++ b/src/ModularToolManager/ViewModels/DepedencyInjection.cs @@ -0,0 +1,30 @@ +using Microsoft.Extensions.DependencyInjection; + +namespace ModularToolManager.ViewModels; + +/// +/// Dependency Injection for view models +/// +public static class DependencyInjection +{ + /// + /// Add all the view model + /// + /// The collection to extend + /// The extended collection + public static IServiceCollection AddViewModels(this IServiceCollection collection) + { + return collection.AddTransient() + .AddTransient() + .AddTransient() + .AddTransient() + .AddTransient() + .AddTransient() + .AddTransient() + .AddTransient() + .AddTransient() + .AddTransient() + .AddTransient() + .AddTransient(); + } +} diff --git a/src/ModularToolManager/ViewModels/FunctionSearchFilterViewModel.cs b/src/ModularToolManager/ViewModels/FunctionSearchFilterViewModel.cs new file mode 100644 index 00000000..5e3b309e --- /dev/null +++ b/src/ModularToolManager/ViewModels/FunctionSearchFilterViewModel.cs @@ -0,0 +1,46 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using ModularToolManager.Strategies.Filters; + +namespace ModularToolManager.ViewModels; + +/// +/// View model to display a function search filter +/// +public partial class FunctionSearchFilterViewModel : ObservableObject +{ + /// + /// The name for this entry + /// + [ObservableProperty] + private string name; + + /// + /// The description for this entry + /// + [ObservableProperty] + [NotifyPropertyChangedFor(nameof(TooltipShowTime))] + private string description; + + /// + /// Time until the tooltip is getting shwon + /// + public int TooltipShowTime => string.IsNullOrEmpty(Description) ? int.MaxValue : 500; + + /// + /// The key of this entry + /// + public string Key { get; } + + /// + /// Create a new instance of this class + /// + /// The name of the search filter + /// The description of the search filter + /// The filter which is represented by this data set + public FunctionSearchFilterViewModel(string name, string? description, IFunctionFilter filter) + { + this.name = name; + this.description = description ?? string.Empty; + Key = filter.GetType().Name; ; + } +} diff --git a/src/ModularToolManager/ViewModels/FunctionSelectionViewModel.cs b/src/ModularToolManager/ViewModels/FunctionSelectionViewModel.cs index d2c8dc24..b1c3d06e 100644 --- a/src/ModularToolManager/ViewModels/FunctionSelectionViewModel.cs +++ b/src/ModularToolManager/ViewModels/FunctionSelectionViewModel.cs @@ -3,6 +3,7 @@ using ModularToolManager.Models; using ModularToolManager.Models.Messages; using ModularToolManager.Services.Settings; +using ModularToolManager.Strategies.Filters; using ModularToolManagerModel.Services.Dependency; using ModularToolManagerModel.Services.Functions; using System; @@ -33,6 +34,11 @@ public partial class FunctionSelectionViewModel : ObservableObject, IDisposable /// private readonly ISettingsService settingsService; + /// + /// All the filters available for this application + /// + private readonly IEnumerable filters; + /// /// Private all the possible functions currently available /// @@ -70,11 +76,15 @@ public partial class FunctionSelectionViewModel : ObservableObject, IDisposable /// /// Create a new instance of this class /// - public FunctionSelectionViewModel(IFunctionService? functionService, IDependencyResolverService dependencyResolverService, ISettingsService settingsService) + public FunctionSelectionViewModel(IFunctionService? functionService, + IDependencyResolverService dependencyResolverService, + ISettingsService settingsService, + IEnumerable filters) { this.functionService = functionService; this.dependencyResolverService = dependencyResolverService; this.settingsService = settingsService; + this.filters = filters; functions = new List(); filteredFunctions = new ObservableCollection(); functionNames = new ObservableCollection(); @@ -127,7 +137,7 @@ private void SaveFunctionsOrder(SaveFunctionsOrderMessage saveFunctionMessage) /// protected override void OnPropertyChanged(PropertyChangedEventArgs e) { - Action action = e.PropertyName == nameof(SearchText) ? () => FilterFunctionList() : () => { return; }; + Action action = e.PropertyName == nameof(SearchText) ? () => FilterFunctionList() : () => { }; action(); base.OnPropertyChanged(e); } @@ -137,7 +147,8 @@ protected override void OnPropertyChanged(PropertyChangedEventArgs e) /// private void FilterFunctionList() { - IEnumerable tempFiltered = functions.Where(function => string.IsNullOrEmpty(SearchText) || (function.DisplayName ?? string.Empty).ToLower().Contains(SearchText.ToLower())) + IFunctionFilter filter = GetFunctionFilter(); + IEnumerable tempFiltered = filter.GetFiltered(functions, SearchText) .OrderBy(function => function.SortId) .ThenBy(function => function.DisplayName); FilteredFunctions.Clear(); @@ -147,6 +158,12 @@ private void FilterFunctionList() } } + private IFunctionFilter GetFunctionFilter() + { + var applicationSettings = settingsService.GetApplicationSettings(); + return filters.Where(filter => filter.GetType().Name == applicationSettings.SearchFilterTypeName).FirstOrDefault() ?? filters.First(); + } + /// /// Reload the functions of the application /// diff --git a/src/ModularToolManager/ViewModels/MainWindowViewModel.cs b/src/ModularToolManager/ViewModels/MainWindowViewModel.cs index 304b7520..29d2b7e8 100644 --- a/src/ModularToolManager/ViewModels/MainWindowViewModel.cs +++ b/src/ModularToolManager/ViewModels/MainWindowViewModel.cs @@ -133,7 +133,7 @@ public MainWindowViewModel( SelectLanguageCommand = new AsyncRelayCommand(async () => await OpenModalWindow(Properties.Resources.SubMenu_Language, Properties.Properties.Icon_language, nameof(ChangeLanguageViewModel))); HideApplicationCommand = new RelayCommand(() => WeakReferenceMessenger.Default.Send(new ToggleApplicationVisibilityMessage(true))); - WeakReferenceMessenger.Default.Register>(this, (_, e) => + WeakReferenceMessenger.Default.Register>(this, (_, _) => { UpdateShowInTaskbar(); }); diff --git a/src/ModularToolManager/ViewModels/ModalWindowViewModel.cs b/src/ModularToolManager/ViewModels/ModalWindowViewModel.cs index 2174bd57..20c7ffb4 100644 --- a/src/ModularToolManager/ViewModels/ModalWindowViewModel.cs +++ b/src/ModularToolManager/ViewModels/ModalWindowViewModel.cs @@ -47,7 +47,7 @@ public partial class ModalWindowViewModel : ObservableObject /// Can the modal be resized /// [ObservableProperty] - public bool canResize; + private bool canResize; /// /// The service used to switch the application theme @@ -95,7 +95,7 @@ public ModalWindowViewModel( private void SwitchTheme(int themeId) { var theme = themeService.GetStyleById(themeId); - theme ??= theme ??= themeService.GetAllStyles().FirstOrDefault() ?? new ApplicationStyle { MaterialOpacity = 1, TintOpacity = 0.65f, TintColor = Colors.Pink }; + theme ??= themeService.GetAllStyles().FirstOrDefault() ?? new ApplicationStyle { MaterialOpacity = 1, TintOpacity = 0.65f, TintColor = Colors.Pink }; if (theme is null) { return; diff --git a/src/ModularToolManager/ViewModels/PluginSettingBaseViewModel.cs b/src/ModularToolManager/ViewModels/PluginSettingBaseViewModel.cs index c780dc0e..5d24f11e 100644 --- a/src/ModularToolManager/ViewModels/PluginSettingBaseViewModel.cs +++ b/src/ModularToolManager/ViewModels/PluginSettingBaseViewModel.cs @@ -30,7 +30,7 @@ internal abstract partial class PluginSettingBaseViewModel : ObservableValidator /// Create a new instance of this class /// /// The setting model to create the data set from - public PluginSettingBaseViewModel(SettingModel settingModel) + protected PluginSettingBaseViewModel(SettingModel settingModel) { storedModel = settingModel; TranslationKey = settingModel.DisplayName ?? string.Empty; diff --git a/src/ModularToolManager/ViewModels/SettingsViewModel.cs b/src/ModularToolManager/ViewModels/SettingsViewModel.cs index f69534d5..c7578d2b 100644 --- a/src/ModularToolManager/ViewModels/SettingsViewModel.cs +++ b/src/ModularToolManager/ViewModels/SettingsViewModel.cs @@ -2,12 +2,15 @@ using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Messaging; using CommunityToolkit.Mvvm.Messaging.Messages; +using ModularToolManager.Enums; using ModularToolManager.Models; using ModularToolManager.Models.Messages; using ModularToolManager.Services.Settings; using ModularToolManager.Services.Ui; +using ModularToolManager.Strategies.Filters; using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; namespace ModularToolManager.ViewModels; @@ -70,14 +73,42 @@ internal partial class SettingsViewModel : ObservableObject [ObservableProperty] private bool enableAutocompleteForFunctionSearch; + /// + /// All the available window positions for the application + /// + [ObservableProperty] + private ObservableCollection availableWindowPositions; + + /// + /// The currently selected window position + /// + [ObservableProperty] + private WindowPositionStrategyViewModel? selectedWindowPosition; + + /// + /// All the search filters which are available for this application + /// + [ObservableProperty] + private List availableSearchFilters; + + /// + /// The currently selected search filter + /// + [ObservableProperty] + private FunctionSearchFilterViewModel? selectedSearchFilter; + /// /// Create a new instance of this class /// /// The settings service to use - public SettingsViewModel(ISettingsService settingsService, IThemeService themeService) + public SettingsViewModel(ISettingsService settingsService, IThemeService themeService, IEnumerable availableSearchFilters) { this.settingsService = settingsService; + this.availableSearchFilters = availableSearchFilters.Select(BuildViewModelForFunctionSearch) + .Where(filter => !string.IsNullOrEmpty(filter.Name)) + .ToList(); ApplicationSettings appSettings = settingsService.GetApplicationSettings(); + selectedSearchFilter = this.availableSearchFilters.Where(filter => filter.Key == appSettings.SearchFilterTypeName).FirstOrDefault(); TopMost = appSettings.AlwaysOnTop; CloseOnFunctionExecute = appSettings.MinimizeOnFunctionExecute; StartMinimized = appSettings.StartMinimized; @@ -88,6 +119,17 @@ public SettingsViewModel(ISettingsService settingsService, IThemeService themeSe .Where(style => !string.IsNullOrEmpty(style.Name)) .Select(style => new ApplicationStyleViewModel(style)) .ToList(); + + + AvailableWindowPositions = new ObservableCollection(); + foreach (var windowPosition in Enum.GetValues(typeof(WindowPositionEnum)) + .Cast() + .Select(positionEntry => new WindowPositionStrategyViewModel(positionEntry)) + .ToList()) + { + AvailableWindowPositions.Add(windowPosition); + } + SelectedWindowPosition = AvailableWindowPositions.FirstOrDefault(position => position.WindowPosition == appSettings.WindowPosition) ?? AvailableWindowPositions.FirstOrDefault(entry => entry.WindowPosition == WindowPositionEnum.BottomRight); SelectedTheme = AvailableThemes.Where(theme => theme.Id == appSettings.SelectedThemeId).FirstOrDefault() ?? AvailableThemes.FirstOrDefault(); EnableAutocompleteForFunctionSearch = appSettings.EnableAutocompleteForFunctionSearch; @@ -100,6 +142,18 @@ public SettingsViewModel(ISettingsService settingsService, IThemeService themeSe }; } + /// + /// Method t obuild the view model for a function search filter + /// + /// The filter to build the view model for + /// A function search filter view model + private FunctionSearchFilterViewModel BuildViewModelForFunctionSearch(IFunctionFilter filter) + { + string name = Properties.Resources.ResourceManager.GetString($"{filter.GetType().Name}_name") ?? string.Empty; + string description = Properties.Resources.ResourceManager.GetString($"{filter.GetType().Name}_description") ?? string.Empty; + return new FunctionSearchFilterViewModel(name, description, filter); + } + /// /// The ok button to save and confirm the changes /// @@ -108,6 +162,7 @@ private void Ok() { var changeResult = settingsService.ChangeSettings(settings => { + settings.SearchFilterTypeName = SelectedSearchFilter?.Key ?? settings.SearchFilterTypeName; settings.StartMinimized = StartMinimized; settings.ShowInTaskbar = ShowInTaskbar; settings.AlwaysOnTop = TopMost; @@ -115,6 +170,7 @@ private void Ok() settings.ClearSearchAfterFunctionExecute = ClearSearchAfterFunctionExecute; settings.SelectedThemeId = SelectedTheme?.Id ?? 0; settings.EnableAutocompleteForFunctionSearch = EnableAutocompleteForFunctionSearch; + settings.WindowPosition = SelectedWindowPosition?.WindowPosition ?? WindowPositionEnum.BottomRight; }); if (changeResult) { diff --git a/src/ModularToolManager/ViewModels/StringPluginSettingViewModel.cs b/src/ModularToolManager/ViewModels/StringPluginSettingViewModel.cs index 88830ae0..a179c32a 100644 --- a/src/ModularToolManager/ViewModels/StringPluginSettingViewModel.cs +++ b/src/ModularToolManager/ViewModels/StringPluginSettingViewModel.cs @@ -30,9 +30,9 @@ public override SettingModel GetSettingsModel() /// public override void UpdateValue(object? newData) { - if (newData is string) + if (newData is string stringData) { - SettingText = (string)newData; + SettingText = stringData; } } } diff --git a/src/ModularToolManager/ViewModels/WindowPositionStrategyViewModel.cs b/src/ModularToolManager/ViewModels/WindowPositionStrategyViewModel.cs new file mode 100644 index 00000000..0f531537 --- /dev/null +++ b/src/ModularToolManager/ViewModels/WindowPositionStrategyViewModel.cs @@ -0,0 +1,39 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using ModularToolManager.Enums; + +namespace ModularToolManager.ViewModels; + +/// +/// View model for the window position strategy +/// +public partial class WindowPositionStrategyViewModel : ObservableObject +{ + /// + /// The display name of the window position strategy + /// + [ObservableProperty] + private string displayName; + + /// + /// The stored window position enum + /// + public WindowPositionEnum WindowPosition {get; init;} + + /// + /// Create a new instance of this class + /// + /// The window position enum to create a view model for + public WindowPositionStrategyViewModel(WindowPositionEnum windowPositionEnum) + { + WindowPosition = windowPositionEnum; + DisplayName = windowPositionEnum switch + { + WindowPositionEnum.TopLeft => Properties.Resources.Settings_WindowPosition_Top_Left, + WindowPositionEnum.TopRight => Properties.Resources.Settings_WindowPosition_Top_Right, + WindowPositionEnum.BottomLeft => Properties.Resources.Settings_WindowPosition_Bottom_Left, + WindowPositionEnum.BottomRight => Properties.Resources.Settings_WindowPosition_Bottom_Right, + _ => "" + }; + } + +} diff --git a/src/ModularToolManager/Views/AboutView.axaml b/src/ModularToolManager/Views/AboutView.axaml index 641d314c..3cbc64b9 100644 --- a/src/ModularToolManager/Views/AboutView.axaml +++ b/src/ModularToolManager/Views/AboutView.axaml @@ -20,9 +20,10 @@ - - - + +