mirror of
https://github.com/ckaczor/FloatingStatusWindow.git
synced 2026-03-11 03:51:38 -04:00
Add template project
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 17
|
# Visual Studio Version 18
|
||||||
VisualStudioVersion = 17.5.33530.505
|
VisualStudioVersion = 18.4.11519.219 insiders
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FloatingStatusWindow", "Library\FloatingStatusWindow.csproj", "{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FloatingStatusWindow", "Library\FloatingStatusWindow.csproj", "{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}"
|
||||||
EndProject
|
EndProject
|
||||||
@@ -13,6 +13,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution", "Solution", "{C4
|
|||||||
README.md = README.md
|
README.md = README.md
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Template", "Template\Template.csproj", "{1F53FF5D-F943-1098-0F7F-B890BC359E46}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -39,6 +41,18 @@ Global
|
|||||||
{0C541788-8FFD-47B6-8E6B-653A884CFA55}.Release|Any CPU.Build.0 = Release|Any CPU
|
{0C541788-8FFD-47B6-8E6B-653A884CFA55}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{0C541788-8FFD-47B6-8E6B-653A884CFA55}.Release|x64.ActiveCfg = Release|Any CPU
|
{0C541788-8FFD-47B6-8E6B-653A884CFA55}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
{0C541788-8FFD-47B6-8E6B-653A884CFA55}.Release|x86.ActiveCfg = Release|Any CPU
|
{0C541788-8FFD-47B6-8E6B-653A884CFA55}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{1F53FF5D-F943-1098-0F7F-B890BC359E46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{1F53FF5D-F943-1098-0F7F-B890BC359E46}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{1F53FF5D-F943-1098-0F7F-B890BC359E46}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{1F53FF5D-F943-1098-0F7F-B890BC359E46}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{1F53FF5D-F943-1098-0F7F-B890BC359E46}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{1F53FF5D-F943-1098-0F7F-B890BC359E46}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{1F53FF5D-F943-1098-0F7F-B890BC359E46}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{1F53FF5D-F943-1098-0F7F-B890BC359E46}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{1F53FF5D-F943-1098-0F7F-B890BC359E46}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{1F53FF5D-F943-1098-0F7F-B890BC359E46}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{1F53FF5D-F943-1098-0F7F-B890BC359E46}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{1F53FF5D-F943-1098-0F7F-B890BC359E46}.Release|x86.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
36
Template/.github/workflows/main.yml
vendored
Normal file
36
Template/.github/workflows/main.yml
vendored
Normal file
@@ -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 Template.csproj -c Release -o publish
|
||||||
|
|
||||||
|
- name: Create Velopack Release
|
||||||
|
run: |
|
||||||
|
dotnet tool install -g vpk
|
||||||
|
vpk download github --repoUrl https://github.com/user/Template
|
||||||
|
vpk pack -u Template -v ${{ steps.version.outputs.version }} -p publish --packTitle "Template Status Window" --shortcuts StartMenuRoot --framework net10.0-x64-desktop
|
||||||
|
vpk upload github --repoUrl https://github.com/user/Template --publish --releaseName "${{ steps.version.outputs.version }}" --tag v${{ steps.version.outputs.version }} --token ${{ secrets.GITHUB_TOKEN }}
|
||||||
398
Template/.gitignore
vendored
Normal file
398
Template/.gitignore
vendored
Normal file
@@ -0,0 +1,398 @@
|
|||||||
|
## 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
|
||||||
|
|
||||||
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
|
*.userprefs
|
||||||
|
|
||||||
|
# Mono auto generated files
|
||||||
|
mono_crash.*
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Dd]ebugPublic/
|
||||||
|
[Rr]elease/
|
||||||
|
[Rr]eleases/
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
[Ww][Ii][Nn]32/
|
||||||
|
[Aa][Rr][Mm]/
|
||||||
|
[Aa][Rr][Mm]64/
|
||||||
|
bld/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
[Ll]og/
|
||||||
|
[Ll]ogs/
|
||||||
|
|
||||||
|
# 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
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*_wpftmp.csproj
|
||||||
|
*.log
|
||||||
|
*.tlog
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
*.pidb
|
||||||
|
*.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
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
*.DotSettings.user
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_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_*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
nCrunchTemp_*
|
||||||
|
|
||||||
|
# MightyMoose
|
||||||
|
*.mm.*
|
||||||
|
AutoTest.Net/
|
||||||
|
|
||||||
|
# Web workbench (sass)
|
||||||
|
.sass-cache/
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress/
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish/
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.[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
|
||||||
|
|
||||||
|
# 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/
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# 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
|
||||||
|
ClientBin/
|
||||||
|
~$*
|
||||||
|
*~
|
||||||
|
*.dbmdl
|
||||||
|
*.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 ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
UpgradeLog*.htm
|
||||||
|
ServiceFabricBackup/
|
||||||
|
*.rptproj.bak
|
||||||
|
|
||||||
|
# SQL Server files
|
||||||
|
*.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
|
||||||
|
|
||||||
|
# Microsoft Fakes
|
||||||
|
FakesAssemblies/
|
||||||
|
|
||||||
|
# GhostDoc plugin setting file
|
||||||
|
*.GhostDoc.xml
|
||||||
|
|
||||||
|
# Node.js Tools for Visual Studio
|
||||||
|
.ntvs_analysis.dat
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Visual Studio 6 build log
|
||||||
|
*.plg
|
||||||
|
|
||||||
|
# Visual Studio 6 workspace options file
|
||||||
|
*.opt
|
||||||
|
|
||||||
|
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||||
|
*.vbw
|
||||||
|
|
||||||
|
# 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
|
||||||
27
Template/App.config
Normal file
27
Template/App.config
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<configuration>
|
||||||
|
<configSections>
|
||||||
|
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||||
|
<section name="Template.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
|
</sectionGroup>
|
||||||
|
</configSections>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||||
|
</startup>
|
||||||
|
<userSettings>
|
||||||
|
<Template.Properties.Settings>
|
||||||
|
<setting name="WindowSettings" serializeAs="String">
|
||||||
|
<value />
|
||||||
|
</setting>
|
||||||
|
<setting name="AutoStart" serializeAs="String">
|
||||||
|
<value>True</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="CheckVersionAtStartup" serializeAs="String">
|
||||||
|
<value>True</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="Items" serializeAs="String">
|
||||||
|
<value>[]</value>
|
||||||
|
</setting>
|
||||||
|
</Template.Properties.Settings>
|
||||||
|
</userSettings>
|
||||||
|
</configuration>
|
||||||
7
Template/App.xaml
Normal file
7
Template/App.xaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<Application x:Class="Template.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" ShutdownMode="OnLastWindowClose">
|
||||||
|
<Application.Resources>
|
||||||
|
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
||||||
38
Template/App.xaml.cs
Normal file
38
Template/App.xaml.cs
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Windows;
|
||||||
|
using ChrisKaczor.Wpf.Windows.FloatingStatusWindow;
|
||||||
|
using Template.Properties;
|
||||||
|
|
||||||
|
namespace Template;
|
||||||
|
|
||||||
|
public partial class App
|
||||||
|
{
|
||||||
|
private List<IDisposable> _windowSourceList;
|
||||||
|
|
||||||
|
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();
|
||||||
|
});
|
||||||
|
|
||||||
|
_windowSourceList =
|
||||||
|
[
|
||||||
|
new WindowSource()
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnExit(ExitEventArgs e)
|
||||||
|
{
|
||||||
|
_windowSourceList.ForEach(ws => ws.Dispose());
|
||||||
|
|
||||||
|
base.OnExit(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
21
Template/Data.cs
Normal file
21
Template/Data.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Text.Json;
|
||||||
|
using Template.Properties;
|
||||||
|
|
||||||
|
namespace Template;
|
||||||
|
|
||||||
|
internal static class Data
|
||||||
|
{
|
||||||
|
internal static ObservableCollection<ItemEntry> ItemEntries { get; private set; }
|
||||||
|
|
||||||
|
internal static void Load()
|
||||||
|
{
|
||||||
|
ItemEntries = JsonSerializer.Deserialize<ObservableCollection<ItemEntry>>(Settings.Default.Items);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void Save()
|
||||||
|
{
|
||||||
|
Settings.Default.Items = JsonSerializer.Serialize(ItemEntries);
|
||||||
|
Settings.Default.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
42
Template/DataErrorDictionary.cs
Normal file
42
Template/DataErrorDictionary.cs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace Template;
|
||||||
|
|
||||||
|
internal class DataErrorDictionary : Dictionary<string, List<string>>
|
||||||
|
{
|
||||||
|
public event EventHandler<DataErrorsChangedEventArgs> ErrorsChanged;
|
||||||
|
|
||||||
|
private void OnErrorsChanged(string propertyName)
|
||||||
|
{
|
||||||
|
ErrorsChanged?.Invoke(this, new DataErrorsChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable GetErrors(string propertyName)
|
||||||
|
{
|
||||||
|
return TryGetValue(propertyName, out var value) ? value : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddError(string propertyName, string error)
|
||||||
|
{
|
||||||
|
if (!ContainsKey(propertyName))
|
||||||
|
this[propertyName] = [];
|
||||||
|
|
||||||
|
if (this[propertyName].Contains(error))
|
||||||
|
return;
|
||||||
|
|
||||||
|
this[propertyName].Add(error);
|
||||||
|
OnErrorsChanged(propertyName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ClearErrors(string propertyName)
|
||||||
|
{
|
||||||
|
if (!ContainsKey(propertyName))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Remove(propertyName);
|
||||||
|
OnErrorsChanged(propertyName);
|
||||||
|
}
|
||||||
|
}
|
||||||
58
Template/ItemEntry.cs
Normal file
58
Template/ItemEntry.cs
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace Template;
|
||||||
|
|
||||||
|
public class ItemEntry : INotifyDataErrorInfo
|
||||||
|
{
|
||||||
|
private readonly DataErrorDictionary _dataErrorDictionary;
|
||||||
|
|
||||||
|
public ItemEntry()
|
||||||
|
{
|
||||||
|
_dataErrorDictionary = new DataErrorDictionary();
|
||||||
|
_dataErrorDictionary.ErrorsChanged += DataErrorDictionaryErrorsChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (!ValidateName(value))
|
||||||
|
return;
|
||||||
|
|
||||||
|
field = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public bool HasErrors => _dataErrorDictionary.Any();
|
||||||
|
|
||||||
|
|
||||||
|
public IEnumerable GetErrors(string propertyName)
|
||||||
|
{
|
||||||
|
return _dataErrorDictionary.GetErrors(propertyName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public event EventHandler<DataErrorsChangedEventArgs> ErrorsChanged;
|
||||||
|
|
||||||
|
private void DataErrorDictionaryErrorsChanged(object sender, DataErrorsChangedEventArgs e)
|
||||||
|
{
|
||||||
|
ErrorsChanged?.Invoke(this, new DataErrorsChangedEventArgs(e.PropertyName));
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ValidateName(string newValue)
|
||||||
|
{
|
||||||
|
_dataErrorDictionary.ClearErrors(nameof(Name));
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(newValue))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
_dataErrorDictionary.AddError(nameof(Name), "Name cannot be empty");
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
27
Template/Program.cs
Normal file
27
Template/Program.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Serilog;
|
||||||
|
using Velopack;
|
||||||
|
|
||||||
|
namespace Template;
|
||||||
|
|
||||||
|
internal class Program
|
||||||
|
{
|
||||||
|
[STAThread]
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Log.Logger = new LoggerConfiguration().WriteTo.File("log.txt").CreateLogger();
|
||||||
|
|
||||||
|
Log.Logger.Information("Start");
|
||||||
|
|
||||||
|
var loggerFactory = new LoggerFactory().AddSerilog(Log.Logger);
|
||||||
|
|
||||||
|
VelopackApp.Build().Run(loggerFactory.CreateLogger("Install"));
|
||||||
|
|
||||||
|
var app = new App();
|
||||||
|
app.InitializeComponent();
|
||||||
|
app.Run();
|
||||||
|
|
||||||
|
Log.Logger.Information("End");
|
||||||
|
}
|
||||||
|
}
|
||||||
374
Template/Properties/Resources.Designer.cs
generated
Normal file
374
Template/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,374 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace Template.Properties {
|
||||||
|
using System;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||||
|
/// </summary>
|
||||||
|
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||||
|
// class via a tool like ResGen or Visual Studio.
|
||||||
|
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||||
|
// with the /str option, or rebuild your VS project.
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
public class Resources {
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal Resources() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the cached ResourceManager instance used by this class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
public static global::System.Resources.ResourceManager ResourceManager {
|
||||||
|
get {
|
||||||
|
if (object.ReferenceEquals(resourceMan, null)) {
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Template.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Overrides the current thread's CurrentUICulture property for all
|
||||||
|
/// resource lookups using this strongly typed resource class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
public static global::System.Globalization.CultureInfo Culture {
|
||||||
|
get {
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Add.
|
||||||
|
/// </summary>
|
||||||
|
public static string AddItemLink {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("AddItemLink", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Add Item.
|
||||||
|
/// </summary>
|
||||||
|
public static string AddItemToolTip {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("AddItemToolTip", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||||
|
/// </summary>
|
||||||
|
public static System.Drawing.Icon ApplicationIcon {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("ApplicationIcon", resourceCulture);
|
||||||
|
return ((System.Drawing.Icon)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Template Status Window.
|
||||||
|
/// </summary>
|
||||||
|
public static string ApplicationName {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ApplicationName", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Cancel.
|
||||||
|
/// </summary>
|
||||||
|
public static string CancelButton {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("CancelButton", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Checking for update....
|
||||||
|
/// </summary>
|
||||||
|
public static string CheckingForUpdate {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("CheckingForUpdate", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to _Check for Update.
|
||||||
|
/// </summary>
|
||||||
|
public static string CheckUpdate {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("CheckUpdate", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Check _Now.
|
||||||
|
/// </summary>
|
||||||
|
public static string checkVersionNowButton {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("checkVersionNowButton", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to _Check for a new version on startup.
|
||||||
|
/// </summary>
|
||||||
|
public static string checkVersionOnStartupCheckBox {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("checkVersionOnStartupCheckBox", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Close.
|
||||||
|
/// </summary>
|
||||||
|
public static string CloseButtonText {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("CloseButtonText", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Are you sure you want to delete the selected items?.
|
||||||
|
/// </summary>
|
||||||
|
public static string ConfirmDeleteItemss {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ConfirmDeleteItemss", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Confirm Delete.
|
||||||
|
/// </summary>
|
||||||
|
public static string ConfirmDeleteTitle {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ConfirmDeleteTitle", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Delete.
|
||||||
|
/// </summary>
|
||||||
|
public static string DeleteItemLink {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("DeleteItemLink", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Delete Item.
|
||||||
|
/// </summary>
|
||||||
|
public static string DeleteItemToolTip {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("DeleteItemToolTip", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Downloading update....
|
||||||
|
/// </summary>
|
||||||
|
public static string DownloadingUpdate {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("DownloadingUpdate", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Edit.
|
||||||
|
/// </summary>
|
||||||
|
public static string EditItemLink {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("EditItemLink", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Edit Item.
|
||||||
|
/// </summary>
|
||||||
|
public static string EditItemToolTip {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("EditItemToolTip", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Installing update....
|
||||||
|
/// </summary>
|
||||||
|
public static string InstallingUpdate {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("InstallingUpdate", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Item.
|
||||||
|
/// </summary>
|
||||||
|
public static string ItemColumnHeader {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ItemColumnHeader", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Add Item.
|
||||||
|
/// </summary>
|
||||||
|
public static string ItemWindowAdd {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ItemWindowAdd", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Edit Item.
|
||||||
|
/// </summary>
|
||||||
|
public static string ItemWindowEdit {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ItemWindowEdit", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Loading....
|
||||||
|
/// </summary>
|
||||||
|
public static string Loading {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Loading", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Name.
|
||||||
|
/// </summary>
|
||||||
|
public static string NameColumnHeader {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("NameColumnHeader", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to OK.
|
||||||
|
/// </summary>
|
||||||
|
public static string OkayButton {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("OkayButton", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to About.
|
||||||
|
/// </summary>
|
||||||
|
public static string optionCategoryAbout {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("optionCategoryAbout", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to General.
|
||||||
|
/// </summary>
|
||||||
|
public static string optionCategoryGeneral {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("optionCategoryGeneral", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Items.
|
||||||
|
/// </summary>
|
||||||
|
public static string optionCategoryItems {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("optionCategoryItems", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Update.
|
||||||
|
/// </summary>
|
||||||
|
public static string optionCategoryUpdate {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("optionCategoryUpdate", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Settings.
|
||||||
|
/// </summary>
|
||||||
|
public static string SettingsTitle {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("SettingsTitle", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to _Start when Windows starts.
|
||||||
|
/// </summary>
|
||||||
|
public static string startWithWindowsCheckBox {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("startWithWindowsCheckBox", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to You are already running the most recent version.
|
||||||
|
///
|
||||||
|
///No updates are available at this time..
|
||||||
|
/// </summary>
|
||||||
|
public static string UpdateCheckCurrent {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("UpdateCheckCurrent", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Version {0} is now available.
|
||||||
|
///
|
||||||
|
///Would you like to download and install it now?.
|
||||||
|
/// </summary>
|
||||||
|
public static string UpdateCheckNewVersion {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("UpdateCheckNewVersion", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to {0} Update.
|
||||||
|
/// </summary>
|
||||||
|
public static string UpdateCheckTitle {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("UpdateCheckTitle", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Version {0}.
|
||||||
|
/// </summary>
|
||||||
|
public static string Version {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Version", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
227
Template/Properties/Resources.resx
Normal file
227
Template/Properties/Resources.resx
Normal file
@@ -0,0 +1,227 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="ApplicationIcon" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Application.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="ApplicationName" xml:space="preserve">
|
||||||
|
<value>Template Status Window</value>
|
||||||
|
</data>
|
||||||
|
<data name="optionCategoryAbout" xml:space="preserve">
|
||||||
|
<value>About</value>
|
||||||
|
</data>
|
||||||
|
<data name="CheckUpdate" xml:space="preserve">
|
||||||
|
<value>_Check for Update</value>
|
||||||
|
</data>
|
||||||
|
<data name="startWithWindowsCheckBox" xml:space="preserve">
|
||||||
|
<value>_Start when Windows starts</value>
|
||||||
|
</data>
|
||||||
|
<data name="optionCategoryGeneral" xml:space="preserve">
|
||||||
|
<value>General</value>
|
||||||
|
</data>
|
||||||
|
<data name="SettingsTitle" xml:space="preserve">
|
||||||
|
<value>Settings</value>
|
||||||
|
</data>
|
||||||
|
<data name="CloseButtonText" xml:space="preserve">
|
||||||
|
<value>Close</value>
|
||||||
|
</data>
|
||||||
|
<data name="Version" xml:space="preserve">
|
||||||
|
<value>Version {0}</value>
|
||||||
|
</data>
|
||||||
|
<data name="optionCategoryUpdate" xml:space="preserve">
|
||||||
|
<value>Update</value>
|
||||||
|
</data>
|
||||||
|
<data name="checkVersionOnStartupCheckBox" xml:space="preserve">
|
||||||
|
<value>_Check for a new version on startup</value>
|
||||||
|
</data>
|
||||||
|
<data name="checkVersionNowButton" xml:space="preserve">
|
||||||
|
<value>Check _Now</value>
|
||||||
|
</data>
|
||||||
|
<data name="UpdateCheckTitle" xml:space="preserve">
|
||||||
|
<value>{0} Update</value>
|
||||||
|
</data>
|
||||||
|
<data name="UpdateCheckCurrent" xml:space="preserve">
|
||||||
|
<value>You are already running the most recent version.
|
||||||
|
|
||||||
|
No updates are available at this time.</value>
|
||||||
|
</data>
|
||||||
|
<data name="UpdateCheckNewVersion" xml:space="preserve">
|
||||||
|
<value>Version {0} is now available.
|
||||||
|
|
||||||
|
Would you like to download and install it now?</value>
|
||||||
|
</data>
|
||||||
|
<data name="Loading" xml:space="preserve">
|
||||||
|
<value>Loading...</value>
|
||||||
|
</data>
|
||||||
|
<data name="CheckingForUpdate" xml:space="preserve">
|
||||||
|
<value>Checking for update...</value>
|
||||||
|
</data>
|
||||||
|
<data name="DownloadingUpdate" xml:space="preserve">
|
||||||
|
<value>Downloading update...</value>
|
||||||
|
</data>
|
||||||
|
<data name="InstallingUpdate" xml:space="preserve">
|
||||||
|
<value>Installing update...</value>
|
||||||
|
</data>
|
||||||
|
<data name="optionCategoryItems" xml:space="preserve">
|
||||||
|
<value>Items</value>
|
||||||
|
</data>
|
||||||
|
<data name="NameColumnHeader" xml:space="preserve">
|
||||||
|
<value>Name</value>
|
||||||
|
</data>
|
||||||
|
<data name="ItemColumnHeader" xml:space="preserve">
|
||||||
|
<value>Item</value>
|
||||||
|
</data>
|
||||||
|
<data name="AddItemLink" xml:space="preserve">
|
||||||
|
<value>Add</value>
|
||||||
|
</data>
|
||||||
|
<data name="EditItemLink" xml:space="preserve">
|
||||||
|
<value>Edit</value>
|
||||||
|
</data>
|
||||||
|
<data name="DeleteItemLink" xml:space="preserve">
|
||||||
|
<value>Delete</value>
|
||||||
|
</data>
|
||||||
|
<data name="AddItemToolTip" xml:space="preserve">
|
||||||
|
<value>Add Item</value>
|
||||||
|
</data>
|
||||||
|
<data name="EditItemToolTip" xml:space="preserve">
|
||||||
|
<value>Edit Item</value>
|
||||||
|
</data>
|
||||||
|
<data name="DeleteItemToolTip" xml:space="preserve">
|
||||||
|
<value>Delete Item</value>
|
||||||
|
</data>
|
||||||
|
<data name="ConfirmDeleteTitle" xml:space="preserve">
|
||||||
|
<value>Confirm Delete</value>
|
||||||
|
</data>
|
||||||
|
<data name="ConfirmDeleteItemss" xml:space="preserve">
|
||||||
|
<value>Are you sure you want to delete the selected items?</value>
|
||||||
|
</data>
|
||||||
|
<data name="ItemWindowAdd" xml:space="preserve">
|
||||||
|
<value>Add Item</value>
|
||||||
|
</data>
|
||||||
|
<data name="ItemWindowEdit" xml:space="preserve">
|
||||||
|
<value>Edit Item</value>
|
||||||
|
</data>
|
||||||
|
<data name="OkayButton" xml:space="preserve">
|
||||||
|
<value>OK</value>
|
||||||
|
</data>
|
||||||
|
<data name="CancelButton" xml:space="preserve">
|
||||||
|
<value>Cancel</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
||||||
74
Template/Properties/Settings.Designer.cs
generated
Normal file
74
Template/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace Template.Properties {
|
||||||
|
|
||||||
|
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "18.4.0.0")]
|
||||||
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
||||||
|
public static Settings Default {
|
||||||
|
get {
|
||||||
|
return defaultInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||||
|
public string WindowSettings {
|
||||||
|
get {
|
||||||
|
return ((string)(this["WindowSettings"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["WindowSettings"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||||
|
public bool AutoStart {
|
||||||
|
get {
|
||||||
|
return ((bool)(this["AutoStart"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["AutoStart"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||||
|
public bool CheckVersionAtStartup {
|
||||||
|
get {
|
||||||
|
return ((bool)(this["CheckVersionAtStartup"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["CheckVersionAtStartup"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("[]")]
|
||||||
|
public string Items {
|
||||||
|
get {
|
||||||
|
return ((string)(this["Items"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["Items"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
18
Template/Properties/Settings.settings
Normal file
18
Template/Properties/Settings.settings
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Template.Properties" GeneratedClassName="Settings">
|
||||||
|
<Profiles />
|
||||||
|
<Settings>
|
||||||
|
<Setting Name="WindowSettings" Type="System.String" Scope="User">
|
||||||
|
<Value Profile="(Default)" />
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="AutoStart" Type="System.Boolean" Scope="User">
|
||||||
|
<Value Profile="(Default)">True</Value>
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="CheckVersionAtStartup" Type="System.Boolean" Scope="User">
|
||||||
|
<Value Profile="(Default)">True</Value>
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="Items" Type="System.String" Scope="User">
|
||||||
|
<Value Profile="(Default)">[]</Value>
|
||||||
|
</Setting>
|
||||||
|
</Settings>
|
||||||
|
</SettingsFile>
|
||||||
1
Template/README.md
Normal file
1
Template/README.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# Template
|
||||||
BIN
Template/Resources/Application.ico
Normal file
BIN
Template/Resources/Application.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.9 KiB |
21
Template/SettingsWindow/AboutSettingsPanel.xaml
Normal file
21
Template/SettingsWindow/AboutSettingsPanel.xaml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<windows:CategoryPanelBase x:Class="Template.SettingsWindow.AboutSettingsPanel"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:properties="clr-namespace:Template.Properties"
|
||||||
|
xmlns:windows="clr-namespace:ChrisKaczor.Wpf.Windows;assembly=ChrisKaczor.Wpf.Windows.CategoryWindow"
|
||||||
|
xmlns:template="clr-namespace:Template"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="150"
|
||||||
|
d:DesignWidth="300">
|
||||||
|
<Grid>
|
||||||
|
<StackPanel windows:Spacing.Vertical="10">
|
||||||
|
<TextBlock Text="{x:Static properties:Resources.ApplicationName}"
|
||||||
|
FontWeight="Bold" />
|
||||||
|
<TextBlock Text="{Binding Source={x:Static template:UpdateCheck.LocalVersion}, StringFormat={x:Static properties:Resources.Version}}"
|
||||||
|
Name="VersionLabel" />
|
||||||
|
<TextBlock Text="User" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</windows:CategoryPanelBase>
|
||||||
12
Template/SettingsWindow/AboutSettingsPanel.xaml.cs
Normal file
12
Template/SettingsWindow/AboutSettingsPanel.xaml.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
namespace Template.SettingsWindow
|
||||||
|
{
|
||||||
|
public partial class AboutSettingsPanel
|
||||||
|
{
|
||||||
|
public AboutSettingsPanel()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string CategoryName => Properties.Resources.optionCategoryAbout;
|
||||||
|
}
|
||||||
|
}
|
||||||
16
Template/SettingsWindow/GeneralSettingsPanel.xaml
Normal file
16
Template/SettingsWindow/GeneralSettingsPanel.xaml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<windows:CategoryPanelBase x:Class="Template.SettingsWindow.GeneralSettingsPanel"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:properties="clr-namespace:Template.Properties"
|
||||||
|
xmlns:windows="clr-namespace:ChrisKaczor.Wpf.Windows;assembly=ChrisKaczor.Wpf.Windows.CategoryWindow"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="300"
|
||||||
|
d:DesignWidth="300">
|
||||||
|
<StackPanel windows:Spacing.Vertical="10">
|
||||||
|
<CheckBox Content="{x:Static properties:Resources.startWithWindowsCheckBox}"
|
||||||
|
IsChecked="{Binding Source={x:Static properties:Settings.Default}, Path=AutoStart}"
|
||||||
|
Click="OnSaveSettings" />
|
||||||
|
</StackPanel>
|
||||||
|
</windows:CategoryPanelBase>
|
||||||
36
Template/SettingsWindow/GeneralSettingsPanel.xaml.cs
Normal file
36
Template/SettingsWindow/GeneralSettingsPanel.xaml.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using System.Windows;
|
||||||
|
using ChrisKaczor.Wpf.Application;
|
||||||
|
using Template.Properties;
|
||||||
|
|
||||||
|
namespace Template.SettingsWindow;
|
||||||
|
|
||||||
|
public partial class GeneralSettingsPanel
|
||||||
|
{
|
||||||
|
public GeneralSettingsPanel()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string CategoryName => Properties.Resources.optionCategoryGeneral;
|
||||||
|
|
||||||
|
public override void LoadPanel(Window parentWindow)
|
||||||
|
{
|
||||||
|
base.LoadPanel(parentWindow);
|
||||||
|
|
||||||
|
MarkLoaded();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnSaveSettings(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
SaveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveSettings()
|
||||||
|
{
|
||||||
|
if (!HasLoaded) return;
|
||||||
|
|
||||||
|
Settings.Default.Save();
|
||||||
|
|
||||||
|
Application.Current.SetStartWithWindows(Settings.Default.AutoStart);
|
||||||
|
}
|
||||||
|
}
|
||||||
78
Template/SettingsWindow/ItemWindow.xaml
Normal file
78
Template/SettingsWindow/ItemWindow.xaml
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
<Window x:Class="Template.SettingsWindow.ItemWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:properties="clr-namespace:Template.Properties"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
d:DataContext="{d:DesignInstance Type=template:ItemEntry}"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
|
||||||
|
xmlns:windows="clr-namespace:ChrisKaczor.Wpf.Windows;assembly=ChrisKaczor.Wpf.Windows.CategoryWindow"
|
||||||
|
xmlns:system="clr-namespace:System;assembly=System.Runtime"
|
||||||
|
xmlns:template="clr-namespace:Template"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="ItemWindow"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
SizeToContent="Height"
|
||||||
|
Width="450"
|
||||||
|
WindowStartupLocation="CenterOwner"
|
||||||
|
Icon="/Template;component/Resources/Application.ico"
|
||||||
|
FocusManager.FocusedElement="{Binding ElementName=NameTextBox}">
|
||||||
|
<Window.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.FlatButton.xaml" />
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/light.cobalt.xaml" />
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</Window.Resources>
|
||||||
|
<Grid Margin="6">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel Margin="0,4"
|
||||||
|
windows:Spacing.Vertical="8">
|
||||||
|
<TextBox Name="NameTextBox"
|
||||||
|
mah:TextBoxHelper.UseFloatingWatermark="True"
|
||||||
|
mah:TextBoxHelper.Watermark="{x:Static properties:Resources.NameColumnHeader}"
|
||||||
|
mah:TextBoxHelper.SelectAllOnFocus="True"
|
||||||
|
Text="{Binding Path=Name, UpdateSourceTrigger=Explicit, ValidatesOnExceptions=True}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Column="0"
|
||||||
|
Grid.Row="1"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
Margin="0,5,0,0"
|
||||||
|
HorizontalAlignment="Right">
|
||||||
|
<Button Content="{x:Static properties:Resources.OkayButton}"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
|
Width="75"
|
||||||
|
Margin="0,0,5,0"
|
||||||
|
IsDefault="True"
|
||||||
|
Click="HandleOkayButtonClick">
|
||||||
|
<Button.Style>
|
||||||
|
<Style TargetType="Button"
|
||||||
|
BasedOn="{StaticResource {x:Type Button}}">
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding Text.Length, ElementName=NameTextBox}"
|
||||||
|
Value="0">
|
||||||
|
<Setter Property="IsEnabled"
|
||||||
|
Value="False" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Button.Style>
|
||||||
|
</Button>
|
||||||
|
<Button Content="{x:Static properties:Resources.CancelButton}"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
|
Width="75"
|
||||||
|
IsCancel="True" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
41
Template/SettingsWindow/ItemWindow.xaml.cs
Normal file
41
Template/SettingsWindow/ItemWindow.xaml.cs
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
using ChrisKaczor.Wpf.Validation;
|
||||||
|
|
||||||
|
namespace Template.SettingsWindow;
|
||||||
|
|
||||||
|
public partial class ItemWindow
|
||||||
|
{
|
||||||
|
public ItemWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool? Display(ItemEntry itemEntry, Window owner)
|
||||||
|
{
|
||||||
|
DataContext = itemEntry;
|
||||||
|
|
||||||
|
Title = string.IsNullOrWhiteSpace(itemEntry.Name) ? Properties.Resources.ItemWindowAdd : Properties.Resources.ItemWindowEdit;
|
||||||
|
|
||||||
|
Owner = owner;
|
||||||
|
|
||||||
|
return ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleOkayButtonClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (!this.IsValid())
|
||||||
|
return;
|
||||||
|
|
||||||
|
var item = (ItemEntry)DataContext;
|
||||||
|
|
||||||
|
if (!Data.ItemEntries.Contains(item))
|
||||||
|
Data.ItemEntries.Add(item);
|
||||||
|
|
||||||
|
Data.Save();
|
||||||
|
|
||||||
|
DialogResult = true;
|
||||||
|
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
90
Template/SettingsWindow/ItemsSettingsPanel.xaml
Normal file
90
Template/SettingsWindow/ItemsSettingsPanel.xaml
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
<windows:CategoryPanelBase x:Class="Template.SettingsWindow.ItemsSettingsPanel"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:properties="clr-namespace:Template.Properties"
|
||||||
|
xmlns:windows="clr-namespace:ChrisKaczor.Wpf.Windows;assembly=ChrisKaczor.Wpf.Windows.CategoryWindow"
|
||||||
|
xmlns:controls="clr-namespace:ChrisKaczor.Wpf.Controls;assembly=ChrisKaczor.Wpf.Controls.Link"
|
||||||
|
xmlns:dd="urn:gong-wpf-dragdrop"
|
||||||
|
xmlns:template="clr-namespace:Template"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="150"
|
||||||
|
d:DesignWidth="300">
|
||||||
|
<windows:CategoryPanelBase.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.FlatButton.xaml" />
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/light.cobalt.xaml" />
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</windows:CategoryPanelBase.Resources>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<DataGrid Name="ItemDataGrid"
|
||||||
|
SelectionMode="Extended"
|
||||||
|
Grid.Column="0"
|
||||||
|
Grid.Row="0"
|
||||||
|
AutoGenerateColumns="False"
|
||||||
|
GridLinesVisibility="None"
|
||||||
|
CanUserResizeRows="False"
|
||||||
|
IsReadOnly="True"
|
||||||
|
CanUserSortColumns="False"
|
||||||
|
SelectionUnit="FullRow"
|
||||||
|
HeadersVisibility="Column"
|
||||||
|
BorderThickness="1,1,1,1"
|
||||||
|
BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}"
|
||||||
|
Background="{x:Null}"
|
||||||
|
SelectionChanged="HandleItemDataGridSelectionChanged"
|
||||||
|
d:DataContext="{d:DesignInstance template:ItemEntry }"
|
||||||
|
dd:DragDrop.IsDragSource="True"
|
||||||
|
dd:DragDrop.IsDropTarget="True">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn Binding="{Binding Path=Name}"
|
||||||
|
Header="{x:Static properties:Resources.NameColumnHeader}"
|
||||||
|
Width="*" />
|
||||||
|
</DataGrid.Columns>
|
||||||
|
<DataGrid.RowStyle>
|
||||||
|
<Style TargetType="DataGridRow"
|
||||||
|
BasedOn="{StaticResource MahApps.Styles.DataGridRow}">
|
||||||
|
<EventSetter Event="MouseDoubleClick"
|
||||||
|
Handler="HandleItemDataGridRowMouseDoubleClick" />
|
||||||
|
</Style>
|
||||||
|
</DataGrid.RowStyle>
|
||||||
|
</DataGrid>
|
||||||
|
<Border Grid.Column="0"
|
||||||
|
Grid.Row="1"
|
||||||
|
BorderThickness="1,0,1,1"
|
||||||
|
BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}">
|
||||||
|
<StackPanel Orientation="Horizontal"
|
||||||
|
Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}">
|
||||||
|
<controls:Link Name="AddItemButton"
|
||||||
|
Margin="2"
|
||||||
|
Click="HandleAddItemButtonClick"
|
||||||
|
Text="{x:Static properties:Resources.AddItemLink}"
|
||||||
|
ToolTip="{x:Static properties:Resources.AddItemToolTip}">
|
||||||
|
</controls:Link>
|
||||||
|
<controls:Link Name="EditItemButton"
|
||||||
|
Margin="2"
|
||||||
|
Click="HandleEditItemButtonClick"
|
||||||
|
Text="{x:Static properties:Resources.EditItemLink}"
|
||||||
|
ToolTip="{x:Static properties:Resources.EditItemToolTip}">
|
||||||
|
</controls:Link>
|
||||||
|
<controls:Link Name="DeleteItemButton"
|
||||||
|
Margin="2"
|
||||||
|
Click="HandleDeleteItemButtonClick"
|
||||||
|
Text="{x:Static properties:Resources.DeleteItemLink}"
|
||||||
|
ToolTip="{x:Static properties:Resources.DeleteItemToolTip}">
|
||||||
|
</controls:Link>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</windows:CategoryPanelBase>
|
||||||
112
Template/SettingsWindow/ItemsSettingsPanel.xaml.cs
Normal file
112
Template/SettingsWindow/ItemsSettingsPanel.xaml.cs
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace Template.SettingsWindow;
|
||||||
|
|
||||||
|
public partial class ItemsSettingsPanel
|
||||||
|
{
|
||||||
|
private CollectionViewSource _collectionViewSource;
|
||||||
|
|
||||||
|
public ItemsSettingsPanel()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string CategoryName => Properties.Resources.optionCategoryItems;
|
||||||
|
|
||||||
|
public override void LoadPanel(Window parentWindow)
|
||||||
|
{
|
||||||
|
base.LoadPanel(parentWindow);
|
||||||
|
|
||||||
|
if (_collectionViewSource == null)
|
||||||
|
{
|
||||||
|
_collectionViewSource = new CollectionViewSource { Source = Data.ItemEntries };
|
||||||
|
|
||||||
|
ItemDataGrid.ItemsSource = _collectionViewSource.View;
|
||||||
|
}
|
||||||
|
|
||||||
|
_collectionViewSource.View.Refresh();
|
||||||
|
|
||||||
|
if (ItemDataGrid.Items.Count > 0)
|
||||||
|
ItemDataGrid.SelectedIndex = 0;
|
||||||
|
|
||||||
|
SetItemButtonStates();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleItemDataGridSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
SetItemButtonStates();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetItemButtonStates()
|
||||||
|
{
|
||||||
|
AddItemButton.IsEnabled = true;
|
||||||
|
EditItemButton.IsEnabled = ItemDataGrid.SelectedItems.Count == 1;
|
||||||
|
DeleteItemButton.IsEnabled = ItemDataGrid.SelectedItems.Count > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleAddItemButtonClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
AddItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleEditItemButtonClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
EditSelectedItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleDeleteItemButtonClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
DeleteSelectedItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleItemDataGridRowMouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
EditSelectedItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddItem()
|
||||||
|
{
|
||||||
|
var itemEntry = new ItemEntry { };
|
||||||
|
|
||||||
|
var itemWindow = new ItemWindow();
|
||||||
|
|
||||||
|
var result = itemWindow.Display(itemEntry, Window.GetWindow(this));
|
||||||
|
|
||||||
|
if (!result.HasValue || !result.Value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ItemDataGrid.SelectedItem = itemEntry;
|
||||||
|
|
||||||
|
SetItemButtonStates();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EditSelectedItem()
|
||||||
|
{
|
||||||
|
if (ItemDataGrid.SelectedItem == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var itemEntry = (ItemEntry)ItemDataGrid.SelectedItem;
|
||||||
|
|
||||||
|
var itemWindow = new ItemWindow();
|
||||||
|
|
||||||
|
itemWindow.Display(itemEntry, Window.GetWindow(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DeleteSelectedItems()
|
||||||
|
{
|
||||||
|
if (MessageBox.Show(ParentWindow!, Properties.Resources.ConfirmDeleteItemss, Properties.Resources.ConfirmDeleteTitle, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.No)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var selectedItems = new ItemEntry[ItemDataGrid.SelectedItems.Count];
|
||||||
|
|
||||||
|
ItemDataGrid.SelectedItems.CopyTo(selectedItems, 0);
|
||||||
|
|
||||||
|
foreach (var itemEntry in selectedItems)
|
||||||
|
Data.ItemEntries.Remove(itemEntry);
|
||||||
|
|
||||||
|
SetItemButtonStates();
|
||||||
|
}
|
||||||
|
}
|
||||||
22
Template/SettingsWindow/UpdateSettingsPanel.xaml
Normal file
22
Template/SettingsWindow/UpdateSettingsPanel.xaml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<windows:CategoryPanelBase x:Class="Template.SettingsWindow.UpdateSettingsPanel"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:properties="clr-namespace:Template.Properties"
|
||||||
|
xmlns:windows="clr-namespace:ChrisKaczor.Wpf.Windows;assembly=ChrisKaczor.Wpf.Windows.CategoryWindow"
|
||||||
|
xmlns:template="clr-namespace:Template"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="150"
|
||||||
|
d:DesignWidth="250">
|
||||||
|
<StackPanel windows:Spacing.Vertical="10">
|
||||||
|
<CheckBox Content="{x:Static properties:Resources.checkVersionOnStartupCheckBox}"
|
||||||
|
Name="CheckVersionOnStartupCheckBox"
|
||||||
|
IsChecked="{Binding Source={x:Static properties:Settings.Default}, Path=CheckVersionAtStartup}"
|
||||||
|
Click="OnSaveSettings" />
|
||||||
|
<Button Content="{x:Static properties:Resources.checkVersionNowButton}"
|
||||||
|
IsEnabled="{Binding Source={x:Static template:UpdateCheck.IsInstalled}}"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Click="HandleCheckVersionNowButtonClick" />
|
||||||
|
</StackPanel>
|
||||||
|
</windows:CategoryPanelBase>
|
||||||
38
Template/SettingsWindow/UpdateSettingsPanel.xaml.cs
Normal file
38
Template/SettingsWindow/UpdateSettingsPanel.xaml.cs
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using Template.Properties;
|
||||||
|
|
||||||
|
namespace Template.SettingsWindow;
|
||||||
|
|
||||||
|
public partial class UpdateSettingsPanel
|
||||||
|
{
|
||||||
|
public UpdateSettingsPanel()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string CategoryName => Properties.Resources.optionCategoryUpdate;
|
||||||
|
|
||||||
|
private async void HandleCheckVersionNowButtonClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var cursor = Cursor;
|
||||||
|
|
||||||
|
Cursor = Cursors.Wait;
|
||||||
|
|
||||||
|
await UpdateCheck.DisplayUpdateInformation(true);
|
||||||
|
|
||||||
|
Cursor = cursor;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnSaveSettings(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
SaveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveSettings()
|
||||||
|
{
|
||||||
|
if (!HasLoaded) return;
|
||||||
|
|
||||||
|
Settings.Default.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
57
Template/Template.csproj
Normal file
57
Template/Template.csproj
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net10.0-windows7.0</TargetFramework>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<UseWPF>true</UseWPF>
|
||||||
|
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
|
||||||
|
<StartupObject>Template.Program</StartupObject>
|
||||||
|
<ApplicationIcon>Resources\Application.ico</ApplicationIcon>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<AppDesigner Include="Properties\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="Resources\Application.ico" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="ChrisKaczor.Wpf.Application.StartWithWindows" Version="1.0.5" />
|
||||||
|
<PackageReference Include="ChrisKaczor.Wpf.Controls.Link" Version="1.0.4" />
|
||||||
|
<PackageReference Include="ChrisKaczor.Wpf.Validation" Version="1.0.4" />
|
||||||
|
<PackageReference Include="ChrisKaczor.Wpf.Windows.CategoryWindow" Version="1.0.2" />
|
||||||
|
<PackageReference Include="ChrisKaczor.Wpf.Windows.FloatingStatusWindow" Version="2.0.0.8" />
|
||||||
|
<PackageReference Include="gong-wpf-dragdrop" Version="3.2.1" />
|
||||||
|
<PackageReference Include="Serilog" Version="4.0.2" />
|
||||||
|
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||||
|
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
|
||||||
|
<PackageReference Include="Velopack" Version="0.0.626" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Update="Properties\Resources.Designer.cs">
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="Properties\Settings.Designer.cs">
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="Properties\Settings.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include=".github\workflows\main.yml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Update="Properties\Resources.resx">
|
||||||
|
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
50
Template/UpdateCheck.cs
Normal file
50
Template/UpdateCheck.cs
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using NuGet.Versioning;
|
||||||
|
using Serilog;
|
||||||
|
using Velopack;
|
||||||
|
using Velopack.Sources;
|
||||||
|
|
||||||
|
namespace Template;
|
||||||
|
|
||||||
|
internal static class UpdateCheck
|
||||||
|
{
|
||||||
|
private static UpdateManager _updateManager;
|
||||||
|
|
||||||
|
public static UpdateManager UpdateManager => _updateManager ??= new UpdateManager(new GithubSource("https://github.com/user/Template", null, false));
|
||||||
|
|
||||||
|
public static string LocalVersion => (UpdateManager.CurrentVersion ?? new SemanticVersion(0, 0, 0)).ToString();
|
||||||
|
|
||||||
|
public static bool IsInstalled => UpdateManager.IsInstalled;
|
||||||
|
|
||||||
|
public static async Task DisplayUpdateInformation(bool showIfCurrent)
|
||||||
|
{
|
||||||
|
var newVersion = IsInstalled ? await UpdateManager.CheckForUpdatesAsync() : null;
|
||||||
|
|
||||||
|
if (newVersion != null)
|
||||||
|
{
|
||||||
|
var updateCheckTitle = string.Format(Properties.Resources.UpdateCheckTitle, Properties.Resources.ApplicationName);
|
||||||
|
|
||||||
|
var updateCheckMessage = string.Format(Properties.Resources.UpdateCheckNewVersion, newVersion.TargetFullRelease.Version);
|
||||||
|
|
||||||
|
if (MessageBox.Show(updateCheckMessage, updateCheckTitle, MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Log.Logger.Information("Downloading update");
|
||||||
|
|
||||||
|
await UpdateManager.DownloadUpdatesAsync(newVersion);
|
||||||
|
|
||||||
|
Log.Logger.Information("Installing update");
|
||||||
|
|
||||||
|
UpdateManager.ApplyUpdatesAndRestart(newVersion);
|
||||||
|
}
|
||||||
|
else if (showIfCurrent)
|
||||||
|
{
|
||||||
|
var updateCheckTitle = string.Format(Properties.Resources.UpdateCheckTitle, Properties.Resources.ApplicationName);
|
||||||
|
|
||||||
|
var updateCheckMessage = string.Format(Properties.Resources.UpdateCheckCurrent, Properties.Resources.ApplicationName);
|
||||||
|
|
||||||
|
MessageBox.Show(updateCheckMessage, updateCheckTitle, MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
173
Template/WindowSource.cs
Normal file
173
Template/WindowSource.cs
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
using ChrisKaczor.Wpf.Windows;
|
||||||
|
using ChrisKaczor.Wpf.Windows.FloatingStatusWindow;
|
||||||
|
using Serilog;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Timers;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
using Template.Properties;
|
||||||
|
using Template.SettingsWindow;
|
||||||
|
|
||||||
|
namespace Template;
|
||||||
|
|
||||||
|
internal class WindowSource : IWindowSource, IDisposable
|
||||||
|
{
|
||||||
|
private readonly FloatingStatusWindow _floatingStatusWindow;
|
||||||
|
private readonly Timer _timer;
|
||||||
|
private readonly Dispatcher _dispatcher;
|
||||||
|
|
||||||
|
internal WindowSource()
|
||||||
|
{
|
||||||
|
_floatingStatusWindow = new FloatingStatusWindow(this);
|
||||||
|
_floatingStatusWindow.SetText(Resources.Loading);
|
||||||
|
|
||||||
|
_dispatcher = Dispatcher.CurrentDispatcher;
|
||||||
|
|
||||||
|
_timer = new Timer(1000);
|
||||||
|
|
||||||
|
Task.Factory.StartNew(UpdateApp).ContinueWith(task => Start(task.Result.Result));
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<bool> UpdateApp()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!UpdateCheck.IsInstalled)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!Settings.Default.CheckVersionAtStartup)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Log.Logger.Information("Checking for update");
|
||||||
|
|
||||||
|
await _dispatcher.InvokeAsync(() => _floatingStatusWindow.SetText(Resources.CheckingForUpdate));
|
||||||
|
|
||||||
|
var newVersion = await UpdateCheck.UpdateManager.CheckForUpdatesAsync();
|
||||||
|
|
||||||
|
if (newVersion == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Log.Logger.Information("Downloading update");
|
||||||
|
|
||||||
|
await _dispatcher.InvokeAsync(() => _floatingStatusWindow.SetText(Resources.DownloadingUpdate));
|
||||||
|
|
||||||
|
await UpdateCheck.UpdateManager.DownloadUpdatesAsync(newVersion);
|
||||||
|
|
||||||
|
Log.Logger.Information("Installing update");
|
||||||
|
|
||||||
|
await _dispatcher.InvokeAsync(() => _floatingStatusWindow.SetText(Resources.InstallingUpdate));
|
||||||
|
|
||||||
|
UpdateCheck.UpdateManager.ApplyUpdatesAndRestart(newVersion);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Log.Logger.Error(e, nameof(UpdateApp));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Start(bool hasUpdate)
|
||||||
|
{
|
||||||
|
Log.Logger.Information($"Start: hasUpdate={hasUpdate}");
|
||||||
|
|
||||||
|
if (hasUpdate)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Log.Logger.Information("Load");
|
||||||
|
|
||||||
|
Load();
|
||||||
|
|
||||||
|
Log.Logger.Information("Starting timer");
|
||||||
|
|
||||||
|
_timer.Elapsed += HandleTimerElapsed;
|
||||||
|
_timer.Enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Load()
|
||||||
|
{
|
||||||
|
Data.Load();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Save()
|
||||||
|
{
|
||||||
|
Data.Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleTimerElapsed(object sender, ElapsedEventArgs e)
|
||||||
|
{
|
||||||
|
var text = new StringBuilder();
|
||||||
|
|
||||||
|
if (Data.ItemEntries.Any())
|
||||||
|
{
|
||||||
|
foreach (var itemEntry in Data.ItemEntries)
|
||||||
|
{
|
||||||
|
if (text.Length > 0)
|
||||||
|
text.AppendLine();
|
||||||
|
|
||||||
|
text.Append($"{itemEntry.Name}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_dispatcher.Invoke(() => _floatingStatusWindow.SetText(text.ToString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
_timer.Enabled = false;
|
||||||
|
_timer.Dispose();
|
||||||
|
|
||||||
|
_floatingStatusWindow.Save();
|
||||||
|
_floatingStatusWindow.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Guid Id => Guid.Parse("29DF6CFD-6783-406F-AE12-4723EB7741EA");
|
||||||
|
|
||||||
|
public string Name => Resources.ApplicationName;
|
||||||
|
|
||||||
|
public System.Drawing.Icon Icon => Resources.ApplicationIcon;
|
||||||
|
|
||||||
|
public bool HasSettingsMenu => true;
|
||||||
|
|
||||||
|
public bool HasAboutMenu => false;
|
||||||
|
|
||||||
|
public void ShowAbout()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowSettings()
|
||||||
|
{
|
||||||
|
var categoryPanels = new List<CategoryPanelBase>
|
||||||
|
{
|
||||||
|
new GeneralSettingsPanel(),
|
||||||
|
new ItemsSettingsPanel(),
|
||||||
|
new UpdateSettingsPanel(),
|
||||||
|
new AboutSettingsPanel()
|
||||||
|
};
|
||||||
|
|
||||||
|
var settingsWindow = new CategoryWindow(categoryPanels, Resources.SettingsTitle, Resources.CloseButtonText);
|
||||||
|
|
||||||
|
settingsWindow.ShowDialog();
|
||||||
|
|
||||||
|
Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool HasRefreshMenu => false;
|
||||||
|
|
||||||
|
public void Refresh()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public string WindowSettings
|
||||||
|
{
|
||||||
|
get => Settings.Default.WindowSettings;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Settings.Default.WindowSettings = value;
|
||||||
|
Settings.Default.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user