Skip to content

Commit

Permalink
Merge pull request #2 from cho3ek89/release/1.1.0.0
Browse files Browse the repository at this point in the history
Creating version 1.1.0.0 of an application.
  • Loading branch information
cho3ek89 authored Aug 27, 2024
2 parents 999c65c + 508213e commit acd051f
Show file tree
Hide file tree
Showing 16 changed files with 907 additions and 106 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
build:
name: Build
env:
version: 1.0.0.0
version: 1.1.0.0
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
Expand All @@ -25,15 +25,15 @@ jobs:
uses: actions/checkout@v4.1.7

- name: Setup .NET
uses: actions/setup-dotnet@v4.0.0
uses: actions/setup-dotnet@v4.0.1
with:
dotnet-version: '8.0.x'

- name: Publish 'MSI Keyboard Illuminator'
run: dotnet publish 'MSI.Keyboard.Illuminator/MSI.Keyboard.Illuminator.csproj' -o 'binaries' -c 'Release' -r '${{ matrix.runtime }}' -v 'normal' -p:Version=${{ env.version }}

- name: Upload artifacts
uses: actions/upload-artifact@v4.3.3
uses: actions/upload-artifact@v4.3.6
with:
name: MSI.Keyboard.Illuminator_${{ matrix.runtime }}_${{ env.version }}
path: binaries/
3 changes: 2 additions & 1 deletion MSI.Keyboard.Illuminator/App.axaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:MSI.Keyboard.Illuminator.ViewModels"
xmlns:r="using:MSI.Keyboard.Illuminator.Resources"
x:Class="MSI.Keyboard.Illuminator.App"
x:DataType="vm:TrayViewModel"
RequestedThemeVariant="Default">
Expand All @@ -17,7 +18,7 @@
<TrayIcon.Icons>
<TrayIcons>
<TrayIcon Icon="/Assets/logo.ico"
ToolTipText="Chenge MSI keyboard colors"
ToolTipText="{x:Static r:Resources.AppTrayIconTooltipText}"
Menu="{Binding TrayMenu}">
</TrayIcon>
</TrayIcons>
Expand Down
49 changes: 6 additions & 43 deletions MSI.Keyboard.Illuminator/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using MSI.Keyboard.Illuminator.Services;
using MSI.Keyboard.Illuminator.ViewModels;

using System;
using System.CommandLine;
using System.IO;

Expand All @@ -35,16 +34,14 @@ public override void OnFrameworkInitializationCompleted()
WarnIfDeviceIsNotSupported();

appSettingsManager = GetAppSettingsManager(application.Args);
InitializeSettings();
application.Exit += (s, e) => FinalizeSettings();

var colorProfilesViewModel = new ColorProfilesViewModel(appSettingsManager);

DataContext = new TrayViewModel(
application,
colorProfilesViewModel,
keyboardService,
appSettingsManager);
keyboardService,
appSettingsManager,
colorProfilesViewModel);
}

base.OnFrameworkInitializationCompleted();
Expand All @@ -62,55 +59,21 @@ protected void WarnIfDeviceIsNotSupported()
return;

WindowHelper.ShowMessageWindow(
"MSI keyboard not found!",
"The supported \"MSI EPF USB\" SteelSeries keyboard has not been found!" +
Environment.NewLine +
"Exit an application as it is is not going to work properly anyway.");
Illuminator.Resources.Resources.DeviceNotFoundErrorTitle,
Illuminator.Resources.Resources.DeviceNotFoundErrorMessage);
}

protected static IAppSettingsManager GetAppSettingsManager(params string[] args)
{
var fileOption = new Option<FileInfo>(
name: "--settings",
getDefaultValue: () => new FileInfo("appsettings.xml"),
description: "A full path to the settings file.");
description: Illuminator.Resources.Resources.SettingsParameterDescription);

var settingsFile = fileOption.Parse(args).GetValueForOption(fileOption);

var appSettingsStreamer = new AppSettingsStreamer(settingsFile);

return new AppSettingsManager(appSettingsStreamer);
}

protected void InitializeSettings()
{
try
{
appSettingsManager.LoadSettings();
}
catch (FileNotFoundException)
{
// supress and use default settings
}
catch (Exception ex)
{
WindowHelper.ShowMessageWindow(
"Loading application settings failed!",
ex.Message);
}
}

protected void FinalizeSettings()
{
try
{
appSettingsManager.SaveSettings();
}
catch (Exception ex)
{
WindowHelper.ShowMessageWindow(
"Saving application settings failed!",
ex.Message);
}
}
}
28 changes: 19 additions & 9 deletions MSI.Keyboard.Illuminator/MSI.Keyboard.Illuminator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,28 @@
</PropertyGroup>

<ItemGroup>
<AvaloniaResource Include="Assets\**" />
<PackageReference Include="Avalonia" Version="11.1.3" />
<PackageReference Include="Avalonia.Controls.ColorPicker" Version="11.1.3" />
<PackageReference Include="Avalonia.Desktop" Version="11.1.3" />
<PackageReference Include="Avalonia.Themes.Simple" Version="11.1.3" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.1.3" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.1.3" />
<PackageReference Include="HidSharp" Version="2.1.0" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.11" />
<PackageReference Include="Avalonia.Controls.ColorPicker" Version="11.0.11" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.11" />
<PackageReference Include="Avalonia.Themes.Simple" Version="11.0.11" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.11" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.11" />
<PackageReference Include="HidSharp" Version="2.1.0" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<AvaloniaResource Include="Assets\**" />

<Compile Update="Resources\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<EmbeddedResource Update="Resources\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

</Project>
Loading

0 comments on commit acd051f

Please sign in to comment.