Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
reagcz committed Oct 14, 2024
2 parents c4cb1dc + de40db7 commit 4a4650a
Show file tree
Hide file tree
Showing 16 changed files with 886 additions and 43 deletions.
1 change: 1 addition & 0 deletions IdeapadToolkit.sln
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
RESX_SortFileContentOnSave = True
SolutionGuid = {88081EEF-3938-46A8-B49A-9AD2C92E4E1A}
EndGlobalSection
EndGlobal
15 changes: 15 additions & 0 deletions IdeapadToolkit/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?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="IdeapadToolkit.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<userSettings>
<IdeapadToolkit.Settings>
<setting name="Language" serializeAs="String">
<value />
</setting>
</IdeapadToolkit.Settings>
</userSettings>
</configuration>
21 changes: 18 additions & 3 deletions IdeapadToolkit/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
using Serilog;
using System.Windows;
using Serilog.Core;
using System.Globalization;
using System.Threading;

namespace IdeapadToolkit
{
Expand All @@ -29,10 +31,10 @@ public void ConfigureServices(Container container)
.MinimumLevel.ControlledBy(logLevel)
.WriteTo.File("log.txt", rollingInterval: RollingInterval.Day, retainedFileCountLimit: 7, levelSwitch: logLevel);
var logger = _logger = loggerConfig.CreateLogger();

container.RegisterInstance(logger);
container.RegisterInstance(logLevel);

container.RegisterSingleton<INavigationService, NavigationService>();
container.RegisterSingleton<ILenovoPowerSettingsService, LenovoPowerSettingsService>();
container.RegisterSingleton<IUEFISettingsService, UEFISettingsService>();
Expand Down Expand Up @@ -75,7 +77,7 @@ protected override void OnStartup(StartupEventArgs e)
{
ShowMainWindow(null, null);
}

var iconview = _container.GetInstance<TrayIconView>();
iconview.MakeVisible();
iconview.TrayIconClicked += ShowMainWindow;
Expand All @@ -90,6 +92,19 @@ public void ShowMainWindow(object? sender, EventArgs? e)
{
if (App.Current.MainWindow == null)
{
var culture = Settings.Default.Language;
if (!String.IsNullOrWhiteSpace(culture))
{
var cultureInfo = CultureInfo.GetCultureInfo(culture);
if (cultureInfo != null)
{
Application.Current.Dispatcher.Invoke(() =>
{
Thread.CurrentThread.CurrentUICulture = cultureInfo;
});
}
}

App.Current.MainWindow = _container.GetInstance<MainWindow>();
}
App.Current.MainWindow.Show();
Expand Down
24 changes: 24 additions & 0 deletions IdeapadToolkit/IdeapadToolkit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,34 @@
<Resource Include="Resources\saving_quick.ico" />
</ItemGroup>

<ItemGroup>
<Compile Update="Localization\Strings.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Strings.resx</DependentUpon>
</Compile>
<Compile Update="Settings.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Localization\Strings.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<None Update="PowerBattery.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>

<ItemGroup>
Expand Down
198 changes: 198 additions & 0 deletions IdeapadToolkit/Localization/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4a4650a

Please sign in to comment.