mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-06-07 16:18:39 +00:00
Refactor message boxes
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using DiscordChatExporter.Core.Discord.Data;
|
||||
using DiscordChatExporter.Gui.Localization;
|
||||
using DiscordChatExporter.Gui.ViewModels;
|
||||
using DiscordChatExporter.Gui.ViewModels.Components;
|
||||
using DiscordChatExporter.Gui.ViewModels.Dialogs;
|
||||
@@ -8,7 +9,7 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace DiscordChatExporter.Gui.Framework;
|
||||
|
||||
public class ViewModelManager(IServiceProvider services)
|
||||
public class ViewModelManager(IServiceProvider services, LocalizationManager localizationManager)
|
||||
{
|
||||
public MainViewModel GetMainViewModel() => services.GetRequiredService<MainViewModel>();
|
||||
|
||||
@@ -46,7 +47,7 @@ public class ViewModelManager(IServiceProvider services)
|
||||
}
|
||||
|
||||
public MessageBoxViewModel GetMessageBoxViewModel(string title, string message) =>
|
||||
GetMessageBoxViewModel(title, message, "CLOSE", null);
|
||||
GetMessageBoxViewModel(title, message, localizationManager.CloseButton, null);
|
||||
|
||||
public SettingsViewModel GetSettingsViewModel() =>
|
||||
services.GetRequiredService<SettingsViewModel>();
|
||||
|
||||
@@ -6,20 +6,20 @@ namespace DiscordChatExporter.Gui.ViewModels.Dialogs;
|
||||
public partial class MessageBoxViewModel : DialogViewModelBase
|
||||
{
|
||||
[ObservableProperty]
|
||||
public partial string? Title { get; set; } = "Title";
|
||||
public partial string? Title { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial string? Message { get; set; } = "Message";
|
||||
public partial string? Message { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedFor(nameof(IsDefaultButtonVisible))]
|
||||
[NotifyPropertyChangedFor(nameof(ButtonsCount))]
|
||||
public partial string? DefaultButtonText { get; set; } = "OK";
|
||||
public partial string? DefaultButtonText { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedFor(nameof(IsCancelButtonVisible))]
|
||||
[NotifyPropertyChangedFor(nameof(ButtonsCount))]
|
||||
public partial string? CancelButtonText { get; set; } = "Cancel";
|
||||
public partial string? CancelButtonText { get; set; }
|
||||
|
||||
public bool IsDefaultButtonVisible => !string.IsNullOrWhiteSpace(DefaultButtonText);
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.Threading.Tasks;
|
||||
using DiscordChatExporter.Gui.Framework;
|
||||
using DiscordChatExporter.Gui.Localization;
|
||||
using DiscordChatExporter.Gui.Services;
|
||||
using DiscordChatExporter.Gui.Utils.Extensions;
|
||||
using DiscordChatExporter.Gui.ViewModels.Components;
|
||||
using PowerKit.Extensions;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user