Initial commit: .NET practice project
Added CSharp, Nots, and Wpf directories with various practice exercises and projects. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
commit
90d09449ae
1196 files changed
+26114
No files matched your search
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.Runtime.Intrinsics.X86;
|
||||
using System.Windows;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Regions;
|
||||
|
||||
namespace ModuleB.ViewModels;
|
||||
|
||||
public class ViewBModel : BindableBase, INavigationAware,IConfirmNavigationRequest
|
||||
{
|
||||
private string _name;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get => _name;
|
||||
set
|
||||
{
|
||||
_name = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 每次导航到此页面都会调用,是否重用实例
|
||||
/// </summary>
|
||||
/// <param name="navigationContext"></param>
|
||||
/// <returns></returns>
|
||||
public bool IsNavigationTarget(NavigationContext navigationContext)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导航到此页面时调用
|
||||
/// </summary>
|
||||
/// <param name="navigationContext"></param>
|
||||
public void OnNavigatedTo(NavigationContext navigationContext)
|
||||
{
|
||||
if (!navigationContext.Parameters.ContainsKey("name")) return;
|
||||
var value = navigationContext.Parameters.GetValue<string>("name");
|
||||
Name = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 来自哪里的导航
|
||||
/// </summary>
|
||||
/// <param name="navigationContext"></param>
|
||||
public void OnNavigatedFrom(NavigationContext navigationContext)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否能够切换出去
|
||||
/// </summary>
|
||||
/// <param name="navigationContext"></param>
|
||||
/// <param name="continuationCallback"></param>
|
||||
public void ConfirmNavigationRequest(NavigationContext navigationContext, Action<bool> continuationCallback)
|
||||
{
|
||||
var result = MessageBox.Show("是否能够切换出去?","提示", MessageBoxButton.YesNo);
|
||||
if (result == MessageBoxResult.Yes)
|
||||
{
|
||||
continuationCallback(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user