Skip to content

Commit

Permalink
Merge pull request #5 from cho3ek89/release/1.2.2.0
Browse files Browse the repository at this point in the history
Creating version 1.2.2.0 of an application.
  • Loading branch information
cho3ek89 authored Sep 4, 2024
2 parents 407ec29 + 34f4a22 commit 6742da1
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .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.2.1.0
version: 1.2.2.0
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
Expand Down
26 changes: 0 additions & 26 deletions MSI.Keyboard.Illuminator/Providers/AppSettingsStreamer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
using System;
using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;

Expand All @@ -28,18 +26,6 @@ public AppSettings LoadSettings()
return GetAppSettings(xml.Root);
}

public async Task<AppSettings> LoadSettingsAsync() =>
await LoadSettingsAsync(CancellationToken.None);

public async Task<AppSettings> LoadSettingsAsync(CancellationToken cancellationToken)
{
using var stream = GetStreamReader();

var xml = await XDocument.LoadAsync(stream, LoadOptions.None, cancellationToken);

return GetAppSettings(xml.Root);
}

public void SaveSettings(AppSettings appSettings)
{
var xml = GetXDocument(appSettings);
Expand All @@ -49,18 +35,6 @@ public void SaveSettings(AppSettings appSettings)
xml.Save(writer);
}

public async Task SaveSettingsAsync(AppSettings appSettings) =>
await SaveSettingsAsync(appSettings, CancellationToken.None);

public async Task SaveSettingsAsync(AppSettings appSettings, CancellationToken cancellationToken)
{
var xml = GetXDocument(appSettings);

using var writer = GetXmlTextWriter();

await xml.SaveAsync(writer, cancellationToken);
}

protected StreamReader GetStreamReader() => new(settingsFilePath, encoding);

protected XmlTextWriter GetXmlTextWriter() => new(settingsFilePath, encoding)
Expand Down
11 changes: 0 additions & 11 deletions MSI.Keyboard.Illuminator/Providers/IAppSettingsStreamer.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
using MSI.Keyboard.Illuminator.Models;

using System.Threading;
using System.Threading.Tasks;

namespace MSI.Keyboard.Illuminator.Providers;

public interface IAppSettingsStreamer
{
AppSettings LoadSettings();

Task<AppSettings> LoadSettingsAsync();

Task<AppSettings> LoadSettingsAsync(CancellationToken cancellationToken);

void SaveSettings(AppSettings appSettings);

Task SaveSettingsAsync(AppSettings appSettings);

Task SaveSettingsAsync(AppSettings appSettings, CancellationToken cancellationToken);
}
3 changes: 2 additions & 1 deletion MSI.Keyboard.Illuminator/Views/MessageWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
TextWrapping="Wrap"/>

<Button Grid.Row=" 1"
Click="MessageCloseButtonClick"
x:Name="closeButton"
Click="CloseButtonClick"
Margin="0,0,10,10"
Width="70"
HorizontalAlignment="Right"
Expand Down
11 changes: 10 additions & 1 deletion MSI.Keyboard.Illuminator/Views/MessageWindow.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;

namespace MSI.Keyboard.Illuminator.Views;
Expand All @@ -8,7 +9,15 @@ public partial class MessageWindow : Window
public MessageWindow()
{
InitializeComponent();

KeyUp += (s, e) =>
{
if (e.Key == Key.Escape || e.Key == Key.Enter)
Close();
};

Loaded += (s, e) => closeButton.Focus();
}

public void MessageCloseButtonClick(object sender, RoutedEventArgs args) => Close();
public void CloseButtonClick(object sender, RoutedEventArgs args) => Close();
}

0 comments on commit 6742da1

Please sign in to comment.