diff --git a/BililiveRecorder.WPF/BililiveRecorder.WPF.csproj b/BililiveRecorder.WPF/BililiveRecorder.WPF.csproj
index 43fb0d3..89597a3 100644
--- a/BililiveRecorder.WPF/BililiveRecorder.WPF.csproj
+++ b/BililiveRecorder.WPF/BililiveRecorder.WPF.csproj
@@ -129,6 +129,11 @@
+
+ True
+ True
+ Strings.resx
+
Designer
MSBuild:Compile
@@ -232,6 +237,13 @@
ResXFileCodeGenerator
Resources.Designer.cs
+
+
+
+ PublicResXFileCodeGenerator
+ Strings.Designer.cs
+
+
@@ -295,6 +307,9 @@
1.1.1
+
+ 3.8.0
+
diff --git a/BililiveRecorder.WPF/Controls/TaskbarIconControl.xaml b/BililiveRecorder.WPF/Controls/TaskbarIconControl.xaml
index 63fdd04..6f18435 100644
--- a/BililiveRecorder.WPF/Controls/TaskbarIconControl.xaml
+++ b/BililiveRecorder.WPF/Controls/TaskbarIconControl.xaml
@@ -9,7 +9,7 @@
xmlns:local="clr-namespace:BililiveRecorder.WPF.Controls"
mc:Ignorable="d">
diff --git a/BililiveRecorder.WPF/Controls/TaskbarIconControl.xaml.cs b/BililiveRecorder.WPF/Controls/TaskbarIconControl.xaml.cs
index 83b7b5f..0b0eb4b 100644
--- a/BililiveRecorder.WPF/Controls/TaskbarIconControl.xaml.cs
+++ b/BililiveRecorder.WPF/Controls/TaskbarIconControl.xaml.cs
@@ -1,6 +1,6 @@
+using System;
using System.Windows;
using System.Windows.Controls;
-using Hardcodet.Wpf.TaskbarNotification;
namespace BililiveRecorder.WPF.Controls
{
@@ -11,14 +11,17 @@ namespace BililiveRecorder.WPF.Controls
{
public TaskbarIconControl()
{
- InitializeComponent();
+ this.InitializeComponent();
+
+ using var iconStream = Application.GetResourceStream(new Uri("pack://application:,,,/BililiveRecorder.WPF;component/ico.ico")).Stream;
+ this.TaskbarIcon.Icon = new System.Drawing.Icon(iconStream);
// AddHandler(NewMainWindow.ShowBalloonTipEvent, (RoutedEventHandler)UserControl_ShowBalloonTip);
if (Application.Current.MainWindow is NewMainWindow nmw)
{
nmw.ShowBalloonTipCallback = (title, msg, sym) =>
{
- TaskbarIcon.ShowBalloonTip(title, msg, sym);
+ this.TaskbarIcon.ShowBalloonTip(title, msg, sym);
};
}
}
diff --git a/BililiveRecorder.WPF/Controls/WorkDirectorySelectorDialog.xaml b/BililiveRecorder.WPF/Controls/WorkDirectorySelectorDialog.xaml
index 17c11db..af74e04 100644
--- a/BililiveRecorder.WPF/Controls/WorkDirectorySelectorDialog.xaml
+++ b/BililiveRecorder.WPF/Controls/WorkDirectorySelectorDialog.xaml
@@ -5,6 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ui="http://schemas.modernwpf.com/2019"
+ xmlns:l="https://github.com/XAMLMarkupExtensions/WPFLocalizationExtension"
xmlns:local="clr-namespace:BililiveRecorder.WPF.Controls"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=local:WorkDirectorySelectorDialog}"
@@ -16,9 +17,21 @@
+
+
@@ -28,5 +41,6 @@
+
diff --git a/BililiveRecorder.WPF/NewMainWindow.xaml b/BililiveRecorder.WPF/NewMainWindow.xaml
index 4cf6c6a..64b5b40 100644
--- a/BililiveRecorder.WPF/NewMainWindow.xaml
+++ b/BililiveRecorder.WPF/NewMainWindow.xaml
@@ -4,22 +4,31 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.modernwpf.com/2019"
+ xmlns:l="https://github.com/XAMLMarkupExtensions/WPFLocalizationExtension"
+ l:LocalizeDictionary.DesignCulture=""
+ l:ResxLocalizationProvider.DefaultAssembly="BililiveRecorder.WPF"
+ l:ResxLocalizationProvider.DefaultDictionary="Strings"
xmlns:local="clr-namespace:BililiveRecorder.WPF"
xmlns:pages="clr-namespace:BililiveRecorder.WPF.Pages"
mc:Ignorable="d"
- WindowStartupLocation="CenterScreen"
Background="{DynamicResource SystemControlPageBackgroundAltHighBrush}"
Foreground="{DynamicResource SystemControlPageTextBaseHighBrush}"
ui:ThemeManager.IsThemeAware="True"
+ ui:ThemeManager.RequestedTheme="Default"
ui:WindowHelper.UseModernWindowStyle="True"
ui:TitleBar.IsBackEnabled="False"
ui:TitleBar.IsBackButtonVisible="False"
ui:TitleBar.IsIconVisible="True"
- Width="960" Height="650"
- MinHeight="400" MinWidth="340"
- Closing="Window_Closing"
- StateChanged="Window_StateChanged"
- ui:ThemeManager.RequestedTheme="Default"
- Title="录播姬">
+ Width="960" Height="650" MinHeight="400" MinWidth="340"
+ WindowStartupLocation="CenterScreen"
+ FontFamily="Microsoft YaHei"
+ Closing="Window_Closing" StateChanged="Window_StateChanged"
+ >
+
+
+
+
+
+
diff --git a/BililiveRecorder.WPF/NewMainWindow.xaml.cs b/BililiveRecorder.WPF/NewMainWindow.xaml.cs
index 6a1a164..0c65fa3 100644
--- a/BililiveRecorder.WPF/NewMainWindow.xaml.cs
+++ b/BililiveRecorder.WPF/NewMainWindow.xaml.cs
@@ -4,6 +4,7 @@ using System.Windows;
using BililiveRecorder.WPF.Controls;
using Hardcodet.Wpf.TaskbarNotification;
using ModernWpf.Controls;
+using WPFLocalizeExtension.Engine;
namespace BililiveRecorder.WPF
{
@@ -12,16 +13,28 @@ namespace BililiveRecorder.WPF
///
public partial class NewMainWindow : Window
{
+ public string SoftwareVersion { get; }
+
public NewMainWindow()
{
- InitializeComponent();
+ this.SoftwareVersion = BuildInfo.Version + " " + BuildInfo.HeadShaShort;
+
+ LocalizeDictionary.Instance.OutputMissingKeys = true;
+ LocalizeDictionary.Instance.MissingKeyEvent += this.Instance_MissingKeyEvent;
- Title = "B站录播姬 " + BuildInfo.Version + " " + BuildInfo.HeadShaShort;
+ this.InitializeComponent();
- SingleInstance.NotificationReceived += SingleInstance_NotificationReceived;
+ // this.Title = "B站录播姬 " + BuildInfo.Version + " " + BuildInfo.HeadShaShort;
+
+ SingleInstance.NotificationReceived += this.SingleInstance_NotificationReceived;
}
- private void SingleInstance_NotificationReceived(object sender, EventArgs e) => SuperActivateAction();
+ private void Instance_MissingKeyEvent(object sender, MissingKeyEventArgs e)
+ {
+ MessageBox.Show("Missing: " + e.Key);
+ }
+
+ private void SingleInstance_NotificationReceived(object sender, EventArgs e) => this.SuperActivateAction();
public event EventHandler NativeBeforeWindowClose;
@@ -29,20 +42,20 @@ namespace BililiveRecorder.WPF
internal void CloseWithoutConfirmAction()
{
- CloseConfirmed = true;
- Close();
+ this.CloseConfirmed = true;
+ this.Close();
}
internal void SuperActivateAction()
{
try
{
- Show();
- WindowState = WindowState.Normal;
- Topmost = true;
- Activate();
- Topmost = false;
- Focus();
+ this.Show();
+ this.WindowState = WindowState.Normal;
+ this.Topmost = true;
+ this.Activate();
+ this.Topmost = false;
+ this.Focus();
}
catch (Exception)
{ }
@@ -50,10 +63,10 @@ namespace BililiveRecorder.WPF
private void Window_StateChanged(object sender, EventArgs e)
{
- if (WindowState == WindowState.Minimized)
+ if (this.WindowState == WindowState.Minimized)
{
- Hide();
- ShowBalloonTipCallback?.Invoke("B站录播姬", "录播姬已最小化到托盘,左键单击图标恢复界面", BalloonIcon.Info);
+ this.Hide();
+ this.ShowBalloonTipCallback?.Invoke("B站录播姬", "录播姬已最小化到托盘,左键单击图标恢复界面", BalloonIcon.Info);
}
}
@@ -67,28 +80,28 @@ namespace BililiveRecorder.WPF
private async void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
- if (PromptCloseConfirm && !CloseConfirmed)
+ if (this.PromptCloseConfirm && !this.CloseConfirmed)
{
e.Cancel = true;
- if (CloseWindowSemaphoreSlim.Wait(0))
+ if (this.CloseWindowSemaphoreSlim.Wait(0))
{
try
{
if (await new CloseWindowConfirmDialog().ShowAsync() == ContentDialogResult.Primary)
{
- CloseConfirmed = true;
- CloseWindowSemaphoreSlim.Release();
- Close();
+ this.CloseConfirmed = true;
+ this.CloseWindowSemaphoreSlim.Release();
+ this.Close();
return;
}
}
catch (Exception) { }
- CloseWindowSemaphoreSlim.Release();
+ this.CloseWindowSemaphoreSlim.Release();
}
}
else
{
- SingleInstance.NotificationReceived -= SingleInstance_NotificationReceived;
+ SingleInstance.NotificationReceived -= this.SingleInstance_NotificationReceived;
NativeBeforeWindowClose?.Invoke(this, EventArgs.Empty);
return;
}
diff --git a/BililiveRecorder.WPF/Pages/RoomListPage.xaml b/BililiveRecorder.WPF/Pages/RoomListPage.xaml
index 9d61b1b..d0fb7f9 100644
--- a/BililiveRecorder.WPF/Pages/RoomListPage.xaml
+++ b/BililiveRecorder.WPF/Pages/RoomListPage.xaml
@@ -5,6 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ui="http://schemas.modernwpf.com/2019"
+ xmlns:l="https://github.com/XAMLMarkupExtensions/WPFLocalizationExtension"
xmlns:local="clr-namespace:BililiveRecorder.WPF.Pages"
xmlns:mock="clr-namespace:BililiveRecorder.WPF.MockData"
xmlns:controls="clr-namespace:BililiveRecorder.WPF.Controls"
@@ -45,6 +46,16 @@