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

@ -12,6 +12,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="32"/>
<RowDefinition Height="32"/>
<RowDefinition Height="32"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
@ -40,5 +41,16 @@
Text="{Binding ElementName=me, Path=UserEmail, Mode=TwoWay}"
Height="24"
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>
</controls:PopupWidget>

View file

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