清理引用,将NavigatorServices更改为使用Message来实现导航的切换

This commit is contained in:
2025-06-23 17:01:06 +08:00
parent 8ee4b7bc05
commit 8fcd2fdf2a
62 changed files with 711 additions and 767 deletions

View File

@@ -1,37 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Messaging;
using Microsoft.Extensions.Hosting;
using PMSWPF.Message;
using Microsoft.Extensions.Hosting;
namespace PMSWPF.Services
namespace PMSWPF.Services;
internal class DemoBackgroundService : BackgroundService
{
internal class DemoBackgroundService : BackgroundService
private int count = 0;
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
int count = 0;
public DemoBackgroundService()
{
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
while (!stoppingToken.IsCancellationRequested)
{
await Task.Delay(1000);
count += 1;
var msg = new MyMessage(35) { Count = count };
WeakReferenceMessenger.Default.Send<MyMessage>(msg);
Console.WriteLine("Hello");
}
}
// while (!stoppingToken.IsCancellationRequested)
// {
// await Task.Delay(1000);
// count += 1;
// var msg = new MyMessage(35) { Count = count };
// WeakReferenceMessenger.Default.Send<MyMessage>(msg);
// Console.WriteLine("Hello");
// }
}
}
}