feature<Configure>: supports configuration for http.proxy

This commit is contained in:
leo 2021-07-15 09:23:37 +08:00
parent 4c5b8ce072
commit add6062917
4 changed files with 20 additions and 0 deletions

View file

@ -92,6 +92,8 @@
<sys:String x:Key="Text.Configure.User.Placeholder">User name for this repository</sys:String> <sys:String x:Key="Text.Configure.User.Placeholder">User name for this repository</sys:String>
<sys:String x:Key="Text.Configure.Email">Email :</sys:String> <sys:String x:Key="Text.Configure.Email">Email :</sys:String>
<sys:String x:Key="Text.Configure.Email.Placeholder">Email address</sys:String> <sys:String x:Key="Text.Configure.Email.Placeholder">Email address</sys:String>
<sys:String x:Key="Text.Configure.Proxy">Proxy :</sys:String>
<sys:String x:Key="Text.Configure.Proxy.Placeholder">HTTP proxy used by this repository</sys:String>
<sys:String x:Key="Text.CreateBranch">Create Branch</sys:String> <sys:String x:Key="Text.CreateBranch">Create Branch</sys:String>
<sys:String x:Key="Text.CreateBranch.Title">Create Local Branch</sys:String> <sys:String x:Key="Text.CreateBranch.Title">Create Local Branch</sys:String>

View file

@ -91,6 +91,8 @@
<sys:String x:Key="Text.Configure.User.Placeholder">应用于本仓库的用户名</sys:String> <sys:String x:Key="Text.Configure.User.Placeholder">应用于本仓库的用户名</sys:String>
<sys:String x:Key="Text.Configure.Email">邮箱 </sys:String> <sys:String x:Key="Text.Configure.Email">邮箱 </sys:String>
<sys:String x:Key="Text.Configure.Email.Placeholder">邮箱地址</sys:String> <sys:String x:Key="Text.Configure.Email.Placeholder">邮箱地址</sys:String>
<sys:String x:Key="Text.Configure.Proxy">代理 </sys:String>
<sys:String x:Key="Text.Configure.Proxy.Placeholder">HTTP网络代理</sys:String>
<sys:String x:Key="Text.CreateBranch">新建分支</sys:String> <sys:String x:Key="Text.CreateBranch">新建分支</sys:String>
<sys:String x:Key="Text.CreateBranch.Title">创建本地分支</sys:String> <sys:String x:Key="Text.CreateBranch.Title">创建本地分支</sys:String>

View file

@ -12,6 +12,7 @@
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="32"/> <RowDefinition Height="32"/>
<RowDefinition Height="32"/> <RowDefinition Height="32"/>
<RowDefinition Height="32"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
@ -40,5 +41,16 @@
Text="{Binding ElementName=me, Path=UserEmail, Mode=TwoWay}" Text="{Binding ElementName=me, Path=UserEmail, Mode=TwoWay}"
Height="24" Height="24"
Placeholder="{StaticResource Text.Configure.Email.Placeholder}"/> Placeholder="{StaticResource Text.Configure.Email.Placeholder}"/>
<TextBlock
Grid.Row="2" Grid.Column="0"
Margin="0,0,8,0"
Text="{StaticResource Text.Configure.Proxy}"
HorizontalAlignment="Right"/>
<controls:TextEdit
Grid.Row="2" Grid.Column="1"
Text="{Binding ElementName=me, Path=Proxy, Mode=TwoWay}"
Height="24"
Placeholder="{StaticResource Text.Configure.Proxy.Placeholder}"/>
</Grid> </Grid>
</controls:PopupWidget> </controls:PopupWidget>

View file

@ -9,6 +9,7 @@ namespace SourceGit.Views.Popups {
public string UserName { get; set; } public string UserName { get; set; }
public string UserEmail { get; set; } public string UserEmail { get; set; }
public string Proxy { get; set; }
public Configure(string repo) { public Configure(string repo) {
this.repo = repo; this.repo = repo;
@ -16,6 +17,7 @@ namespace SourceGit.Views.Popups {
var cmd = new Commands.Config(repo); var cmd = new Commands.Config(repo);
UserName = cmd.Get("user.name"); UserName = cmd.Get("user.name");
UserEmail = cmd.Get("user.email"); UserEmail = cmd.Get("user.email");
Proxy = cmd.Get("http.proxy");
InitializeComponent(); InitializeComponent();
} }
@ -32,6 +34,8 @@ namespace SourceGit.Views.Popups {
if (oldUser != UserName) cmd.Set("user.name", UserName); if (oldUser != UserName) cmd.Set("user.name", UserName);
var oldEmail = cmd.Get("user.email"); var oldEmail = cmd.Get("user.email");
if (oldEmail != UserEmail) cmd.Set("user.email", UserEmail); if (oldEmail != UserEmail) cmd.Set("user.email", UserEmail);
var oldProxy = cmd.Get("http.proxy");
if (oldProxy != Proxy) cmd.Set("http.proxy", Proxy);
return true; return true;
}); });
} }