1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-21 20:56:08 +03:00
This commit is contained in:
next-autumn 2021-04-30 14:42:20 +08:00
parent 7c6820f0f7
commit 5b547b87f9
7 changed files with 58 additions and 19 deletions

View File

@ -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; }
}
}

View File

@ -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")]

View File

@ -127,6 +127,7 @@
<Compile Include="Common\Base64.cs" />
<Compile Include="Converters\LoginSecretTypeConverter.cs" />
<Compile Include="Converters\VisibleConverter.cs" />
<Compile Include="Models\AppSettings.cs" />
<Compile Include="Models\Host.cs" />
<Compile Include="Models\ShareLink.cs" />
<Compile Include="Models\XraySettings.cs" />

View File

@ -4,13 +4,13 @@
<sys:String x:Key="TabItemHeaderAppDeployment">Deployment</sys:String>
<sys:String x:Key="TabItemHeaderReadme">Readme</sys:String>
<sys:String x:Key="LanguageText">Language</sys:String>
<sys:String x:Key="LanguageText">Language(语言)</sys:String>
<sys:String x:Key="LanguageChinese">Chinese</sys:String>
<sys:String x:Key="LanguageEnglish">English</sys:String>
<sys:String x:Key="Hosts">Hosts</sys:String>
<sys:String x:Key="AddHost">Add Host</sys:String>
<sys:String x:Key="ViewConfig">Configuration</sys:String>
<sys:String x:Key="ViewSub">Subscription</sys:String>
<sys:String x:Key="ViewConfig">Export Config</sys:String>
<sys:String x:Key="ViewSub">Export Sub</sys:String>
<sys:String x:Key="Random">Random</sys:String>
@ -113,4 +113,10 @@
<sys:String x:Key="ReadmeUpdateCert">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</sys:String>
<sys:String x:Key="ReadmeUploadWeb">Upload website: Disguise the website, the correct static webpage must have an index.html file (please check), and then upload the website compressed package.</sys:String>
<sys:String x:Key="ReadmeWebsiteDemo">The following is a static web page connection provided by netizens, please check whether there is an index.html file by yourself</sys:String>
<!--client info window-->
<sys:String x:Key="ClientInfoTitle">View Settings</sys:String>
</ResourceDictionary>

View File

@ -4,7 +4,7 @@
<sys:String x:Key="TabItemHeaderAppDeployment">应用布署</sys:String>
<sys:String x:Key="TabItemHeaderReadme">说明文档</sys:String>
<sys:String x:Key="LanguageText">语言</sys:String>
<sys:String x:Key="LanguageText">语言(Language)</sys:String>
<sys:String x:Key="LanguageChinese">中文</sys:String>
<sys:String x:Key="LanguageEnglish">英文</sys:String>
<sys:String x:Key="Hosts">主机列表</sys:String>
@ -114,4 +114,7 @@
<sys:String x:Key="ReadmeWebsiteDemo">如下是网友提供的静态网页连接请自行检查是否有index.html文件</sys:String>
<!--client info window-->
<sys:String x:Key="ClientInfoTitle">查看配置信息</sys:String>
</ResourceDictionary>

View File

@ -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">
<Grid>
@ -64,13 +64,13 @@
<local:VLESS_gRPC_Control />
</TabItem>-->
<TabItem Width="200" Height="40"
<!--<TabItem Width="200" Height="40"
Tag="{x:Static models:XrayType.VMESS_TCP}"
IsEnabled="{Binding Settings.Checked_VMESS_TCP}"
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
Header="VMESS-TCP-TLS">
<local:VMESS_TCP_TLS_Control />
</TabItem>
</TabItem>-->
<TabItem Width="200" Height="40"
Tag="{x:Static models:XrayType.VMESS_WS}"

View File

@ -25,6 +25,10 @@ namespace ProxySU_Core
public partial class MainWindow
{
private const string RecordPath = @"Data\Record.json";
private const string SettingsPath = @"Data\AppSettings.json";
private const string ZH_CN = "zh_cn";
private const string EN = "en";
public ObservableCollection<RecordViewModel> Records { get; set; }
@ -34,7 +38,19 @@ namespace ProxySU_Core
InitializeComponent();
Records = new ObservableCollection<RecordViewModel>();
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);
}