// MainPage.xaml.cs //public Microsoft.UI.Xaml.Controls.NavigationView NavigationView => NavView; public MainPage() { this.InitializeComponent(); Messenger.Default.Register <PropertyChangedMessage <string> >(this, message => { TodoItemService todoItemService = new TodoItemService(); if (message.PropertyName == MoneyPageViewModel.PropertyName) { if (message.OldValue != message.NewValue && message.OldValue != null && message.NewValue != null) { double num = Convert.ToDouble(message.NewValue.Substring(message.NewValue.IndexOf(':') + 1)); double num2 = MoneyPageViewModel._maxConsume; if (MoneyPageViewModel._maxConsume - num <= MoneyPageViewModel._difference) { TodoItem item = new TodoItem(); item.Content = "当前距离消费限额仅剩:" + (MoneyPageViewModel._maxConsume - num).ToString() + "元"; item.DateCreated = DateTime.Now; todoItemService.AddAsync(item); } } } }); PageFrame.Navigate(typeof(MemoPage)); }