diff --git a/.gitignore b/.gitignore index 9491a2f..8dac6f6 100644 --- a/.gitignore +++ b/.gitignore @@ -360,4 +360,5 @@ MigrationBackup/ .ionide/ # Fody - auto-generated XML schema -FodyWeavers.xsd \ No newline at end of file +FodyWeavers.xsd +/Setup/Output diff --git a/README.md b/README.md new file mode 100644 index 0000000..c9c57a5 --- /dev/null +++ b/README.md @@ -0,0 +1,151 @@ +# TodoList 待办事项管理应用 + +一个基于 C# WPF 开发的轻量、高效桌面待办事项管理应用,专注于通过全局快捷键提供极致的快速记录体验。 + +## 🚀 功能特点 + +### 核心功能 +- **全局快捷键快速记录**:支持系统级全局快捷键(如 `Ctrl + Alt + A`),随时唤起记录窗口 +- **优先级管理**:支持高、中、低三种优先级设置,通过颜色直观区分 +- **任务状态跟踪**:清晰标记任务完成状态,默认隐藏已完成任务 +- **本地数据持久化**:使用 SQLite 数据库保存数据,支持完全离线使用 + +### 技术特性 +- **响应式界面**:基于 WPF 构建的现代化用户界面 +- **MVVM 架构**:采用 CommunityToolkit.Mvvm 实现清晰的架构分层 +- **自包含发布**:支持单文件发布,无需额外依赖 +- **一键打包**:内置自动构建和打包脚本 + +## 🛠️ 技术栈 + +- **开发语言**:C# 10+ +- **UI 框架**:WPF (Windows Presentation Foundation) +- **目标框架**:.NET 8.0 +- **架构模式**:MVVM (Model-View-ViewModel) +- **数据存储**:SQLite (sqlite-net-pcl) +- **打包工具**:Inno Setup 6 +- **依赖管理**:NuGet + +## 📦 安装与使用 + +### 直接安装 +1. 从 `Output` 目录下载最新的安装包:`TodoList_Setup_vX.X.X.exe` +2. 双击运行安装程序,按照提示完成安装 +3. 启动应用后,在系统托盘找到应用图标 + +### 使用说明 +- **快速记录**:按下预设的全局快捷键(默认为 `Ctrl + Alt + A`) +- **添加任务**:在快速记录窗口中输入任务内容,设置优先级,按 Enter 保存 +- **管理任务**:在主界面中查看、编辑和标记任务完成状态 +- **隐藏完成任务**:默认自动隐藏已完成任务,可通过界面开关显示 + +## 🔧 开发指南 + +### 环境要求 +- Visual Studio 2022 或更高版本 +- .NET 8.0 SDK +- Inno Setup 6(用于打包) + +### 快速开始 + +1. **克隆或下载项目** + ```bash + git clone <仓库地址> + cd TodoList + ``` + +2. **打开项目** + - 使用 Visual Studio 打开 `TodoList.slnx` 解决方案 + - 或直接打开 `TodoList/TodoList.csproj` 项目文件 + +3. **安装依赖** + ```bash + dotnet restore + ``` + +4. **运行项目** + ```bash + dotnet run --project TodoList/TodoList.csproj + ``` + +### 构建与发布 + +使用内置的发布脚本进行一键构建和打包: + +```bash +cd TodoList/TodoList +powershell -ExecutionPolicy Bypass -File "BuildSetup.ps1" +``` + +脚本功能: +- 自动递增版本号 +- 更新项目文件和安装脚本版本 +- 编译 Release 版本 +- 生成单文件可执行文件 +- 创建安装程序(输出到 `Output` 目录) + +## 📁 项目结构 + +``` +TodoList/ +├── TodoList/ # 主项目目录 +│ ├── Models/ # 数据模型 +│ ├── Services/ # 服务层(数据访问、快捷键等) +│ ├── ViewModels/ # 视图模型 +│ ├── Views/ # 界面视图 +│ ├── TodoList.csproj # 项目文件 +│ ├── BuildSetup.ps1 # 发布脚本 +│ └── setup.iss # Inno Setup 安装脚本 +├── TodoList.slnx # 解决方案文件 +├── PRD.md # 产品需求文档 +└── README.md # 项目说明文档 +``` + +## 🎯 核心模块说明 + +### QuickEntryWindow +快速记录窗口,通过全局快捷键唤起,提供极简的任务输入体验。 + +### MainWindow +主界面,展示任务列表,支持任务管理和状态切换。 + +### GlobalShortcutService +全局快捷键服务,负责注册和监听系统级快捷键。 + +### SqliteDataService +SQLite 数据服务,实现本地数据持久化。 + +## 🔄 版本更新 + +### 版本策略 +- 采用语义化版本号:`MAJOR.MINOR.PATCH` +- 每次运行发布脚本自动递增 PATCH 版本 + +### 更新日志 + +| 版本 | 日期 | 描述 | +|------|------|------| +| 1.0.17 | 2024-01-XX | 修复发布脚本和安装路径问题 | +| 1.0.16 | 2024-01-XX | 完善任务优先级显示 | +| 1.0.0 | 2024-01-XX | 初始版本发布 | + +## 🤝 贡献指南 + +1. Fork 项目 +2. 创建特性分支 (`git checkout -b feature/AmazingFeature`) +3. 提交更改 (`git commit -m 'Add some AmazingFeature'`) +4. 推送到分支 (`git push origin feature/AmazingFeature`) +5. 打开 Pull Request + +## 📄 许可证 + +本项目采用 MIT 许可证 - 查看 [LICENSE](LICENSE) 文件了解详情 + +## 📞 联系方式 + +- 项目作者:ShaoHua +- 项目地址: + +--- + +**TodoList** - 让任务管理更高效! \ No newline at end of file diff --git a/Setup/Setup.vdproj b/Setup/Setup.vdproj deleted file mode 100644 index 6edd7b8..0000000 --- a/Setup/Setup.vdproj +++ /dev/null @@ -1,956 +0,0 @@ -"DeployProject" -{ -"VSVersion" = "3:800" -"ProjectType" = "8:{978C614F-708E-4E1A-B201-565925725DBA}" -"IsWebType" = "8:FALSE" -"ProjectName" = "8:Setup" -"LanguageId" = "3:2052" -"CodePage" = "3:936" -"UILanguageId" = "3:2052" -"SccProjectName" = "8:" -"SccLocalPath" = "8:" -"SccAuxPath" = "8:" -"SccProvider" = "8:" - "Hierarchy" - { - "Entry" - { - "MsmKey" = "8:_17BA67E2733E421586A690779AE10839" - "OwnerKey" = "8:_UNDEFINED" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_1E301C03308E4C0AADE54375ACCA27E9" - "OwnerKey" = "8:_UNDEFINED" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_34EE79020CA44431B5F09CF100F2B372" - "OwnerKey" = "8:_UNDEFINED" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_42AD4BACEFC94D43B5DE5DDF9177EFAD" - "OwnerKey" = "8:_UNDEFINED" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_4C87263B310A4D3F8CC1BD3265F5B929" - "OwnerKey" = "8:_UNDEFINED" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_65835E291AAA6A7D2371E2E621AF3DC9" - "OwnerKey" = "8:_17BA67E2733E421586A690779AE10839" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_6792D68F0F43409CADA40277C6FE4B43" - "OwnerKey" = "8:_UNDEFINED" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_D50F9EB4AAE7436FBAD775A446017958" - "OwnerKey" = "8:_UNDEFINED" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_17BA67E2733E421586A690779AE10839" - "MsmSig" = "8:_UNDEFINED" - } - } - "Configurations" - { - "Debug" - { - "DisplayName" = "8:Debug" - "IsDebugOnly" = "11:TRUE" - "IsReleaseOnly" = "11:FALSE" - "OutputFilename" = "8:Debug\\Setup.msi" - "PackageFilesAs" = "3:2" - "PackageFileSize" = "3:-2147483648" - "CabType" = "3:1" - "Compression" = "3:2" - "SignOutput" = "11:FALSE" - "CertificateFile" = "8:" - "PrivateKeyFile" = "8:" - "TimeStampServer" = "8:" - "InstallerBootstrapper" = "3:2" - } - "Release" - { - "DisplayName" = "8:Release" - "IsDebugOnly" = "11:FALSE" - "IsReleaseOnly" = "11:TRUE" - "OutputFilename" = "8:Release\\Setup.msi" - "PackageFilesAs" = "3:2" - "PackageFileSize" = "3:-2147483648" - "CabType" = "3:1" - "Compression" = "3:2" - "SignOutput" = "11:FALSE" - "CertificateFile" = "8:" - "PrivateKeyFile" = "8:" - "TimeStampServer" = "8:" - "InstallerBootstrapper" = "3:2" - "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}" - { - "Enabled" = "11:FALSE" - "PromptEnabled" = "11:TRUE" - "PrerequisitesLocation" = "2:1" - "Url" = "8:" - "ComponentsUrl" = "8:" - "Items" - { - "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:.NETFramework,Version=v4.7.2" - { - "Name" = "8:Microsoft .NET Framework 4.7.2 (x86 和 x64)" - "ProductCode" = "8:.NETFramework,Version=v4.7.2" - } - } - } - } - } - "Deployable" - { - "CustomAction" - { - } - "DefaultFeature" - { - "Name" = "8:DefaultFeature" - "Title" = "8:" - "Description" = "8:" - } - "ExternalPersistence" - { - "LaunchCondition" - { - "{A06ECF26-33A3-4562-8140-9B0E340D4F24}:_3DB760AE720B4C9DB0261DBC0A13DD96" - { - "Name" = "8:.NET Framework" - "Message" = "8:[VSDNETMSG]" - "FrameworkVersion" = "8:.NETFramework,Version=v4.7.2" - "AllowLaterVersions" = "11:FALSE" - "InstallUrl" = "8:http://go.microsoft.com/fwlink/?LinkId=863262" - } - } - } - "File" - { - "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_17BA67E2733E421586A690779AE10839" - { - "AssemblyRegister" = "3:1" - "AssemblyIsInGAC" = "11:FALSE" - "AssemblyAsmDisplayName" = "8:TodoList, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL" - "ScatterAssemblies" - { - "_17BA67E2733E421586A690779AE10839" - { - "Name" = "8:TodoList.dll" - "Attributes" = "3:512" - } - } - "SourcePath" = "8:..\\TodoList\\bin\\Debug\\net10.0-windows\\TodoList.dll" - "TargetName" = "8:" - "Tag" = "8:" - "Folder" = "8:_8A20A7DDF24B44E8AC7BBB584966EEF1" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:FALSE" - "IsolateTo" = "8:" - } - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_1E301C03308E4C0AADE54375ACCA27E9" - { - "SourcePath" = "8:..\\TodoList\\bin\\Debug\\net10.0-windows\\TodoList.exe" - "TargetName" = "8:TodoList.exe" - "Tag" = "8:" - "Folder" = "8:_8A20A7DDF24B44E8AC7BBB584966EEF1" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:FALSE" - "IsolateTo" = "8:" - } - "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_34EE79020CA44431B5F09CF100F2B372" - { - "AssemblyRegister" = "3:1" - "AssemblyIsInGAC" = "11:FALSE" - "AssemblyAsmDisplayName" = "8:CommunityToolkit.Mvvm, Version=8.4.0.0, Culture=neutral, PublicKeyToken=4aff67a105548ee2, processorArchitecture=MSIL" - "ScatterAssemblies" - { - "_34EE79020CA44431B5F09CF100F2B372" - { - "Name" = "8:CommunityToolkit.Mvvm.dll" - "Attributes" = "3:512" - } - } - "SourcePath" = "8:..\\TodoList\\bin\\Debug\\net10.0-windows\\CommunityToolkit.Mvvm.dll" - "TargetName" = "8:" - "Tag" = "8:" - "Folder" = "8:_8A20A7DDF24B44E8AC7BBB584966EEF1" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:FALSE" - "IsolateTo" = "8:" - } - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_42AD4BACEFC94D43B5DE5DDF9177EFAD" - { - "SourcePath" = "8:..\\TodoList\\bin\\Debug\\net10.0-windows\\TodoList.runtimeconfig.json" - "TargetName" = "8:TodoList.runtimeconfig.json" - "Tag" = "8:" - "Folder" = "8:_8A20A7DDF24B44E8AC7BBB584966EEF1" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:FALSE" - "IsolateTo" = "8:" - } - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_4C87263B310A4D3F8CC1BD3265F5B929" - { - "SourcePath" = "8:..\\TodoList\\bin\\Debug\\net10.0-windows\\TodoList.deps.json" - "TargetName" = "8:TodoList.deps.json" - "Tag" = "8:" - "Folder" = "8:_8A20A7DDF24B44E8AC7BBB584966EEF1" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:FALSE" - "IsolateTo" = "8:" - } - "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_65835E291AAA6A7D2371E2E621AF3DC9" - { - "AssemblyRegister" = "3:1" - "AssemblyIsInGAC" = "11:FALSE" - "AssemblyAsmDisplayName" = "8:CommunityToolkit.Mvvm, Version=8.4.0.0, Culture=neutral, PublicKeyToken=4aff67a105548ee2, processorArchitecture=MSIL" - "ScatterAssemblies" - { - "_65835E291AAA6A7D2371E2E621AF3DC9" - { - "Name" = "8:CommunityToolkit.Mvvm.dll" - "Attributes" = "3:512" - } - } - "SourcePath" = "8:CommunityToolkit.Mvvm.dll" - "TargetName" = "8:" - "Tag" = "8:" - "Folder" = "8:_8A20A7DDF24B44E8AC7BBB584966EEF1" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:TRUE" - "IsolateTo" = "8:" - } - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_D50F9EB4AAE7436FBAD775A446017958" - { - "SourcePath" = "8:..\\TodoList\\bin\\Debug\\net10.0-windows\\icon.ico" - "TargetName" = "8:icon.ico" - "Tag" = "8:" - "Folder" = "8:_8A20A7DDF24B44E8AC7BBB584966EEF1" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:FALSE" - "IsolateTo" = "8:" - } - } - "FileType" - { - } - "Folder" - { - "{1525181F-901A-416C-8A58-119130FE478E}:_4CF5CB48101445E3B47CD2485BDDA511" - { - "Name" = "8:#1916" - "AlwaysCreate" = "11:FALSE" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Property" = "8:DesktopFolder" - "Folders" - { - } - } - "{3C67513D-01DD-4637-8A68-80971EB9504F}:_8A20A7DDF24B44E8AC7BBB584966EEF1" - { - "DefaultLocation" = "8:[ProgramFilesFolder][Manufacturer]\\[ProductName]" - "Name" = "8:#1925" - "AlwaysCreate" = "11:FALSE" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Property" = "8:TARGETDIR" - "Folders" - { - } - } - "{1525181F-901A-416C-8A58-119130FE478E}:_BF5ADB1EDBF04FA0A47DA23313C521B9" - { - "Name" = "8:#1919" - "AlwaysCreate" = "11:FALSE" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Property" = "8:ProgramMenuFolder" - "Folders" - { - } - } - } - "LaunchCondition" - { - } - "Locator" - { - } - "MsiBootstrapper" - { - "LangId" = "3:2052" - "RequiresElevation" = "11:FALSE" - } - "Product" - { - "Name" = "8:Microsoft Visual Studio" - "ProductName" = "8:TodoList" - "ProductCode" = "8:{146611B1-AB9F-46C3-8FD4-EE7BCEC54C33}" - "PackageCode" = "8:{151EF683-7149-4D7A-9134-3092572B04CD}" - "UpgradeCode" = "8:{82F2F6EB-C24C-477B-81E6-43EDB0EE36B0}" - "AspNetVersion" = "8:4.0.30319.0" - "RestartWWWService" = "11:FALSE" - "RemovePreviousVersions" = "11:TRUE" - "DetectNewerInstalledVersion" = "11:TRUE" - "InstallAllUsers" = "11:TRUE" - "ProductVersion" = "8:1.0.0" - "Manufacturer" = "8:ShaoHua" - "ARPHELPTELEPHONE" = "8:" - "ARPHELPLINK" = "8:" - "Title" = "8:TodoList" - "Subject" = "8:" - "ARPCONTACT" = "8:ShaoHua" - "Keywords" = "8:" - "ARPCOMMENTS" = "8:" - "ARPURLINFOABOUT" = "8:" - "ARPPRODUCTICON" = "8:" - "ARPIconIndex" = "3:0" - "SearchPath" = "8:" - "UseSystemSearchPath" = "11:TRUE" - "TargetPlatform" = "3:0" - "PreBuildEvent" = "8:" - "PostBuildEvent" = "8:" - "RunPostBuildEvent" = "3:0" - } - "Registry" - { - "HKLM" - { - "Keys" - { - "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_8522CD2219284FA48C170669A2A3D9B3" - { - "Name" = "8:Software" - "Condition" = "8:" - "AlwaysCreate" = "11:FALSE" - "DeleteAtUninstall" = "11:FALSE" - "Transitive" = "11:FALSE" - "Keys" - { - "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_2553544E11294AD0ACF21B6F2D65909C" - { - "Name" = "8:[Manufacturer]" - "Condition" = "8:" - "AlwaysCreate" = "11:FALSE" - "DeleteAtUninstall" = "11:FALSE" - "Transitive" = "11:FALSE" - "Keys" - { - } - "Values" - { - } - } - } - "Values" - { - } - } - } - } - "HKCU" - { - "Keys" - { - "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_BD961664BECD4769871995ED2576A507" - { - "Name" = "8:Software" - "Condition" = "8:" - "AlwaysCreate" = "11:FALSE" - "DeleteAtUninstall" = "11:FALSE" - "Transitive" = "11:FALSE" - "Keys" - { - "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_885FDEC4E0C3484CA36F1A96BEAD1D41" - { - "Name" = "8:[Manufacturer]" - "Condition" = "8:" - "AlwaysCreate" = "11:FALSE" - "DeleteAtUninstall" = "11:FALSE" - "Transitive" = "11:FALSE" - "Keys" - { - } - "Values" - { - } - } - } - "Values" - { - } - } - } - } - "HKCR" - { - "Keys" - { - } - } - "HKU" - { - "Keys" - { - } - } - "HKPU" - { - "Keys" - { - } - } - } - "Sequences" - { - } - "Shortcut" - { - "{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_0D031B70CF7542448AC7303C2ED6DC6A" - { - "Name" = "8:TodoList" - "Arguments" = "8:" - "Description" = "8:" - "ShowCmd" = "3:1" - "IconIndex" = "3:0" - "Transitive" = "11:FALSE" - "Target" = "8:_1E301C03308E4C0AADE54375ACCA27E9" - "Folder" = "8:_BF5ADB1EDBF04FA0A47DA23313C521B9" - "WorkingFolder" = "8:_8A20A7DDF24B44E8AC7BBB584966EEF1" - "Icon" = "8:_D50F9EB4AAE7436FBAD775A446017958" - "Feature" = "8:" - } - "{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_AE6A93A941DD4EEDA219EAF034A157CC" - { - "Name" = "8:todoList主输出" - "Arguments" = "8:" - "Description" = "8:" - "ShowCmd" = "3:1" - "IconIndex" = "3:0" - "Transitive" = "11:FALSE" - "Target" = "8:_6792D68F0F43409CADA40277C6FE4B43" - "Folder" = "8:_BF5ADB1EDBF04FA0A47DA23313C521B9" - "WorkingFolder" = "8:_8A20A7DDF24B44E8AC7BBB584966EEF1" - "Icon" = "8:_D50F9EB4AAE7436FBAD775A446017958" - "Feature" = "8:" - } - } - "UserInterface" - { - "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_1A5922191B3444D2ADBFAAAEE654AFBE" - { - "UseDynamicProperties" = "11:FALSE" - "IsDependency" = "11:FALSE" - "SourcePath" = "8:\\VsdBasicDialogs.wim" - } - "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_1A7F6DF07CA34F1290B53C77E9A24DCD" - { - "Name" = "8:#1901" - "Sequence" = "3:1" - "Attributes" = "3:2" - "Dialogs" - { - "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_12C9A09546FF47E89C2F76E5857982C5" - { - "Sequence" = "3:100" - "DisplayName" = "8:进度" - "UseDynamicProperties" = "11:TRUE" - "IsDependency" = "11:FALSE" - "SourcePath" = "8:\\VsdProgressDlg.wid" - "Properties" - { - "BannerBitmap" - { - "Name" = "8:BannerBitmap" - "DisplayName" = "8:#1001" - "Description" = "8:#1101" - "Type" = "3:8" - "ContextData" = "8:Bitmap" - "Attributes" = "3:4" - "Setting" = "3:1" - "UsePlugInResources" = "11:TRUE" - } - "ShowProgress" - { - "Name" = "8:ShowProgress" - "DisplayName" = "8:#1009" - "Description" = "8:#1109" - "Type" = "3:5" - "ContextData" = "8:1;True=1;False=0" - "Attributes" = "3:0" - "Setting" = "3:0" - "Value" = "3:1" - "DefaultValue" = "3:1" - "UsePlugInResources" = "11:TRUE" - } - } - } - } - } - "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_1BED33199298468C95ACE087FD867323" - { - "Name" = "8:#1902" - "Sequence" = "3:1" - "Attributes" = "3:3" - "Dialogs" - { - "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_3F862D9E99F34183BC0479F9A6500399" - { - "Sequence" = "3:100" - "DisplayName" = "8:已完成" - "UseDynamicProperties" = "11:TRUE" - "IsDependency" = "11:FALSE" - "SourcePath" = "8:\\VsdFinishedDlg.wid" - "Properties" - { - "BannerBitmap" - { - "Name" = "8:BannerBitmap" - "DisplayName" = "8:#1001" - "Description" = "8:#1101" - "Type" = "3:8" - "ContextData" = "8:Bitmap" - "Attributes" = "3:4" - "Setting" = "3:1" - "UsePlugInResources" = "11:TRUE" - } - "UpdateText" - { - "Name" = "8:UpdateText" - "DisplayName" = "8:#1058" - "Description" = "8:#1158" - "Type" = "3:15" - "ContextData" = "8:" - "Attributes" = "3:0" - "Setting" = "3:1" - "Value" = "8:#1258" - "DefaultValue" = "8:#1258" - "UsePlugInResources" = "11:TRUE" - } - } - } - } - } - "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_2579AFB8C446463A9A8BCBDE6897AF55" - { - "Name" = "8:#1901" - "Sequence" = "3:2" - "Attributes" = "3:2" - "Dialogs" - { - "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_1F08E1AAFAC14C4BA560722C839F686C" - { - "Sequence" = "3:100" - "DisplayName" = "8:进度" - "UseDynamicProperties" = "11:TRUE" - "IsDependency" = "11:FALSE" - "SourcePath" = "8:\\VsdAdminProgressDlg.wid" - "Properties" - { - "BannerBitmap" - { - "Name" = "8:BannerBitmap" - "DisplayName" = "8:#1001" - "Description" = "8:#1101" - "Type" = "3:8" - "ContextData" = "8:Bitmap" - "Attributes" = "3:4" - "Setting" = "3:1" - "UsePlugInResources" = "11:TRUE" - } - "ShowProgress" - { - "Name" = "8:ShowProgress" - "DisplayName" = "8:#1009" - "Description" = "8:#1109" - "Type" = "3:5" - "ContextData" = "8:1;True=1;False=0" - "Attributes" = "3:0" - "Setting" = "3:0" - "Value" = "3:1" - "DefaultValue" = "3:1" - "UsePlugInResources" = "11:TRUE" - } - } - } - } - } - "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_669B474BCA014E7C9871D52674DC793E" - { - "Name" = "8:#1900" - "Sequence" = "3:1" - "Attributes" = "3:1" - "Dialogs" - { - "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_0EFA62CCD2C843EAA044829F13217B57" - { - "Sequence" = "3:300" - "DisplayName" = "8:确认安装" - "UseDynamicProperties" = "11:TRUE" - "IsDependency" = "11:FALSE" - "SourcePath" = "8:\\VsdConfirmDlg.wid" - "Properties" - { - "BannerBitmap" - { - "Name" = "8:BannerBitmap" - "DisplayName" = "8:#1001" - "Description" = "8:#1101" - "Type" = "3:8" - "ContextData" = "8:Bitmap" - "Attributes" = "3:4" - "Setting" = "3:1" - "UsePlugInResources" = "11:TRUE" - } - } - } - "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_860D684F21184955A2394B2FAE3B85B3" - { - "Sequence" = "3:200" - "DisplayName" = "8:安装文件夹" - "UseDynamicProperties" = "11:TRUE" - "IsDependency" = "11:FALSE" - "SourcePath" = "8:\\VsdFolderDlg.wid" - "Properties" - { - "BannerBitmap" - { - "Name" = "8:BannerBitmap" - "DisplayName" = "8:#1001" - "Description" = "8:#1101" - "Type" = "3:8" - "ContextData" = "8:Bitmap" - "Attributes" = "3:4" - "Setting" = "3:1" - "UsePlugInResources" = "11:TRUE" - } - "InstallAllUsersVisible" - { - "Name" = "8:InstallAllUsersVisible" - "DisplayName" = "8:#1059" - "Description" = "8:#1159" - "Type" = "3:5" - "ContextData" = "8:1;True=1;False=0" - "Attributes" = "3:0" - "Setting" = "3:0" - "Value" = "3:1" - "DefaultValue" = "3:1" - "UsePlugInResources" = "11:TRUE" - } - } - } - "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_F62A5F384AC4466DAA5560FD53102C9B" - { - "Sequence" = "3:100" - "DisplayName" = "8:欢迎使用" - "UseDynamicProperties" = "11:TRUE" - "IsDependency" = "11:FALSE" - "SourcePath" = "8:\\VsdWelcomeDlg.wid" - "Properties" - { - "BannerBitmap" - { - "Name" = "8:BannerBitmap" - "DisplayName" = "8:#1001" - "Description" = "8:#1101" - "Type" = "3:8" - "ContextData" = "8:Bitmap" - "Attributes" = "3:4" - "Setting" = "3:1" - "UsePlugInResources" = "11:TRUE" - } - "CopyrightWarning" - { - "Name" = "8:CopyrightWarning" - "DisplayName" = "8:#1002" - "Description" = "8:#1102" - "Type" = "3:3" - "ContextData" = "8:" - "Attributes" = "3:0" - "Setting" = "3:1" - "Value" = "8:#1202" - "DefaultValue" = "8:#1202" - "UsePlugInResources" = "11:TRUE" - } - "Welcome" - { - "Name" = "8:Welcome" - "DisplayName" = "8:#1003" - "Description" = "8:#1103" - "Type" = "3:3" - "ContextData" = "8:" - "Attributes" = "3:0" - "Setting" = "3:1" - "Value" = "8:#1203" - "DefaultValue" = "8:#1203" - "UsePlugInResources" = "11:TRUE" - } - } - } - } - } - "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_B97CCC8EE8F848C2A4276A2E58150A45" - { - "Name" = "8:#1902" - "Sequence" = "3:2" - "Attributes" = "3:3" - "Dialogs" - { - "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_1CDE38F50B454FFA8F5C722E23D7165D" - { - "Sequence" = "3:100" - "DisplayName" = "8:已完成" - "UseDynamicProperties" = "11:TRUE" - "IsDependency" = "11:FALSE" - "SourcePath" = "8:\\VsdAdminFinishedDlg.wid" - "Properties" - { - "BannerBitmap" - { - "Name" = "8:BannerBitmap" - "DisplayName" = "8:#1001" - "Description" = "8:#1101" - "Type" = "3:8" - "ContextData" = "8:Bitmap" - "Attributes" = "3:4" - "Setting" = "3:1" - "UsePlugInResources" = "11:TRUE" - } - } - } - } - } - "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_F85F3CEDA84E4C21AA1D2BEB630006E7" - { - "UseDynamicProperties" = "11:FALSE" - "IsDependency" = "11:FALSE" - "SourcePath" = "8:\\VsdUserInterface.wim" - } - "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_F879EDB3FFCC474E9059D6DC3BED5CBE" - { - "Name" = "8:#1900" - "Sequence" = "3:2" - "Attributes" = "3:1" - "Dialogs" - { - "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_4384C55A823E4238A33E43C392ADB6C2" - { - "Sequence" = "3:200" - "DisplayName" = "8:安装文件夹" - "UseDynamicProperties" = "11:TRUE" - "IsDependency" = "11:FALSE" - "SourcePath" = "8:\\VsdAdminFolderDlg.wid" - "Properties" - { - "BannerBitmap" - { - "Name" = "8:BannerBitmap" - "DisplayName" = "8:#1001" - "Description" = "8:#1101" - "Type" = "3:8" - "ContextData" = "8:Bitmap" - "Attributes" = "3:4" - "Setting" = "3:1" - "UsePlugInResources" = "11:TRUE" - } - } - } - "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_4D730CD1E9A541A9A0357FD14F274504" - { - "Sequence" = "3:100" - "DisplayName" = "8:欢迎使用" - "UseDynamicProperties" = "11:TRUE" - "IsDependency" = "11:FALSE" - "SourcePath" = "8:\\VsdAdminWelcomeDlg.wid" - "Properties" - { - "BannerBitmap" - { - "Name" = "8:BannerBitmap" - "DisplayName" = "8:#1001" - "Description" = "8:#1101" - "Type" = "3:8" - "ContextData" = "8:Bitmap" - "Attributes" = "3:4" - "Setting" = "3:1" - "UsePlugInResources" = "11:TRUE" - } - "CopyrightWarning" - { - "Name" = "8:CopyrightWarning" - "DisplayName" = "8:#1002" - "Description" = "8:#1102" - "Type" = "3:3" - "ContextData" = "8:" - "Attributes" = "3:0" - "Setting" = "3:1" - "Value" = "8:#1202" - "DefaultValue" = "8:#1202" - "UsePlugInResources" = "11:TRUE" - } - "Welcome" - { - "Name" = "8:Welcome" - "DisplayName" = "8:#1003" - "Description" = "8:#1103" - "Type" = "3:3" - "ContextData" = "8:" - "Attributes" = "3:0" - "Setting" = "3:1" - "Value" = "8:#1203" - "DefaultValue" = "8:#1203" - "UsePlugInResources" = "11:TRUE" - } - } - } - "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_88BC734F7F1D4494AEE5F11E9797CD6B" - { - "Sequence" = "3:300" - "DisplayName" = "8:确认安装" - "UseDynamicProperties" = "11:TRUE" - "IsDependency" = "11:FALSE" - "SourcePath" = "8:\\VsdAdminConfirmDlg.wid" - "Properties" - { - "BannerBitmap" - { - "Name" = "8:BannerBitmap" - "DisplayName" = "8:#1001" - "Description" = "8:#1101" - "Type" = "3:8" - "ContextData" = "8:Bitmap" - "Attributes" = "3:4" - "Setting" = "3:1" - "UsePlugInResources" = "11:TRUE" - } - } - } - } - } - } - "MergeModule" - { - } - "ProjectOutput" - { - "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_6792D68F0F43409CADA40277C6FE4B43" - { - "SourcePath" = "8:..\\TodoList\\obj\\Debug\\net10.0-windows\\TodoList.dll" - "TargetName" = "8:" - "Tag" = "8:" - "Folder" = "8:_8A20A7DDF24B44E8AC7BBB584966EEF1" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:FALSE" - "IsolateTo" = "8:" - "ProjectOutputGroupRegister" = "3:1" - "OutputConfiguration" = "8:" - "OutputGroupCanonicalName" = "8:Built" - "OutputProjectGuid" = "8:{6CD40A2D-545E-C111-D437-1BE9E9C2C98C}" - "ShowKeyOutput" = "11:TRUE" - "ExcludeFilters" - { - } - } - } - } -} diff --git a/TodoList.slnx b/TodoList.slnx index 858e741..d463135 100644 --- a/TodoList.slnx +++ b/TodoList.slnx @@ -5,6 +5,5 @@ - diff --git a/TodoList/App.xaml.cs b/TodoList/App.xaml.cs index 0ed47db..bf98aa1 100644 --- a/TodoList/App.xaml.cs +++ b/TodoList/App.xaml.cs @@ -101,7 +101,7 @@ namespace TodoList try { _settingsService = new SettingsService(); - _dataService = new FileDataService(); + _dataService = new SqliteDataService(); _shortcutService = new GlobalShortcutService(); var mainViewModel = new MainViewModel(_dataService, _settingsService); diff --git a/TodoList/BuildSetup.ps1 b/TodoList/BuildSetup.ps1 new file mode 100644 index 0000000..2bb2da4 --- /dev/null +++ b/TodoList/BuildSetup.ps1 @@ -0,0 +1,55 @@ +$ErrorActionPreference = "Stop" + +# Basic configuration +$ScriptPath = $PSScriptRoot +$ProjectFile = (Get-ChildItem -Path $ScriptPath -Filter "*.csproj" -File)[0].FullName +$SetupScript = Join-Path $ScriptPath "setup.iss" + +# Read version from project file +$currentVersion = "1.0.0" +[xml]$csproj = Get-Content $ProjectFile +if ($csproj.Project.PropertyGroup.Version) { + $currentVersion = $csproj.Project.PropertyGroup.Version +} + +# Increment version +$versionParts = $currentVersion.Split(".") +$patch = [int]$versionParts[2] + 1 +$newVersion = $versionParts[0] + "." + $versionParts[1] + "." + $patch + +# Update project version +$content = Get-Content $ProjectFile -Raw +$content = $content -replace ".*", "$newVersion" +Set-Content $ProjectFile -Value $content + +# Update setup script version +if (Test-Path $SetupScript) { + $issContent = Get-Content $SetupScript + for ($i = 0; $i -lt $issContent.Count; $i++) { + if ($issContent[$i] -like '#define MyAppVersion *') { + $issContent[$i] = '#define MyAppVersion "' + $newVersion + '"' + break + } + } + Set-Content $SetupScript -Value $issContent +} + +# Build project +dotnet publish $ProjectFile -c Release -r win-x64 --self-contained false -p:PublishSingleFile=true +if ($LASTEXITCODE -ne 0) { + Write-Error "Build failed" + exit 1 +} + +# Package +$ISCC = "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe" +if (Test-Path $ISCC) { + & $ISCC $SetupScript + if ($LASTEXITCODE -eq 0) { + Write-Host "Setup package created successfully!" -ForegroundColor Green + } else { + Write-Error "Packaging failed" + } +} else { + Write-Error "Inno Setup compiler not found" +} diff --git a/TodoList/Models/TodoItem.cs b/TodoList/Models/TodoItem.cs index 3ec4228..68eb565 100644 --- a/TodoList/Models/TodoItem.cs +++ b/TodoList/Models/TodoItem.cs @@ -25,6 +25,7 @@ namespace TodoList.Models public partial class TodoItem : ObservableObject { [ObservableProperty] + [property: SQLite.PrimaryKey] private string id = Guid.NewGuid().ToString(); [ObservableProperty] diff --git a/TodoList/Output/TodoList_Setup_v1.0.17.exe b/TodoList/Output/TodoList_Setup_v1.0.17.exe new file mode 100644 index 0000000..f7d4d2a Binary files /dev/null and b/TodoList/Output/TodoList_Setup_v1.0.17.exe differ diff --git a/TodoList/Output/TodoList_Setup_v1.0.18.exe b/TodoList/Output/TodoList_Setup_v1.0.18.exe new file mode 100644 index 0000000..bd1eeac Binary files /dev/null and b/TodoList/Output/TodoList_Setup_v1.0.18.exe differ diff --git a/TodoList/Services/SqliteDataService.cs b/TodoList/Services/SqliteDataService.cs new file mode 100644 index 0000000..bb2eabd --- /dev/null +++ b/TodoList/Services/SqliteDataService.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using SQLite; +using TodoList.Models; + +namespace TodoList.Services +{ + public class SqliteDataService : IDataService + { + private readonly SQLiteAsyncConnection _database; + + public SqliteDataService() + { + var appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); + var folder = Path.Combine(appData, "TodoListApp"); + Directory.CreateDirectory(folder); + var databasePath = Path.Combine(folder, "TodoList.sqlite"); + + _database = new SQLiteAsyncConnection(databasePath); + _database.CreateTableAsync().Wait(); + } + + public async Task> LoadTasksAsync() + { + return await _database.Table().ToListAsync(); + } + + public async Task SaveTaskAsync(TodoItem task) + { + await _database.InsertOrReplaceAsync(task); + } + + public async Task SaveAllAsync(List tasks) + { + await _database.RunInTransactionAsync(tran => + { + foreach (var task in tasks) + { + tran.InsertOrReplace(task); + } + }); + } + + public async Task DeleteTaskAsync(string id) + { + await _database.DeleteAsync(id); + } + } +} diff --git a/TodoList/TodoList.csproj b/TodoList/TodoList.csproj index b399328..37cc11f 100644 --- a/TodoList/TodoList.csproj +++ b/TodoList/TodoList.csproj @@ -1,17 +1,19 @@ - + WinExe - net10.0-windows + net8.0-windows enable enable true true icon.ico + 1.0.18 + @@ -19,3 +21,21 @@ + + + + + + + + + + + + + + + + + + diff --git a/TodoList/ViewModels/MainViewModel.cs b/TodoList/ViewModels/MainViewModel.cs index c68a825..92fe59d 100644 --- a/TodoList/ViewModels/MainViewModel.cs +++ b/TodoList/ViewModels/MainViewModel.cs @@ -37,6 +37,8 @@ namespace TodoList.ViewModels [NotifyPropertyChangedFor(nameof(FullShortcut))] private string shortcutModifiers; + public string AppVersion => System.Reflection.Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "1.0.0"; + public string FullShortcut { get diff --git a/TodoList/Views/MainWindow.xaml b/TodoList/Views/MainWindow.xaml index 29a8ab8..134bb4e 100644 --- a/TodoList/Views/MainWindow.xaml +++ b/TodoList/Views/MainWindow.xaml @@ -7,10 +7,11 @@ xmlns:models="clr-namespace:TodoList.Models" xmlns:converters="clr-namespace:TodoList.Converters" mc:Ignorable="d" - Title="待办事项" Height="600" Width="450" + Title="{Binding AppVersion, StringFormat='待办事项 v{0}'}" Height="600" Width="450" Background="#F5F5F7" Icon="/icon.ico" - WindowStartupLocation="CenterScreen"> + WindowStartupLocation="CenterScreen" + PreviewKeyDown="Window_PreviewKeyDown">