From 5b547b87f93cea23e08d83f252aa94cbf96afba1 Mon Sep 17 00:00:00 2001 From: next-autumn Date: Fri, 30 Apr 2021 14:42:20 +0800 Subject: [PATCH] v3.1.3 --- ProxySU_Core/Models/AppSettings.cs | 13 +++++++ ProxySU_Core/Properties/AssemblyInfo.cs | 4 +-- ProxySU_Core/ProxySU_Core.csproj | 1 + ProxySU_Core/Resources/Languages/en.xaml | 12 +++++-- ProxySU_Core/Resources/Languages/zh_cn.xaml | 5 ++- .../Views/ClientInfo/ClientInfoWindow.xaml | 6 ++-- ProxySU_Core/Views/MainWindow.xaml.cs | 36 +++++++++++++------ 7 files changed, 58 insertions(+), 19 deletions(-) create mode 100644 ProxySU_Core/Models/AppSettings.cs diff --git a/ProxySU_Core/Models/AppSettings.cs b/ProxySU_Core/Models/AppSettings.cs new file mode 100644 index 0000000..0b42488 --- /dev/null +++ b/ProxySU_Core/Models/AppSettings.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProxySU_Core.Models +{ + public class AppSettings + { + public string Language { get; set; } + } +} diff --git a/ProxySU_Core/Properties/AssemblyInfo.cs b/ProxySU_Core/Properties/AssemblyInfo.cs index 6efb8d6..2107e9b 100644 --- a/ProxySU_Core/Properties/AssemblyInfo.cs +++ b/ProxySU_Core/Properties/AssemblyInfo.cs @@ -51,5 +51,5 @@ using System.Windows; //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //通过使用 "*",如下所示: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.1.2.0")] -[assembly: AssemblyFileVersion("3.1.2.0")] +[assembly: AssemblyVersion("3.1.3.0")] +[assembly: AssemblyFileVersion("3.1.3.0")] diff --git a/ProxySU_Core/ProxySU_Core.csproj b/ProxySU_Core/ProxySU_Core.csproj index a352476..15b6cf7 100644 --- a/ProxySU_Core/ProxySU_Core.csproj +++ b/ProxySU_Core/ProxySU_Core.csproj @@ -127,6 +127,7 @@ + diff --git a/ProxySU_Core/Resources/Languages/en.xaml b/ProxySU_Core/Resources/Languages/en.xaml index a1accf3..dc9d5ab 100644 --- a/ProxySU_Core/Resources/Languages/en.xaml +++ b/ProxySU_Core/Resources/Languages/en.xaml @@ -4,13 +4,13 @@ Deployment Readme - Language + Language(语言) Chinese English Hosts Add Host - Configuration - Subscription + Export Config + Export Sub Random @@ -113,4 +113,10 @@ Update Cert: The certificate is automatically updated by default, but it is not guaranteed to be updated successfully. If it fails, please use [Update Cert] to update manually Upload website: Disguise the website, the correct static webpage must have an index.html file (please check), and then upload the website compressed package. The following is a static web page connection provided by netizens, please check whether there is an index.html file by yourself + + + + + View Settings + \ No newline at end of file diff --git a/ProxySU_Core/Resources/Languages/zh_cn.xaml b/ProxySU_Core/Resources/Languages/zh_cn.xaml index aa498e1..dc13120 100644 --- a/ProxySU_Core/Resources/Languages/zh_cn.xaml +++ b/ProxySU_Core/Resources/Languages/zh_cn.xaml @@ -4,7 +4,7 @@ 应用布署 说明文档 - 语言 + 语言(Language) 中文 英文 主机列表 @@ -114,4 +114,7 @@ 如下是网友提供的静态网页连接,请自行检查是否有index.html文件 + + 查看配置信息 + \ No newline at end of file diff --git a/ProxySU_Core/Views/ClientInfo/ClientInfoWindow.xaml b/ProxySU_Core/Views/ClientInfo/ClientInfoWindow.xaml index 08eaaff..d034a26 100644 --- a/ProxySU_Core/Views/ClientInfo/ClientInfoWindow.xaml +++ b/ProxySU_Core/Views/ClientInfo/ClientInfoWindow.xaml @@ -8,7 +8,7 @@ xmlns:dev="clr-namespace:ProxySU_Core.Models.Developers" xmlns:models="clr-namespace:ProxySU_Core.Models" mc:Ignorable="d" - Title="查看配置" Height="500" Width="800"> + Title="{DynamicResource ClientInfoTitle}" Height="500" Width="800"> @@ -64,13 +64,13 @@ --> - - + --> Records { get; set; } @@ -34,7 +38,19 @@ namespace ProxySU_Core InitializeComponent(); Records = new ObservableCollection(); + LoadRecords(); + DataContext = this; + } + + protected override void OnClosed(EventArgs e) + { + base.OnClosed(e); + this.SaveRecord(); + } + + private void LoadRecords() + { if (File.Exists(RecordPath)) { var recordsJson = File.ReadAllText(RecordPath, Encoding.UTF8); @@ -47,9 +63,6 @@ namespace ProxySU_Core }); } } - - - DataContext = this; } private void SaveRecord() @@ -65,7 +78,7 @@ namespace ProxySU_Core { Directory.CreateDirectory("Data"); } - File.WriteAllText("Data\\Record.json", json, Encoding.UTF8); + File.WriteAllText(RecordPath, json, Encoding.UTF8); } private void LaunchGitHubSite(object sender, RoutedEventArgs e) @@ -78,30 +91,33 @@ namespace ProxySU_Core System.Diagnostics.Process.Start("explorer.exe", "https://github.com/proxysu/ProxySU"); } + private void ChangeLanguage(object sender, SelectionChangedEventArgs e) { var selection = cmbLanguage.SelectedValue as ComboBoxItem; - if (selection.Name == "zh_cn") + if (selection.Name == ZH_CN) { - ChangeLanguage("zh_cn"); + ChangeLanguage(ZH_CN); + } - else if (selection.Name == "en") + else if (selection.Name == EN) { - ChangeLanguage("en"); + ChangeLanguage(EN); } + } private void ChangeLanguage(string culture) { ResourceDictionary resource = new ResourceDictionary(); - if (string.Equals(culture, "zh_cn", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(culture, ZH_CN, StringComparison.OrdinalIgnoreCase)) { resource.Source = new Uri(@"Resources\Languages\zh_cn.xaml", UriKind.Relative); } - else if (string.Equals(culture, "en", StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(culture, EN, StringComparison.OrdinalIgnoreCase)) { resource.Source = new Uri(@"Resources\Languages\en.xaml", UriKind.Relative); }