初始化上传
This commit is contained in:
51
常用工具集/Base/GlobalValues.cs
Normal file
51
常用工具集/Base/GlobalValues.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Notifications;
|
||||
using Avalonia.Input.Platform;
|
||||
using Avalonia.Platform.Storage;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace 常用工具集.Base
|
||||
{
|
||||
internal class GlobalValues
|
||||
{
|
||||
public static Ursa.Controls.WindowNotificationManager? NotificationManager { get; set; }
|
||||
public static Window MainWindow { get; internal set; }
|
||||
public static IStorageProvider StorageProvider { get; internal set; }
|
||||
public static IClipboard Clipboard { get; internal set; }
|
||||
|
||||
public static void ShowNotification(string title, string message, NotificationType type)
|
||||
{
|
||||
if (NotificationManager != null)
|
||||
{
|
||||
NotificationManager?.Show(new Notification(title, message), showIcon: true, showClose: false, type: type);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Error(string message)
|
||||
{
|
||||
if (NotificationManager != null)
|
||||
{
|
||||
NotificationManager?.Show(message, NotificationType.Error, TimeSpan.FromSeconds(1), true, false);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Warning(string message)
|
||||
{
|
||||
if (NotificationManager != null)
|
||||
{
|
||||
NotificationManager?.Show(message, NotificationType.Warning, TimeSpan.FromSeconds(1), true, false);
|
||||
}
|
||||
}
|
||||
public static void Success(string message)
|
||||
{
|
||||
if (NotificationManager != null)
|
||||
{
|
||||
NotificationManager?.Show(message, NotificationType.Success, TimeSpan.FromSeconds(1), true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user