From 6001954705413fbdb3f7b564423932748af1e89e Mon Sep 17 00:00:00 2001 From: Chris Kaczor Date: Fri, 27 Feb 2026 12:18:46 -0500 Subject: [PATCH] Modernize project --- .gitattributes | 63 ---- .github/workflows/main.yml | 36 ++ .gitignore | 317 ++++++++++++++--- .gitmodules | 3 - App.config | 67 ++-- App.xaml | 2 +- App.xaml.cs | 68 ++-- Common | 1 - Options/AboutOptionsPanel.xaml | 46 --- Options/AboutOptionsPanel.xaml.cs | 41 --- Options/GeneralOptionsPanel.xaml | 57 --- Options/GeneralOptionsPanel.xaml.cs | 52 --- ProcessCpuUsage.cs | 96 +++-- ProcessCpuUsageStatusWindow.csproj | 254 +++----------- ProcessCpuUsageStatusWindow.nuspec | 16 - ProcessCpuUsageStatusWindow.sln | 51 --- ProcessCpuUsageStatusWindow.sln.DotSettings | 4 + ProcessCpuUsageStatusWindow.slnx | 3 + ProcessCpuUsageWatcher.cs | 230 ++++++------ Program.cs | 27 ++ Properties/AssemblyInfo.cs | 21 -- Properties/Resources.Designer.cs | 250 ++++++++++--- Properties/Resources.resx | 135 ++++--- Properties/Settings.Designer.cs | 70 ++-- Properties/Settings.settings | 19 +- .../{ApplicationIcon.ico => Application.ico} | Bin SettingsWindow/AboutSettingsPanel.xaml | 21 ++ SettingsWindow/AboutSettingsPanel.xaml.cs | 12 + SettingsWindow/GeneralSettingsPanel.xaml | 50 +++ SettingsWindow/GeneralSettingsPanel.xaml.cs | 36 ++ SettingsWindow/UpdateSettingsPanel.xaml | 21 ++ SettingsWindow/UpdateSettingsPanel.xaml.cs | 38 ++ UpdateCheck.cs | 101 +++--- WindowSource.cs | 328 ++++++++++-------- appveyor.yml | 31 -- packages.config | 10 - 36 files changed, 1338 insertions(+), 1239 deletions(-) delete mode 100644 .gitattributes create mode 100644 .github/workflows/main.yml delete mode 100644 .gitmodules delete mode 160000 Common delete mode 100644 Options/AboutOptionsPanel.xaml delete mode 100644 Options/AboutOptionsPanel.xaml.cs delete mode 100644 Options/GeneralOptionsPanel.xaml delete mode 100644 Options/GeneralOptionsPanel.xaml.cs delete mode 100644 ProcessCpuUsageStatusWindow.nuspec delete mode 100644 ProcessCpuUsageStatusWindow.sln create mode 100644 ProcessCpuUsageStatusWindow.sln.DotSettings create mode 100644 ProcessCpuUsageStatusWindow.slnx create mode 100644 Program.cs delete mode 100644 Properties/AssemblyInfo.cs rename Resources/{ApplicationIcon.ico => Application.ico} (100%) create mode 100644 SettingsWindow/AboutSettingsPanel.xaml create mode 100644 SettingsWindow/AboutSettingsPanel.xaml.cs create mode 100644 SettingsWindow/GeneralSettingsPanel.xaml create mode 100644 SettingsWindow/GeneralSettingsPanel.xaml.cs create mode 100644 SettingsWindow/UpdateSettingsPanel.xaml create mode 100644 SettingsWindow/UpdateSettingsPanel.xaml.cs delete mode 100644 appveyor.yml delete mode 100644 packages.config diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1ff0c42..0000000 --- a/.gitattributes +++ /dev/null @@ -1,63 +0,0 @@ -############################################################################### -# Set default behavior to automatically normalize line endings. -############################################################################### -* text=auto - -############################################################################### -# Set default behavior for command prompt diff. -# -# This is need for earlier builds of msysgit that does not have it on by -# default for csharp files. -# Note: This is only used by command line -############################################################################### -#*.cs diff=csharp - -############################################################################### -# Set the merge driver for project and solution files -# -# Merging from the command prompt will add diff markers to the files if there -# are conflicts (Merging from VS is not affected by the settings below, in VS -# the diff markers are never inserted). Diff markers may cause the following -# file extensions to fail to load in VS. An alternative would be to treat -# these files as binary and thus will always conflict and require user -# intervention with every merge. To do so, just uncomment the entries below -############################################################################### -#*.sln merge=binary -#*.csproj merge=binary -#*.vbproj merge=binary -#*.vcxproj merge=binary -#*.vcproj merge=binary -#*.dbproj merge=binary -#*.fsproj merge=binary -#*.lsproj merge=binary -#*.wixproj merge=binary -#*.modelproj merge=binary -#*.sqlproj merge=binary -#*.wwaproj merge=binary - -############################################################################### -# behavior for image files -# -# image files are treated as binary by default. -############################################################################### -#*.jpg binary -#*.png binary -#*.gif binary - -############################################################################### -# diff behavior for common document formats -# -# Convert binary document formats to text before diffing them. This feature -# is only available from the command line. Turn it on by uncommenting the -# entries below. -############################################################################### -#*.doc diff=astextplain -#*.DOC diff=astextplain -#*.docx diff=astextplain -#*.DOCX diff=astextplain -#*.dot diff=astextplain -#*.DOT diff=astextplain -#*.pdf diff=astextplain -#*.PDF diff=astextplain -#*.rtf diff=astextplain -#*.RTF diff=astextplain diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..c61e162 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,36 @@ +name: Deploy to GitHub Releases + +on: + push: + branches: + - main + + workflow_dispatch: + +jobs: + deploy-to-github-releases: + runs-on: windows-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Get next version + uses: reecetech/version-increment@2024.4.3 + id: version + with: + scheme: calver + + - name: Install .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 10.0.x + + - name: Publish Application + run: dotnet publish ProcessCpuUsageStatusWindow.csproj -c Release -o publish + + - name: Create Velopack Release + run: | + dotnet tool install -g vpk + vpk download github --repoUrl https://github.com/ckaczor/ProcessCpuUsageStatusWindow + vpk pack -u ProcessCpuUsageStatusWindow -v ${{ steps.version.outputs.version }} -p publish --packTitle "ProcessCpuUsageStatusWindow Status Window" --shortcuts StartMenuRoot --framework net10.0-x64-desktop + vpk upload github --repoUrl https://github.com/ckaczor/ProcessCpuUsageStatusWindow --publish --releaseName "${{ steps.version.outputs.version }}" --tag v${{ steps.version.outputs.version }} --token ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 92f5650..8a30d25 100644 --- a/.gitignore +++ b/.gitignore @@ -1,34 +1,84 @@ ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore # User-specific files +*.rsuser *.suo *.user +*.userosscache *.sln.docstates -# Build results +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs +# Mono auto generated files +mono_crash.* + +# Build results [Dd]ebug/ +[Dd]ebugPublic/ [Rr]elease/ +[Rr]eleases/ x64/ -build/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ [Bb]in/ [Oo]bj/ +[Ll]og/ +[Ll]ogs/ -# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets -!packages/*/build/ +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ # MSTest test Results [Tt]est[Rr]esult*/ [Bb]uild[Ll]og.* +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio *_i.c *_p.c +*_h.h *.ilk *.meta *.obj +*.iobj *.pch *.pdb +*.ipdb *.pgc *.pgd *.rsp @@ -38,26 +88,41 @@ build/ *.tlh *.tmp *.tmp_proj +*_wpftmp.csproj *.log +*.tlog *.vspscc *.vssscc .builds *.pidb -*.log +*.svclog *.scc +# Chutzpah Test files +_Chutzpah* + # Visual C++ cache files ipch/ *.aps *.ncb +*.opendb *.opensdf *.sdf *.cachefile +*.VC.db +*.VC.VC.opendb # Visual Studio profiler *.psess *.vsp *.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ # Guidance Automation Toolkit *.gpState @@ -65,6 +130,7 @@ ipch/ # ReSharper is a .NET coding add-in _ReSharper*/ *.[Rr]e[Ss]harper +*.DotSettings.user # TeamCity is a build add-in _TeamCity* @@ -72,9 +138,30 @@ _TeamCity* # DotCover is a Code Coverage Tool *.dotCover +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + # NCrunch -*.ncrunch* +_NCrunch_* .*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ # Installshield output folder [Ee]xpress/ @@ -93,67 +180,219 @@ DocProject/Help/html publish/ # Publish Web Output -*.Publish.xml +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj -# NuGet Packages Directory -packages/ +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ -# Windows Azure Build Output -csx +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ *.build.csdef -# Windows Store app package directory +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ # Others -sql/ -*.Cache ClientBin/ -[Ss]tyle[Cc]op.* ~$* *~ *.dbmdl -*.[Pp]ublish.xml +*.dbproj.schemaview +*.jfm *.pfx *.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ # RIA/Silverlight projects Generated_Code/ -# Backup & report files from converting an old project file to a newer -# Visual Studio version. Backup files are not needed, because we have git ;-) +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) _UpgradeReport_Files/ Backup*/ UpgradeLog*.XML UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak # SQL Server files -App_Data/*.mdf -App_Data/*.ldf +*.mdf +*.ldf +*.ndf +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl -#LightSwitch generated files -GeneratedArtifacts/ -_Pvt_Extensions/ -ModelManifest.xml +# Microsoft Fakes +FakesAssemblies/ -# ========================= -# Windows detritus -# ========================= +# GhostDoc plugin setting file +*.GhostDoc.xml -# Windows image file caches -Thumbs.db -ehthumbs.db +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ -# Folder config file -Desktop.ini +# Visual Studio 6 build log +*.plg -# Recycle Bin used on file shares -$RECYCLE.BIN/ +# Visual Studio 6 workspace options file +*.opt -# Mac desktop service store files -.DS_Store +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw -.vs -*.nupkg -Releases/ \ No newline at end of file +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 4437b85..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "Common"] - path = Common - url = https://github.com/ckaczor/Common.git \ No newline at end of file diff --git a/App.config b/App.config index 174f2fe..2214773 100644 --- a/App.config +++ b/App.config @@ -1,37 +1,36 @@ - - + - - -
- - - - - - + + +
+ + + + + + - - 3 - - - 00:00:02 - - - - - - True - - - True - - - False - - - + + + + + True + + + True + + + [] + + + 3 + + + True + + + 00:00:02 + + + \ No newline at end of file diff --git a/App.xaml b/App.xaml index 360eed4..6211ea2 100644 --- a/App.xaml +++ b/App.xaml @@ -1,6 +1,6 @@  + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" ShutdownMode="OnLastWindowClose"> diff --git a/App.xaml.cs b/App.xaml.cs index a1253dc..c287d15 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -1,48 +1,38 @@ -using FloatingStatusWindowLibrary; -using ProcessCpuUsageStatusWindow.Properties; -using Squirrel; -using System; +using System; +using System.Collections.Generic; using System.Diagnostics; using System.Windows; +using ChrisKaczor.Wpf.Windows.FloatingStatusWindow; +using ProcessCpuUsageStatusWindow.Properties; -namespace ProcessCpuUsageStatusWindow +namespace ProcessCpuUsageStatusWindow; + +public partial class App { - public partial class App + private List _windowSourceList; + + protected override void OnStartup(StartupEventArgs e) { - private WindowSource _windowSource; + base.OnStartup(e); - public static string UpdateUrl = "https://github.com/ckaczor/ProcessCpuUsageStatusWindow"; - - [STAThread] - public static void Main(string[] args) + StartManager.ManageAutoStart = true; + StartManager.AutoStartEnabled = !Debugger.IsAttached && Settings.Default.AutoStart; + StartManager.AutoStartChanged += (value => { - SquirrelAwareApp.HandleEvents(onAppUpdate: version => Common.Settings.Extensions.RestoreSettings()); + Settings.Default.AutoStart = value; + Settings.Default.Save(); + }); - var application = new App(); - application.InitializeComponent(); - application.Run(); - } - - protected override void OnStartup(StartupEventArgs e) - { - base.OnStartup(e); - - StartManager.ManageAutoStart = true; - StartManager.AutoStartEnabled = !Debugger.IsAttached && Settings.Default.AutoStart; - StartManager.AutoStartChanged += value => - { - Settings.Default.AutoStart = value; - Settings.Default.Save(); - }; - - _windowSource = new WindowSource(); - } - - protected override void OnExit(ExitEventArgs e) - { - _windowSource.Dispose(); - - base.OnExit(e); - } + _windowSourceList = + [ + new WindowSource() + ]; } -} + + protected override void OnExit(ExitEventArgs e) + { + _windowSourceList.ForEach(ws => ws.Dispose()); + + base.OnExit(e); + } +} \ No newline at end of file diff --git a/Common b/Common deleted file mode 160000 index ecd3717..0000000 --- a/Common +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ecd3717eab737ede13023c7c81baa34488a05609 diff --git a/Options/AboutOptionsPanel.xaml b/Options/AboutOptionsPanel.xaml deleted file mode 100644 index 4789e7e..0000000 --- a/Options/AboutOptionsPanel.xaml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - -