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:
jimmyandClaude committed 2025-09-25 21:02:53 +08:00
commit 90d09449ae
1196 files changed
+26114

No files matched your search

@@ -0,0 +1,64 @@
using System;
using System.Windows;
using ModuleA.Event;
using Prism.Commands;
using Prism.Events;
using Prism.Services.Dialogs;
namespace ModuleA.ViewModels;
public class CViewModel : IDialogAware
{
public DelegateCommand ConfirmCommand { get; set; }
public DelegateCommand CancelCommand { get; set; }
public CViewModel(IEventAggregator aggregator)
{
ConfirmCommand = new DelegateCommand(Confirm);
CancelCommand = new DelegateCommand(Cancel);
// 通过事件聚合器发布消息
var messageEvent = aggregator.GetEvent<MessageEvent>();
messageEvent.Publish("Hello World");
}
private void Cancel()
{
DialogParameters info = new DialogParameters();
info.Add("address", "Beijing");
RequestClose?.Invoke(new DialogResult(ButtonResult.No, info));
}
private void Confirm()
{
DialogParameters info = new DialogParameters();
info.Add("title", "标题");
RequestClose?.Invoke(new DialogResult(ButtonResult.OK, info));
}
/// <summary>
/// 能否展示
/// </summary>
/// <returns></returns>
public bool CanCloseDialog()
{
return true;
}
/// <summary>
/// 窗口关闭【这个函数是在 CanCloseDialog 触发后调用,此时 RequestClose 一直为 null】
/// </summary>
public void OnDialogClosed()
{
}
public void OnDialogOpened(IDialogParameters parameters)
{
parameters.TryGetValue("age", out int age);
Console.WriteLine(age);
}
public string Title { get; }
public event Action<IDialogResult>? RequestClose;
}