编程技术分享 - 2024年2月
type: channel
link: https://www.codespool.com/index.php/2024/02/
description: Your description here.
items: WPF_Release发布后可以删除的文件
items: WPF_激活码程序
items: C#_常用工具库
items: C#_WPF_MVVM_实现登录功能

WPF_Release发布后可以删除的文件
type: item
date: 2024-02-27T23:11:00+08:00
description: VideoWaterMark:1.【app.publish文件夹】2.【*.pdb 文件】3.【*.xml 文件】4.【VideoWatermark.application 文件】5.【VideoWatermark.exe.manifest 文件】

WPF_激活码程序
type: item
date: 2024-02-23T15:24:00+08:00
description: 1.Nuget引入HandyControl https://handyorg.github.io/handycontrol/quick_start/2.Nuget引入Enums.NET 并且 System.Runtime.CompilerServices.Unsafe 使用6.0版本3.添加引用 System.Text.Json、System.Memory、System.Management4.using System.Text.Json; using System.Management;

C#_常用工具库
type: item
date: 2024-02-04T16:44:54+08:00
description: 1.FFmpeg_视频处理2.PdfiumViewer_C# PDF转图片（JPG，Png）_https://blog.csdn.net/tnb_ml/article/details/124915260

C#_WPF_MVVM_实现登录功能
type: item
date: 2024-02-02T20:33:00+08:00
description: 创建Model（模型）首先定义一个LoginModel模型来表示登录信息。namespace Login.Model { public class LoginModel { public string Username { get; set; } public string Password { get; set; } } }创建ViewModel（视图模型）ViewModel作为View和Model之间的桥梁，包含用户输入的数据和命令绑定。using System; using System.ComponentModel; using System.Windows.Input; using Login.Command; using Login.Model; namespace Login.ViewModel { public class LoginViewModel : INotifyPropertyChanged { private LoginModel loginModel; public String Username { get { return loginModel.Username; } set { this.loginModel.Username = value; OnPropertyChanged(nameof(Username)); } } public String Password { get { return loginModel.Password; } set { this.loginModel.Password = value; OnPropertyChanged("Password"); } } public ICommand LoginCommand { get; private set; } public LoginViewModel() { loginModel = new LoginModel(); LoginCommand = new RelayCommand(Login, CanLogin); } private void Login(object parameter) { // 在这里添加登入逻辑 if (CanLogin(null)) { Console.WriteLine($"登录成功：用户名={Username}, 密码={Password}"); } } private bool CanLogin(object parameter) { // 在这里添加验证逻辑 return !string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password); } public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged(string propertyName) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } }创建View（视图）接下来创建XAML界面用于用户输入和触发登录命令。 <TextBox Text="{Binding Username, UpdateSourceTrigger=PropertyChanged}" Margin="0,5"/> <TextBox Text="{Binding Password, UpdateSourceTrigger=PropertyChanged}" Margin="0,5"/> 4.创建RelayCommandRelayCommand是一个实现了ICommand接口的类，用于绑定View中的命令到ViewModel的命令处理方法using System; using System.Windows.Input; namespace Login.Command { public class RelayCommand : ICommand { private readonly Action _execute; private readonly Func<object, bool> _canExecute; public RelayCommand(Action execute, Func<object, bool> canExecute = null) { _execute = execute ?? throw new ArgumentNullException(nameof(execute)); _canExecute = canExe…