security fix

This commit is contained in:
Aigio Liu
2021-03-08 17:10:26 +08:00
parent 77eff6522f
commit ffc0401409
21 changed files with 383 additions and 245 deletions
@@ -9,6 +9,14 @@ namespace Microsoft.Extensions.DependencyInjection
{
public static class ServiceCollectionExtensions
{
/// <summary>
/// 尝试添加适用于Desktop的Toast
/// </summary>
/// <param name="services"></param>
/// <returns></returns>
public static IServiceCollection TryAddToast(this IServiceCollection services)
=> PlatformToastImpl.TryAddToast(services);
/// <summary>
/// 添加桌面端日志实现
/// </summary>
@@ -0,0 +1,19 @@
using Microsoft.Extensions.DependencyInjection;
namespace System.Application.Services.Implementation
{
internal sealed class PlatformToastImpl : ToastImpl
{
public PlatformToastImpl(IToastIntercept intercept) : base(intercept)
{
}
protected override void PlatformShow(string text, int duration)
{
ToastService.Current.Notify(text);
}
internal static IServiceCollection TryAddToast(IServiceCollection services)
=> TryAddToast<PlatformToastImpl>(services);
}
}
@@ -32,7 +32,7 @@ namespace System.Application.UI.ViewModels
DebugString += Services.ToastService.Current.Message + Environment.NewLine;
DebugString += Services.ToastService.Current.IsVisible + Environment.NewLine;
DI.Get<IMessageWindowService>().ShowDialog("Test", "Test");
//DI.Get<IMessageWindowService>().ShowDialog("Test", "Test");
}
}
}