我最近一直在学习MAUI Blazor,想try 更改窗口左上角的托盘图标,因为它默认为空白.
我一直在学习本教程:
https://www.youtube.com/watch?v=n_HJcDHuMMw
以以下回购为例:
https://github.com/coding-flamingo/BazorAndMaui
但这给我留下了最后一个问题,即使我try 在GitHub上编译示例代码,我也会遇到这个问题:我在Visual Studio中遇到一个错误,即"IWindowsLifecycleBuilder"不包含在以下代码位中使用的"OnNativeMessage"的定义:
builder.ConfigureLifecycleEvents(lifecycle =>
{
#if WINDOWS
lifecycle
.AddWindows(windows =>
windows.OnNativeMessage((app, args) => {
if (VTix.Platforms.Windows.WindowExtensions.Hwnd == IntPtr.Zero)
{
VTix.Platforms.Windows.WindowExtensions.Hwnd = args.Hwnd;
VTix.Platforms.Windows.WindowExtensions.SetIcon("Platforms/Windows/trayicon.ico");
}
app.ExtendsContentIntoTitleBar = false;
}));
#endif
});
据我所知,我正在使用所有正确的"using"指令和nuget包,所以我不理解为什么找不到该方法.
以下是所有"使用"指令:
共享:
@using System.Net.Http
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop
@using VTix
@using VTix.Shared
@using Radzen
@using Radzen.Blazor
在MauiProgram中.反恐精英:
using VTix.Data;
using VTix.Services;
using Microsoft.AspNetCore.Components.WebView.Maui;
using Microsoft.Maui.LifecycleEvents;