Skip to content

Rewrite UpdateService as WPF .NET 8#3

Merged
gb63728f4 merged 3 commits into
mainfrom
copilot/convert-to-wpf-using-net8
Apr 7, 2026
Merged

Rewrite UpdateService as WPF .NET 8#3
gb63728f4 merged 3 commits into
mainfrom
copilot/convert-to-wpf-using-net8

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 7, 2026

Converts the .NET Framework 4.8 console app to a WPF .NET 8 GUI application.

Project

  • UpdateService.csproj → SDK-style, net8.0-windows, UseWPF + UseWindowsForms
  • App.configappsettings.json (read via built-in System.Text.Json, no extra packages)

UI (MainWindow)

  • Destination path field + folder browser dialog
  • Install mode dropdown: Complete / Install / UnInstall
  • Execute button (disabled during run) + Clear log button
  • Log pane with [HH:mm:ss] timestamps and auto-scroll

Logic (UpdateServiceLogic)

  • Extracted from static class into instantiable UpdateServiceLogic with Action<string> log callback
  • async/await + TaskCompletionSource replaces AutoResetEvent.WaitOne() — UI stays responsive
  • Fixed race condition: process.Exited now subscribed before process.Start()
  • OverWriteDestinationFile errors logged with context at the call site; re-throw removed to avoid duplicate log entries
  • Null-safe folder enumeration: .Where(n => n != null) instead of null-forgiving !

Copilot AI and others added 3 commits April 7, 2026 08:15
Agent-Logs-Url: https://github.com/gb63728f4/UpdateService/sessions/da12cb3f-d1b8-4d8f-a859-e3ae38388140

Co-authored-by: gb63728f4 <39524431+gb63728f4@users.noreply.github.com>
…ve duplicate logging

Agent-Logs-Url: https://github.com/gb63728f4/UpdateService/sessions/da12cb3f-d1b8-4d8f-a859-e3ae38388140

Co-authored-by: gb63728f4 <39524431+gb63728f4@users.noreply.github.com>
Agent-Logs-Url: https://github.com/gb63728f4/UpdateService/sessions/4f791e42-cd47-45a2-a194-a8adc54f6f90

Co-authored-by: gb63728f4 <39524431+gb63728f4@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates UpdateService from a .NET Framework 4.8 console application to a .NET 8 WPF desktop app, introducing a GUI front-end and refactoring the update/install logic to run asynchronously with UI-friendly logging.

Changes:

  • Converted the project to SDK-style net8.0-windows with WPF/WinForms enabled and switched configuration input to appsettings.json.
  • Added a WPF MainWindow UI (destination path selection, execute mode selection, execute/clear log, timestamped log output).
  • Refactored service update logic into an instance-based UpdateServiceLogic using async/await and process exit signaling via TaskCompletionSource.

Reviewed changes

Copilot reviewed 24 out of 39 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
UpdateService/UpdateService.csproj Migrates project to SDK-style .NET 8 Windows desktop configuration and copies appsettings.json to output.
UpdateService/UpdateService.cs Refactors update logic into UpdateServiceLogic, adds async process execution + logging callback.
UpdateService/obj/UpdateService.csproj.nuget.g.targets Generated NuGet restore artifact (build output).
UpdateService/obj/UpdateService.csproj.nuget.g.props Generated NuGet restore artifact (build output).
UpdateService/obj/UpdateService.csproj.nuget.dgspec.json Generated NuGet restore spec (build output).
UpdateService/obj/project.nuget.cache Generated NuGet cache file (build output).
UpdateService/obj/project.assets.json Generated NuGet assets file (build output).
UpdateService/obj/Debug/net8.0-windows/UpdateService.sourcelink.json Generated SourceLink metadata (build output).
UpdateService/obj/Debug/net8.0-windows/UpdateService.pdb Generated debug symbols (build output).
UpdateService/obj/Debug/net8.0-windows/UpdateService.GlobalUsings.g.cs Generated global usings (build output).
UpdateService/obj/Debug/net8.0-windows/UpdateService.genruntimeconfig.cache Generated runtimeconfig cache (build output).
UpdateService/obj/Debug/net8.0-windows/UpdateService.GeneratedMSBuildEditorConfig.editorconfig Generated MSBuild editorconfig (build output).
UpdateService/obj/Debug/net8.0-windows/UpdateService.g.resources Generated WPF resources (build output).
UpdateService/obj/Debug/net8.0-windows/UpdateService.dll Generated assembly (build output).
UpdateService/obj/Debug/net8.0-windows/UpdateService.csproj.FileListAbsolute.txt Generated file list (build output).
UpdateService/obj/Debug/net8.0-windows/UpdateService.csproj.CoreCompileInputs.cache Generated compile inputs cache (build output).
UpdateService/obj/Debug/net8.0-windows/UpdateService.assets.cache Generated assets cache (build output).
UpdateService/obj/Debug/net8.0-windows/UpdateService.AssemblyInfoInputs.cache Generated assembly info inputs cache (build output).
UpdateService/obj/Debug/net8.0-windows/UpdateService.AssemblyInfo.cs Generated assembly info (build output).
UpdateService/obj/Debug/net8.0-windows/UpdateService_MarkupCompile.cache Generated WPF markup compile cache (build output).
UpdateService/obj/Debug/net8.0-windows/refint/UpdateService.dll Generated reference assembly (build output).
UpdateService/obj/Debug/net8.0-windows/ref/UpdateService.dll Generated reference assembly (build output).
UpdateService/obj/Debug/net8.0-windows/MainWindow.g.cs Generated code-behind for XAML (build output).
UpdateService/obj/Debug/net8.0-windows/MainWindow.baml Compiled XAML BAML (build output).
UpdateService/obj/Debug/net8.0-windows/App.g.cs Generated WPF app entry code (build output).
UpdateService/obj/Debug/net8.0-windows/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs Generated framework attributes (build output).
UpdateService/MainWindow.xaml.cs Adds WPF UI behavior: load settings from JSON, folder browser, execute workflow, append log.
UpdateService/MainWindow.xaml Adds the WPF UI layout for settings, actions, and log display.
UpdateService/bin/Debug/net8.0-windows/UpdateService.runtimeconfig.json Generated runtime configuration (build output).
UpdateService/bin/Debug/net8.0-windows/UpdateService.pdb Generated debug symbols (build output).
UpdateService/bin/Debug/net8.0-windows/UpdateService.dll.config Generated config output (build output).
UpdateService/bin/Debug/net8.0-windows/UpdateService.dll Generated assembly (build output).
UpdateService/bin/Debug/net8.0-windows/UpdateService.deps.json Generated dependency manifest (build output).
UpdateService/bin/Debug/net8.0-windows/appsettings.json Copied appsettings.json output (build output).
UpdateService/appsettings.json Adds JSON configuration for destination path and execute mode.
UpdateService/App.xaml.cs Adds WPF App partial class.
UpdateService/App.xaml Adds WPF Application definition and startup URI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread UpdateService/UpdateService.cs
Comment thread UpdateService/UpdateService.cs
Comment thread UpdateService/UpdateService.cs
Comment thread UpdateService/MainWindow.xaml.cs
Comment thread UpdateService/obj/UpdateService.csproj.nuget.g.props
Comment thread UpdateService/UpdateService.csproj
@gb63728f4
Copy link
Copy Markdown
Owner

@copilot 幫我針對內容產生commit並且完成PR

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 7, 2026

@gb63728f4 I've opened a new pull request, #4, to work on those changes. Once the pull request is ready, I'll request review from you.

@gb63728f4 gb63728f4 marked this pull request as ready for review April 7, 2026 08:46
@gb63728f4 gb63728f4 merged commit 3819eb5 into main Apr 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants