UI添加消息聚合器
<md:Snackbar
x:Name="LoginSnakeBar"
Grid.ColumnSpan="2"
Panel.ZIndex="1"
MessageQueue="{md:MessageQueue}" />
注册提示消息
文件:Mytodo.Views.LoginView.cs构造函数添加内容
//注册提示消息
aggregator.ResgiterMessage(arg =>
{
LoginSnakeBar.MessageQueue.Enqueue(arg.Message);
}, "Login");
在需要的地方添加提示消息
修改文件:Mytodo.ViewModels.LoginViewModel.cs
using AutoMapper;
using Mytodo.Extensions;
using Mytodo.Service;
using MyToDo.Api.Context;
using MyToDo.Share;
using MyToDo.Share.Models;
using Prism.Commands;
using Prism.Events;
using Prism.Mvvm;
using Prism.Services.Dialogs;
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Shapes;
namespace Mytodo.ViewModels
{
public class LoginViewModel : BindableBase, IDialogAware
{
#region 定义命令
/// <summary>
/// 执行