diff --git a/src/ModularToolManager/DependencyInjection/DependencyInjectionExtension.cs b/src/ModularToolManager/DependencyInjection/DependencyInjectionExtension.cs index c19179e..f27a05e 100644 --- a/src/ModularToolManager/DependencyInjection/DependencyInjectionExtension.cs +++ b/src/ModularToolManager/DependencyInjection/DependencyInjectionExtension.cs @@ -76,18 +76,21 @@ public static IServiceCollection AddServices(this IServiceCollection collection) .AddSingleton() .AddSingleton() .AddSingleton() - .AddSingleton() .AddSingleton() .AddSingleton() .AddSingleton() .AddSingleton, JsonSerializationOptionFactory>() - .AddSingleton() .AddSingleton() - .AddTransient(typeof(IPluginLoggerService<>), typeof(LoggingPluginAdapter<>)) .AddSingleton() .AddSingleton() - .AddSingleton() .AddSingleton() - .AddSingleton(); + .AddTransient() + .AddTransient() + .AddTransient() + .AddTransient() + .AddTransient() + .AddTransient(typeof(IPluginLoggerService<>), typeof(LoggingPluginAdapter<>)); + + } } diff --git a/src/ModularToolManager/Icons.axaml b/src/ModularToolManager/Icons.axaml index 74785ce..513a67e 100644 --- a/src/ModularToolManager/Icons.axaml +++ b/src/ModularToolManager/Icons.axaml @@ -13,6 +13,9 @@ M3.52499419,3.71761187 L3.61611652,3.61611652 C4.0717282,3.16050485 4.79154862,3.13013074 5.28238813,3.52499419 L5.38388348,3.61611652 L14,12.233 L22.6161165,3.61611652 C23.1042719,3.12796116 23.8957281,3.12796116 24.3838835,3.61611652 C24.8720388,4.10427189 24.8720388,4.89572811 24.3838835,5.38388348 L15.767,14 L24.3838835,22.6161165 C24.8394952,23.0717282 24.8698693,23.7915486 24.4750058,24.2823881 L24.3838835,24.3838835 C23.9282718,24.8394952 23.2084514,24.8698693 22.7176119,24.4750058 L22.6161165,24.3838835 L14,15.767 L5.38388348,24.3838835 C4.89572811,24.8720388 4.10427189,24.8720388 3.61611652,24.3838835 C3.12796116,23.8957281 3.12796116,23.1042719 3.61611652,22.6161165 L12.233,14 L3.61611652,5.38388348 C3.16050485,4.9282718 3.13013074,4.20845138 3.52499419,3.71761187 L3.61611652,3.61611652 L3.52499419,3.71761187 Z M14 9.50006C11.5147 9.50006 9.5 11.5148 9.5 14.0001C9.5 16.4853 11.5147 18.5001 14 18.5001C15.3488 18.5001 16.559 17.9066 17.3838 16.9666C18.0787 16.1746 18.5 15.1365 18.5 14.0001C18.5 13.5401 18.431 13.0963 18.3028 12.6784C17.7382 10.8381 16.0253 9.50006 14 9.50006ZM11 14.0001C11 12.3432 12.3431 11.0001 14 11.0001C15.6569 11.0001 17 12.3432 17 14.0001C17 15.6569 15.6569 17.0001 14 17.0001C12.3431 17.0001 11 15.6569 11 14.0001Z M21.7093 22.3948L19.9818 21.6364C19.4876 21.4197 18.9071 21.4515 18.44 21.7219C17.9729 21.9924 17.675 22.4693 17.6157 23.0066L17.408 24.8855C17.3651 25.273 17.084 25.5917 16.7055 25.682C14.9263 26.1061 13.0725 26.1061 11.2933 25.682C10.9148 25.5917 10.6336 25.273 10.5908 24.8855L10.3834 23.0093C10.3225 22.4731 10.0112 21.9976 9.54452 21.7281C9.07783 21.4586 8.51117 21.4269 8.01859 21.6424L6.29071 22.4009C5.93281 22.558 5.51493 22.4718 5.24806 22.1859C4.00474 20.8536 3.07924 19.2561 2.54122 17.5137C2.42533 17.1384 2.55922 16.7307 2.8749 16.4977L4.40219 15.3703C4.83721 15.0501 5.09414 14.5415 5.09414 14.0007C5.09414 13.4598 4.83721 12.9512 4.40162 12.6306L2.87529 11.5051C2.55914 11.272 2.42513 10.8638 2.54142 10.4882C3.08038 8.74734 4.00637 7.15163 5.24971 5.82114C5.51684 5.53528 5.93492 5.44941 6.29276 5.60691L8.01296 6.36404C8.50793 6.58168 9.07696 6.54881 9.54617 6.27415C10.0133 6.00264 10.3244 5.52527 10.3844 4.98794L10.5933 3.11017C10.637 2.71803 10.9245 2.39704 11.3089 2.31138C12.19 2.11504 13.0891 2.01071 14.0131 2.00006C14.9147 2.01047 15.8128 2.11485 16.6928 2.31149C17.077 2.39734 17.3643 2.71823 17.4079 3.11017L17.617 4.98937C17.7116 5.85221 18.4387 6.50572 19.3055 6.50663C19.5385 6.507 19.769 6.45838 19.9843 6.36294L21.7048 5.60568C22.0626 5.44818 22.4807 5.53405 22.7478 5.81991C23.9912 7.1504 24.9172 8.74611 25.4561 10.487C25.5723 10.8623 25.4386 11.2703 25.1228 11.5035L23.5978 12.6297C23.1628 12.95 22.9 13.4586 22.9 13.9994C22.9 14.5403 23.1628 15.0489 23.5988 15.3698L25.1251 16.4965C25.441 16.7296 25.5748 17.1376 25.4586 17.5131C24.9198 19.2536 23.9944 20.8492 22.7517 22.1799C22.4849 22.4657 22.0671 22.5518 21.7093 22.3948ZM16.263 22.1966C16.4982 21.4685 16.9889 20.8288 17.6884 20.4238C18.5702 19.9132 19.6536 19.8547 20.5841 20.2627L21.9281 20.8526C22.791 19.8538 23.4593 18.7013 23.8981 17.4552L22.7095 16.5778L22.7086 16.5771C21.898 15.98 21.4 15.0277 21.4 13.9994C21.4 12.9719 21.8974 12.0195 22.7073 11.4227L22.7085 11.4218L23.8957 10.545C23.4567 9.2988 22.7881 8.14636 21.9248 7.1477L20.5922 7.73425L20.5899 7.73527C20.1844 7.91463 19.7472 8.00722 19.3039 8.00663C17.6715 8.00453 16.3046 6.77431 16.1261 5.15465L16.1259 5.15291L15.9635 3.69304C15.3202 3.57328 14.6677 3.50872 14.013 3.50017C13.3389 3.50891 12.6821 3.57367 12.0377 3.69328L11.8751 5.15452C11.7625 6.16272 11.1793 7.05909 10.3019 7.56986C9.41937 8.0856 8.34453 8.14844 7.40869 7.73694L6.07273 7.14893C5.20949 8.14751 4.54092 9.29983 4.10196 10.5459L5.29181 11.4233C6.11115 12.0269 6.59414 12.9837 6.59414 14.0007C6.59414 15.0173 6.11142 15.9742 5.29237 16.5776L4.10161 17.4566C4.54002 18.7044 5.2085 19.8585 6.07205 20.8587L7.41742 20.2682C8.34745 19.8613 9.41573 19.9215 10.2947 20.4292C11.174 20.937 11.7593 21.832 11.8738 22.84L11.8744 22.8445L12.0362 24.3088C13.3326 24.5638 14.6662 24.5638 15.9626 24.3088L16.1247 22.8418C16.1491 22.6217 16.1955 22.4055 16.263 22.1966Z M12.5,10.5 L34.60324,10.5 L30.4128926,17.8829931 C30.1957025,18.2656614 30.1957025,18.7343386 30.4128926,19.1170069 L34.60324,26.5 L12.5,26.5 L12.5,10.5 Z M12.5,29 L36.75,29 C37.7081614,29 38.3100612,27.9662926 37.8371074,27.1329931 L32.9373005,18.5 L37.8371074,9.8670069 C38.3100612,9.03370742 37.7081614,8 36.75,8 L11.25,8 C10.5596441,8 10,8.55964406 10,9.25 L10,38.75 C10,39.4403559 10.5596441,40 11.25,40 C11.9403559,40 12.5,39.4403559 12.5,38.75 L12.5,29 Z + M14,2 C20.627417,2 26,7.372583 26,14 C26,20.627417 20.627417,26 14,26 C7.372583,26 2,20.627417 2,14 C2,7.372583 7.372583,2 14,2 Z M14,3.5 C8.20101013,3.5 3.5,8.20101013 3.5,14 C3.5,19.7989899 8.20101013,24.5 14,24.5 C19.7989899,24.5 24.5,19.7989899 24.5,14 C24.5,8.20101013 19.7989899,3.5 14,3.5 Z M14,8 C14.4142136,8 14.75,8.33578644 14.75,8.75 L14.75,13.25 L19.25,13.25 C19.6642136,13.25 20,13.5857864 20,14 C20,14.4142136 19.6642136,14.75 19.25,14.75 L14.75,14.75 L14.75,19.25 C14.75,19.6642136 14.4142136,20 14,20 C13.5857864,20 13.25,19.6642136 13.25,19.25 L13.25,14.75 L8.75,14.75 C8.33578644,14.75 8,14.4142136 8,14 C8,13.5857864 8.33578644,13.25 8.75,13.25 L13.25,13.25 L13.25,8.75 C13.25,8.33578644 13.5857864,8 14,8 Z + M27.3138 4.68622C28.8759 6.24832 28.8759 8.78098 27.3138 10.3431L12.5409 25.116C11.9001 25.7568 11.0972 26.2114 10.218 26.4312L5.63602 27.5767C4.90364 27.7598 4.24025 27.0964 4.42335 26.364L5.56885 21.782C5.78864 20.9028 6.24323 20.0999 6.88402 19.4591L21.6569 4.68622C23.219 3.12412 25.7517 3.12412 27.3138 4.68622ZM20.2426 8.92865L8.29824 20.8734C7.91376 21.2578 7.641 21.7396 7.50913 22.2671L6.76786 25.2322L9.73295 24.4909C10.2604 24.359 10.7422 24.0863 11.1267 23.7018L23.0706 11.7566L20.2426 8.92865ZM23.0712 6.10043L21.6566 7.51465L24.4846 10.3426L25.8996 8.92886C26.6806 8.14781 26.6806 6.88148 25.8996 6.10043C25.1185 5.31939 23.8522 5.31939 23.0712 6.10043Z + M24,7.25 C27.1017853,7.25 29.629937,9.70601719 29.7458479,12.7794443 L29.75,13 L37,13 C37.6903559,13 38.25,13.5596441 38.25,14.25 C38.25,14.8972087 37.7581253,15.4295339 37.1278052,15.4935464 L37,15.5 L35.909,15.5 L34.2058308,38.0698451 C34.0385226,40.2866784 32.1910211,42 29.9678833,42 L18.0321167,42 C15.8089789,42 13.9614774,40.2866784 13.7941692,38.0698451 L12.09,15.5 L11,15.5 C10.3527913,15.5 9.8204661,15.0081253 9.75645361,14.3778052 L9.75,14.25 C9.75,13.6027913 10.2418747,13.0704661 10.8721948,13.0064536 L11,13 L18.25,13 C18.25,9.82436269 20.8243627,7.25 24,7.25 Z M33.4021054,15.5 L14.5978946,15.5 L16.2870795,37.8817009 C16.3559711,38.7945146 17.116707,39.5 18.0321167,39.5 L29.9678833,39.5 C30.883293,39.5 31.6440289,38.7945146 31.7129205,37.8817009 L33.4021054,15.5 Z M27.25,20.75 C27.8972087,20.75 28.4295339,21.2418747 28.4935464,21.8721948 L28.5,22 L28.5,33 C28.5,33.6903559 27.9403559,34.25 27.25,34.25 C26.6027913,34.25 26.0704661,33.7581253 26.0064536,33.1278052 L26,33 L26,22 C26,21.3096441 26.5596441,20.75 27.25,20.75 Z M20.75,20.75 C21.3972087,20.75 21.9295339,21.2418747 21.9935464,21.8721948 L22,22 L22,33 C22,33.6903559 21.4403559,34.25 20.75,34.25 C20.1027913,34.25 19.5704661,33.7581253 19.5064536,33.1278052 L19.5,33 L19.5,22 C19.5,21.3096441 20.0596441,20.75 20.75,20.75 Z M24,9.75 C22.2669685,9.75 20.8507541,11.1064548 20.7551448,12.8155761 L20.75,13 L27.25,13 C27.25,11.2050746 25.7949254,9.75 24,9.75 Z diff --git a/src/ModularToolManager/Properties/Properties.Designer.cs b/src/ModularToolManager/Properties/Properties.Designer.cs index 725f176..b983ae7 100644 --- a/src/ModularToolManager/Properties/Properties.Designer.cs +++ b/src/ModularToolManager/Properties/Properties.Designer.cs @@ -96,6 +96,51 @@ internal static string GithubUrl { } } + /// + /// 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 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. /// diff --git a/src/ModularToolManager/Properties/Properties.resx b/src/ModularToolManager/Properties/Properties.resx index 6cfcc63..4df16c0 100644 --- a/src/ModularToolManager/Properties/Properties.resx +++ b/src/ModularToolManager/Properties/Properties.resx @@ -129,6 +129,21 @@ https://github.com/XanatosX/ModularToolManager/issues + + edit_regular + + + eye_hide_regular + + + flag_regular + + + add_circle_regular + + + settings_regular + settings.set diff --git a/src/ModularToolManager/Properties/Resources.Designer.cs b/src/ModularToolManager/Properties/Resources.Designer.cs index da0d5cb..67ba5f5 100644 --- a/src/ModularToolManager/Properties/Resources.Designer.cs +++ b/src/ModularToolManager/Properties/Resources.Designer.cs @@ -142,11 +142,11 @@ public static string Menu_File { } /// - /// Looks up a localized string similar to Report Bug. + /// Looks up a localized string similar to Help. /// - public static string Menu_ReportBug { + public static string Menu_Help { get { - return ResourceManager.GetString("Menu_ReportBug", resourceCulture); + return ResourceManager.GetString("Menu_Help", resourceCulture); } } @@ -204,6 +204,15 @@ public static string Settings_StartMinimized { } } + /// + /// 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. /// @@ -222,6 +231,15 @@ public static string SubMenu_Hide { } } + /// + /// 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. /// @@ -240,6 +258,15 @@ public static string SubMenu_NewFunction { } } + /// + /// 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. /// diff --git a/src/ModularToolManager/Properties/Resources.de.resx b/src/ModularToolManager/Properties/Resources.de.resx index 2585c85..3742a9a 100644 --- a/src/ModularToolManager/Properties/Resources.de.resx +++ b/src/ModularToolManager/Properties/Resources.de.resx @@ -138,8 +138,8 @@ Datei - - Fehler Melden + + Hilfe Funktionsbeschreibung @@ -159,18 +159,27 @@ Minimiert starten + + Über + Beenden Verstecken + + Hotkeys + Sprache Neue Funktion + + Fehler Melden + Einstellungen diff --git a/src/ModularToolManager/Properties/Resources.resx b/src/ModularToolManager/Properties/Resources.resx index e7c790d..fcf4ab6 100644 --- a/src/ModularToolManager/Properties/Resources.resx +++ b/src/ModularToolManager/Properties/Resources.resx @@ -144,8 +144,8 @@ File - - Report Bug + + Help Function Description @@ -165,18 +165,27 @@ Start minimized + + About + Exit Hide + + Hotkeys + Language New Function + + Report Bug + Settings diff --git a/src/ModularToolManager/Services/Ui/IImageService.cs b/src/ModularToolManager/Services/Ui/IImageService.cs new file mode 100644 index 0000000..ffc08b9 --- /dev/null +++ b/src/ModularToolManager/Services/Ui/IImageService.cs @@ -0,0 +1,25 @@ +using Avalonia.Media; +using Avalonia.Media.Imaging; + +namespace ModularToolManager.Services.Ui; + +/// +/// Service to get bitmap images from stream geometry +/// +public interface IImageService +{ + /// + /// Create a bitmap with a black brush + /// + /// The geometry to convert + /// If a bitmap could be generated the generated bitmap otherwise null + Bitmap? CreateBitmap(StreamGeometry streamGeometry) => CreateBitmap(streamGeometry, new SolidColorBrush(Color.FromRgb(0, g: 0, 0))); + + /// + /// Create a bitmap with a brush + /// + /// The geometry to convert + /// The brush to use + /// If a bitmap could be generated the generated bitmap otherwise null + Bitmap? CreateBitmap(StreamGeometry streamGeometry, Brush brush); +} diff --git a/src/ModularToolManager/Services/Ui/ImageService.cs b/src/ModularToolManager/Services/Ui/ImageService.cs new file mode 100644 index 0000000..d5ead11 --- /dev/null +++ b/src/ModularToolManager/Services/Ui/ImageService.cs @@ -0,0 +1,41 @@ +using Avalonia; +using Avalonia.Media; +using Avalonia.Media.Imaging; +using System.IO; + +namespace ModularToolManager.Services.Ui; + +/// +/// Implementation of the image service interface +/// +public class ImageService : IImageService +{ + /// + public Bitmap? CreateBitmap(StreamGeometry streamGeometry, Brush brush) + { + var testImage = new DrawingImage + { + Drawing = new GeometryDrawing + { + Geometry = streamGeometry, + Brush = brush + } + }; + var pixelSize = new PixelSize((int)testImage.Size.Width, (int)testImage.Size.Height); + Bitmap? returnImage = null; + using (MemoryStream memoryStream = new()) + { + using (RenderTargetBitmap bitmap = new(pixelSize, new Vector(72, 72))) + { + using (DrawingContext ctx = new(bitmap.CreateDrawingContext(null))) + { + testImage.Drawing.Draw(ctx); + } + bitmap.Save(memoryStream); + } + memoryStream.Seek(0, SeekOrigin.Begin); + returnImage = new Bitmap(memoryStream); + } + return returnImage; + } +} diff --git a/src/ModularToolManager/Services/Ui/WindowManagementService.cs b/src/ModularToolManager/Services/Ui/WindowManagementService.cs index 8461674..77e0864 100644 --- a/src/ModularToolManager/Services/Ui/WindowManagementService.cs +++ b/src/ModularToolManager/Services/Ui/WindowManagementService.cs @@ -27,6 +27,7 @@ internal class WindowManagementService : IWindowManagementService /// Service to use to load styles /// private readonly IStyleService styleService; + private readonly IImageService imageService; /// /// Service to use to resolve dependencies @@ -37,11 +38,12 @@ internal class WindowManagementService : IWindowManagementService /// Create a new isntance of this class /// /// The logging service to use - public WindowManagementService(ILogger? loggingService, IDependencyResolverService dependencyResolverService, IStyleService styleService) + public WindowManagementService(ILogger? loggingService, IDependencyResolverService dependencyResolverService, IStyleService styleService, IImageService imageService) { this.loggingService = loggingService; this.dependencyResolverService = dependencyResolverService; this.styleService = styleService; + this.imageService = imageService; } /// @@ -85,7 +87,7 @@ public async Task ShowModalWindowAsync(ShowWindowModel modalData, Window? parent loggingService?.LogError("No content for the modal was provided, cannot open the window"); return; } - var modalContent = new ModalWindowViewModel(modalData.Title, modalData.ImagePath, modalData.ModalContent, styleService); + var modalContent = new ModalWindowViewModel(modalData.Title, modalData.ImagePath, modalData.ModalContent, styleService, imageService); parent = parent ?? GetMainWindow(); if (window is null) { diff --git a/src/ModularToolManager/ViewModels/MainWindowViewModel.cs b/src/ModularToolManager/ViewModels/MainWindowViewModel.cs index fb7fc6a..c68483d 100644 --- a/src/ModularToolManager/ViewModels/MainWindowViewModel.cs +++ b/src/ModularToolManager/ViewModels/MainWindowViewModel.cs @@ -104,7 +104,7 @@ public MainWindowViewModel( ReportBugCommand = new RelayCommand(() => urlOpenerService?.OpenUrl(Properties.Properties.GithubUrl)); ExitApplicationCommand = new RelayCommand(() => WeakReferenceMessenger.Default.Send(new CloseApplicationMessage())); - SelectLanguageCommand = new AsyncRelayCommand(async () => await OpenModalWindow(Properties.Resources.SubMenu_Language, "flag_regular", nameof(ChangeLanguageViewModel))); + 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))); ShowApplicationCommand = new RelayCommand(() => WeakReferenceMessenger.Default.Send(new ToggleApplicationVisibilityMessage(false))); @@ -117,7 +117,7 @@ public MainWindowViewModel( var editModal = viewModelLocator.GetViewModel(nameof(AddFunctionViewModel)) as AddFunctionViewModel; if (editModal is not null && editModal.LoadInFunction(e.Identifier)) { - await OpenModalWindow(Properties.Resources.Window_EditFunction, "settings_regular", editModal); + await OpenModalWindow(Properties.Resources.Window_EditFunction, Properties.Properties.Icon_edit_function, editModal); e.Reply(true); WeakReferenceMessenger.Default.Send(new ReloadFunctionsMessage()); return; @@ -141,7 +141,7 @@ private void UpdateShowInTaskbar() [RelayCommand] private async Task NewFunction() { - await OpenModalWindow(Properties.Resources.SubMenu_NewFunction, "settings_regular", nameof(AddFunctionViewModel)); + await OpenModalWindow(Properties.Resources.SubMenu_NewFunction, Properties.Properties.Icon_new_function, nameof(AddFunctionViewModel)); WeakReferenceMessenger.Default.Send(new ReloadFunctionsMessage()); } @@ -152,7 +152,7 @@ private async Task NewFunction() [RelayCommand] private async Task OpenSettings() { - await OpenModalWindow(Properties.Resources.SubMenu_Settings, "settings_regular", nameof(SettingsViewModel)); + await OpenModalWindow(Properties.Resources.SubMenu_Settings, Properties.Properties.Icon_settings, nameof(SettingsViewModel)); } /// diff --git a/src/ModularToolManager/ViewModels/ModalWindowViewModel.cs b/src/ModularToolManager/ViewModels/ModalWindowViewModel.cs index cd64173..3559b1c 100644 --- a/src/ModularToolManager/ViewModels/ModalWindowViewModel.cs +++ b/src/ModularToolManager/ViewModels/ModalWindowViewModel.cs @@ -1,8 +1,10 @@ using Avalonia.Controls; using Avalonia.Media; +using Avalonia.Media.Imaging; using Avalonia.Styling; using CommunityToolkit.Mvvm.ComponentModel; using ModularToolManager.Services.Styling; +using ModularToolManager.Services.Ui; using System.Linq; using System.Reactive.Linq; @@ -18,6 +20,11 @@ public class ModalWindowViewModel : ObservableObject /// public StreamGeometry? PathIcon { get; } + /// + /// The window icon to use + /// + public WindowIcon? WindowIcon { get; } + /// /// The title of the modal /// @@ -26,13 +33,17 @@ public class ModalWindowViewModel : ObservableObject /// /// The content of the modal to display /// - //@TODO: Change to proper type as soon as obsolete part removed - public object ModalContent { get; } + public ObservableObject ModalContent { get; } - public ModalWindowViewModel(string title, string? pathName, ObservableObject modalContent, IStyleService styleService) + public ModalWindowViewModel(string title, string? pathName, ObservableObject modalContent, IStyleService styleService, IImageService imageService) { Title = title; ModalContent = modalContent; - PathIcon = styleService?.GetStyleByName(pathName ?? string.Empty) ?? null; + PathIcon = styleService.GetStyleByName(pathName ?? string.Empty) ?? null; + if (PathIcon is not null) + { + var image = imageService.CreateBitmap(PathIcon); + WindowIcon = image is null ? null : new WindowIcon(image); + } } } \ No newline at end of file diff --git a/src/ModularToolManager/Views/AddFunctionView.axaml b/src/ModularToolManager/Views/AddFunctionView.axaml index 2093cd3..6a164b4 100644 --- a/src/ModularToolManager/Views/AddFunctionView.axaml +++ b/src/ModularToolManager/Views/AddFunctionView.axaml @@ -32,7 +32,7 @@ diff --git a/src/ModularToolManager/Views/MainWindow.axaml b/src/ModularToolManager/Views/MainWindow.axaml index 02216ff..f9b5825 100644 --- a/src/ModularToolManager/Views/MainWindow.axaml +++ b/src/ModularToolManager/Views/MainWindow.axaml @@ -17,7 +17,6 @@ HasSystemDecorations="False" CanResize="False" ShowInTaskbar="{Binding ShowInTaskbar}"> -