This commit is contained in:
rmbgame
2021-03-08 13:35:02 +08:00
parent f42ca101c8
commit 5faf0eefa3
10 changed files with 104 additions and 4 deletions
@@ -11,6 +11,11 @@ namespace System.Application.Services
/// </summary>
AppTheme Theme { get; set; }
/// <summary>
/// 打开子窗口
/// </summary>
void ShowChildWindow(object window);
/// <summary>
/// 退出整个程序
/// </summary>
@@ -0,0 +1,32 @@
using System.Threading.Tasks;
using System.Windows;
namespace System.Application.Services
{
public interface IMessageWindowService
{
/// <summary>
/// 显示一个消息框,该消息框包含消息、标题栏标题、按钮,并且返回结果。
/// </summary>
/// <param name="messageBoxText">一个 <see cref="string"/>,用于指定要显示的文本。</param></param>
/// <returns>一个 <see cref="MessageBoxResultCompat"/> 值,用于指定用户单击了哪个消息框按钮。</returns>
Task<bool> ShowDialog(string messageBoxText);
/// <summary>
/// 显示一个消息框,该消息框包含消息、标题栏标题、按钮,并且返回结果。
/// </summary>
/// <param name="messageBoxText">一个 <see cref="string"/>,用于指定要显示的文本。</param>
/// <param name="caption">一个 <see cref="string"/>,用于指定要显示的标题栏标题。</param></param>
/// <returns>一个 <see cref="MessageBoxResultCompat"/> 值,用于指定用户单击了哪个消息框按钮。</returns>
Task<bool> ShowDialog(string messageBoxText, string caption);
/// <summary>
/// 显示一个消息框,该消息框包含消息、标题栏标题、按钮,并且返回结果。
/// </summary>
/// <param name="messageBoxText">一个 <see cref="string"/>,用于指定要显示的文本。</param>
/// <param name="caption">一个 <see cref="string"/>,用于指定要显示的标题栏标题。</param>
/// <param name="button">一个 <see cref="MessageBoxButtonCompat"/> 值,用于指定要显示哪个按钮或哪些按钮。</param>
/// <returns>一个 <see cref="MessageBoxResultCompat"/> 值,用于指定用户单击了哪个消息框按钮。</returns>
Task<bool> ShowDialog(string messageBoxText, string caption, bool isCancelcBtn);
}
}
@@ -71,7 +71,7 @@ namespace System.Application.UI.Resx
/// <param name="cultureName"></param>
public static void ChangeLanguage(string cultureName)
{
if (IsMatch(CultureInfo.CurrentUICulture, cultureName)) return;
if (IsMatch(AppResources.Culture, cultureName)) return;
if (string.IsNullOrWhiteSpace(cultureName))
AppResources.Culture = DefaultCurrentUICulture;
else
@@ -13,6 +13,7 @@ namespace System.Application.UI.ViewModels
public bool IsInitialized { get; set; }
public bool DialogResult { get; protected set; }
protected void InvokeOnUIDispatcher(Action action)
{
MainThreadDesktop.BeginInvokeOnMainThread(action);
@@ -1,4 +1,5 @@
using ReactiveUI;
using System.Application.Services;
using System.Application.UI.Resx;
using System.Collections.Generic;
using System.Linq;
@@ -30,6 +31,8 @@ namespace System.Application.UI.ViewModels
Services.ToastService.Current.Notify("Test CommandTest CommandTest CommandTest CommandTest CommandTest Command");
DebugString += Services.ToastService.Current.Message + Environment.NewLine;
DebugString += Services.ToastService.Current.IsVisible + Environment.NewLine;
DI.Get<IMessageWindowService>().ShowDialog("Test", "Test");
}
}
}