ceb77e624e
feat: 重构 TodoList 架构,新增动态 API 与 MAUI 内嵌 Web 服务 feat:优化交互逻辑,优化发布流程
59 lines
1.5 KiB
C#
59 lines
1.5 KiB
C#
using TodoList.Maui.Services.Platforms;
|
|
|
|
namespace TodoList.Maui.Services
|
|
{
|
|
/// <summary>
|
|
/// 全局热键服务工厂类,根据平台创建相应的热键服务实例
|
|
/// </summary>
|
|
public static class GlobalHotKeyServiceFactory
|
|
{
|
|
/// <summary>
|
|
/// 创建适合当前平台的全局热键服务实例
|
|
/// </summary>
|
|
/// <returns>全局热键服务实例</returns>
|
|
public static IGlobalHotKeyService Create()
|
|
{
|
|
#if WINDOWS
|
|
return new WindowsGlobalHotKeyService();
|
|
#elif MACCATALYST
|
|
return new MacGlobalHotKeyService();
|
|
#elif ANDROID || IOS
|
|
return new MobileGlobalHotKeyService();
|
|
#else
|
|
return new NullGlobalHotKeyService();
|
|
#endif
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 空热键服务实现类,用于不支持热键的平台
|
|
/// </summary>
|
|
public class NullGlobalHotKeyService : IGlobalHotKeyService
|
|
{
|
|
/// <summary>
|
|
/// 不支持热键
|
|
/// </summary>
|
|
public bool IsSupported => false;
|
|
|
|
/// <summary>
|
|
/// 注册热键(空实现)
|
|
/// </summary>
|
|
public void RegisterHotKey(string modifiers, string key, Action callback)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// 注销热键(空实现)
|
|
/// </summary>
|
|
public void UnregisterHotKey()
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新热键(空实现)
|
|
/// </summary>
|
|
public void UpdateHotKey(string modifiers, string key)
|
|
{
|
|
}
|
|
}
|
|
} |