Skip to content

Commit

Permalink
Update to .NET 9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-lerch committed Nov 16, 2024
1 parent 97c10f5 commit 5e7c86b
Show file tree
Hide file tree
Showing 12 changed files with 105 additions and 107 deletions.
30 changes: 5 additions & 25 deletions .github/workflows/dotnet-desktop.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# This workflow will build, test, sign and package a WPF or Windows Forms desktop application
# built on .NET Core.
# To learn how to migrate your existing application to .NET Core,
# refer to https://docs.microsoft.com/en-us/dotnet/desktop-wpf/migration/convert-project-from-net-framework
#
# To configure this workflow:
#
# 1. Configure environment variables
# GitHub sets default environment variables for every workflow run.
# Replace the variables relative to your project in the "env" section below.
#
# 2. Signing
# Generate a signing certificate in the Windows Application
# Packaging Project or add an existing signing certificate to the project.
Expand All @@ -31,10 +15,6 @@
#
# Finally, add the signing certificate password to the repo as a secret and name it "Pfx_Key".
# See "Build the Windows Application Packaging project" below to see how the secret is used.
#
# For more information on GitHub Actions, refer to https://github.com/features/actions
# For a complete CI/CD sample to get started with GitHub Action workflows for Desktop Applications,
# refer to https://github.com/microsoft/github-actions-for-desktop-apps

name: .NET Core Desktop

Expand All @@ -60,19 +40,19 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x

# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v1.1
uses: microsoft/setup-msbuild@v2

# Execute all unit tests in the solution
- name: Execute unit tests
Expand Down Expand Up @@ -110,7 +90,7 @@ jobs:
# Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact
- name: Upload build artifacts
if: matrix.configuration == 'Release' && startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: MSIX Package
path: ${{ env.Wap_Project_Directory }}\AppPackages
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Nullable>enable</Nullable>
<AvaloniaVersion>11.1.3</AvaloniaVersion>
<AvaloniaVersion>11.2.1</AvaloniaVersion>
</PropertyGroup>
</Project>
4 changes: 1 addition & 3 deletions src/Vocup.Desktop/Vocup.Desktop.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<!--If you are willing to use Windows/MacOS native APIs you will need to create 3 projects.
One for Windows with net7.0-windows TFM, one for MacOS with net7.0-macos and one with net7.0 TFM for Linux.-->
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Vocup.Packaging/Vocup.Packaging.wapproj
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@
</ItemGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
<ItemGroup>
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.2428" PrivateAssets="all" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" PrivateAssets="all" />
</ItemGroup>
</Project>
9 changes: 5 additions & 4 deletions src/Vocup.WinForms/Controls/ResponsiveButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@

namespace Vocup.Controls;

public class ResponsiveButton : Button
public partial class ResponsiveButton : Button
{
private Image? _baseImage;
private Size _imageSize = new Size(16, 16);
private SizeF scalingFactor = new SizeF(1F, 1F);
private Size _imageSize = new(16, 16);
private SizeF scalingFactor = new(1F, 1F);

[Localizable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public Image? BaseImage
{
get => _baseImage;
Expand Down Expand Up @@ -47,7 +48,7 @@ private void SetScaledImage()
{
Size newSize = _imageSize.Multiply(scalingFactor).Rectify().Round();
Image newImage = new Bitmap(newSize.Width, newSize.Height);
Image oldImage = Image;
Image? oldImage = Image;
using (Graphics g = Graphics.FromImage(newImage))
{
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
Expand Down
14 changes: 10 additions & 4 deletions src/Vocup.WinForms/Controls/StatisticsPanel.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms;
using System.ComponentModel;

namespace Vocup.Controls
{
Expand All @@ -17,6 +15,7 @@ public StatisticsPanel()
InitializeComponent();
}

[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public int Unpracticed
{
get => _unpracticed;
Expand All @@ -27,6 +26,8 @@ public int Unpracticed
RenewSum();
}
}

[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public int WronglyPracticed
{
get => _wronglyPracticed;
Expand All @@ -37,6 +38,8 @@ public int WronglyPracticed
RenewSum();
}
}

[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public int CorrectlyPracticed
{
get => _correctlyPracticed;
Expand All @@ -47,6 +50,8 @@ public int CorrectlyPracticed
RenewSum();
}
}

[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public int FullyPracticed
{
get => _fullyPracticed;
Expand All @@ -57,6 +62,7 @@ public int FullyPracticed
RenewSum();
}
}

public void Reset()
{
Unpracticed = 0;
Expand Down
84 changes: 42 additions & 42 deletions src/Vocup.WinForms/Forms/SpecialCharKeyboard.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Globalization;
using System.IO;
Expand Down Expand Up @@ -29,6 +30,7 @@ public SpecialCharKeyboard()
/// <summary>
/// Gets or sets whether the keyboard can be opened via its trigger.
/// </summary>
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool KeyboardEnabled
{
get => _keyboardEnabled;
Expand Down Expand Up @@ -75,61 +77,59 @@ private void RefreshTriggerAndVisibility()

private void Form_Load(object sender, EventArgs e)
{
DirectoryInfo dirInfo = new DirectoryInfo(Util.AppInfo.SpecialCharDirectory);
DirectoryInfo dirInfo = new(Util.AppInfo.SpecialCharDirectory);

if (dirInfo.Exists)
{
foreach (FileInfo info in dirInfo.GetFiles("*.txt"))
{
try
{
using (StreamReader reader = new StreamReader(info.FullName, Encoding.UTF8))
using StreamReader reader = new(info.FullName, Encoding.UTF8);
string name = Path.GetFileNameWithoutExtension(info.FullName);
TabPage page = new()
{
string name = Path.GetFileNameWithoutExtension(info.FullName);
TabPage page = new TabPage
Name = "TpCustom" + name,
Tag = "Custom" + name,
Text = name,
AutoScroll = true,
UseVisualStyleBackColor = true,
Font = new Font("Arial", 9.75f)
};

int index = 0;
int itemsPerLine = 12;
Point offset = new(8, 6);
Point space = new(6, 6);
Size size = new(25, 25);

while (!reader.EndOfStream)
{
string line = reader.ReadLine();

if (line.Length > 0)
line = line.Substring(0, 1);
else
continue;

int x = offset.X + (size.Width + space.X) * (index % itemsPerLine);
int y = offset.Y + (size.Height + space.Y) * (index / itemsPerLine);

Button button = new()
{
Name = "TpCustom" + name,
Tag = "Custom" + name,
Text = name,
AutoScroll = true,
Name = page.Name + "_Char_" + (ushort)line[0],
Text = line,
UseVisualStyleBackColor = true,
Font = new Font("Arial", 9.75f)
Size = size,
Location = new Point(x, y)
};
button.Click += Button_Click;

int index = 0;
int itemsPerLine = 12;
Point offset = new Point(8, 6);
Point space = new Point(6, 6);
Size size = new Size(25, 25);

while (!reader.EndOfStream)
{
string line = reader.ReadLine();

if (line.Length > 0)
line = line.Substring(0, 1);
else
continue;

int x = offset.X + (size.Width + space.X) * (index % itemsPerLine);
int y = offset.Y + (size.Height + space.Y) * (index / itemsPerLine);

Button button = new Button
{
Name = page.Name + "_Char_" + (ushort)line[0],
Text = line,
UseVisualStyleBackColor = true,
Size = size,
Location = new Point(x, y)
};
button.Click += Button_Click;

page.Controls.Add(button);
index++;
}

TcMain.TabPages.Add(page);
page.Controls.Add(button);
index++;
}

TcMain.TabPages.Add(page);
}
catch
{
Expand Down
Loading

0 comments on commit 5e7c86b

Please sign in to comment.