mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
optimize<Preference>: remove avater server
This commit is contained in:
parent
0b8c23c02d
commit
d827c1fbe1
4 changed files with 7 additions and 49 deletions
|
@ -1,22 +0,0 @@
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace SourceGit.Models {
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 支持的头像服务器
|
|
||||||
/// </summary>
|
|
||||||
public class AvatarServer {
|
|
||||||
public string Name { get; set; }
|
|
||||||
public string Url { get; set; }
|
|
||||||
|
|
||||||
public static List<AvatarServer> Supported = new List<AvatarServer>() {
|
|
||||||
new AvatarServer("Gravatar", "https://www.gravatar.com/avatar/"),
|
|
||||||
new AvatarServer("Gravatar - 极客族", "https://sdn.geekzu.org/avatar/"),
|
|
||||||
};
|
|
||||||
|
|
||||||
public AvatarServer(string name, string url) {
|
|
||||||
Name = name;
|
|
||||||
Url = url;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -58,11 +58,6 @@ namespace SourceGit.Models {
|
||||||
set => FontFamilyContentSetting = value;
|
set => FontFamilyContentSetting = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 头像服务器
|
|
||||||
/// </summary>
|
|
||||||
public string AvatarServer { get; set; } = "https://www.gravatar.com/avatar/";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否启用深色主题
|
/// 是否启用深色主题
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -193,7 +193,7 @@ namespace SourceGit.Views.Controls {
|
||||||
if (!requesting.ContainsKey(email)) return;
|
if (!requesting.ContainsKey(email)) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var req = new HttpClient().GetAsync(Models.Preference.Instance.General.AvatarServer + md5 + "?d=404");
|
var req = new HttpClient().GetAsync($"https://www.gravatar.com/avatar/{md5}?d=404");
|
||||||
req.Wait();
|
req.Wait();
|
||||||
|
|
||||||
var rsp = req.Result;
|
var rsp = req.Result;
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
<TabControl Grid.Row="2" Margin="0,4">
|
<TabControl Grid.Row="2" Margin="0,4">
|
||||||
<!-- General Setting -->
|
<!-- General Setting -->
|
||||||
<TabItem Header="{DynamicResource Text.Preference.General}">
|
<TabItem Header="{DynamicResource Text.Preference.General}">
|
||||||
<Grid Margin="0,8">
|
<Grid Margin="8">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="28"/>
|
<RowDefinition Height="28"/>
|
||||||
<RowDefinition Height="28"/>
|
<RowDefinition Height="28"/>
|
||||||
|
@ -66,7 +66,6 @@
|
||||||
<RowDefinition Height="28"/>
|
<RowDefinition Height="28"/>
|
||||||
<RowDefinition Height="28"/>
|
<RowDefinition Height="28"/>
|
||||||
<RowDefinition Height="28"/>
|
<RowDefinition Height="28"/>
|
||||||
<RowDefinition Height="28"/>
|
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
|
@ -133,36 +132,22 @@
|
||||||
</ComboBox.Resources>
|
</ComboBox.Resources>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
|
|
||||||
<!-- Avatar -->
|
|
||||||
<TextBlock
|
|
||||||
Grid.Row="3" Grid.Column="0"
|
|
||||||
Text="{DynamicResource Text.Preference.AvatarServer}"
|
|
||||||
HorizontalAlignment="Right"
|
|
||||||
Margin="0,0,8,0"/>
|
|
||||||
<ComboBox
|
|
||||||
Grid.Row="3" Grid.Column="1"
|
|
||||||
Height="24"
|
|
||||||
ItemsSource="{Binding Source={x:Static models:AvatarServer.Supported}}"
|
|
||||||
DisplayMemberPath="Name"
|
|
||||||
SelectedValuePath="Url"
|
|
||||||
SelectedValue="{Binding Source={x:Static models:Preference.Instance}, Path=General.AvatarServer, Mode=TwoWay}"/>
|
|
||||||
|
|
||||||
<!-- Enable Check For Update -->
|
<!-- Enable Check For Update -->
|
||||||
<CheckBox
|
<CheckBox
|
||||||
Grid.Row="4" Grid.Column="1"
|
Grid.Row="3" Grid.Column="1"
|
||||||
Content="{DynamicResource Text.Preference.CheckUpdate}"
|
Content="{DynamicResource Text.Preference.CheckUpdate}"
|
||||||
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=General.CheckForUpdate, Mode=TwoWay}"/>
|
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=General.CheckForUpdate, Mode=TwoWay}"/>
|
||||||
|
|
||||||
<!-- Enable Dark Theme -->
|
<!-- Enable Dark Theme -->
|
||||||
<CheckBox
|
<CheckBox
|
||||||
Grid.Row="5" Grid.Column="1"
|
Grid.Row="4" Grid.Column="1"
|
||||||
Content="{DynamicResource Text.Preference.UseDarkTheme}"
|
Content="{DynamicResource Text.Preference.UseDarkTheme}"
|
||||||
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=General.UseDarkTheme, Mode=TwoWay}"
|
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=General.UseDarkTheme, Mode=TwoWay}"
|
||||||
Checked="ChangeTheme" Unchecked="ChangeTheme"/>
|
Checked="ChangeTheme" Unchecked="ChangeTheme"/>
|
||||||
|
|
||||||
<!-- Restore Windows -->
|
<!-- Restore Windows -->
|
||||||
<CheckBox
|
<CheckBox
|
||||||
Grid.Row="6" Grid.Column="1"
|
Grid.Row="5" Grid.Column="1"
|
||||||
Content="{DynamicResource Text.Preference.RestoreTabs}"
|
Content="{DynamicResource Text.Preference.RestoreTabs}"
|
||||||
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=Restore.IsEnabled, Mode=TwoWay}"/>
|
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=Restore.IsEnabled, Mode=TwoWay}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -170,7 +155,7 @@
|
||||||
|
|
||||||
<!-- Git Setting -->
|
<!-- Git Setting -->
|
||||||
<TabItem Header="{DynamicResource Text.Preference.Git}">
|
<TabItem Header="{DynamicResource Text.Preference.Git}">
|
||||||
<Grid Margin="0,8">
|
<Grid Margin="8">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="28"/>
|
<RowDefinition Height="28"/>
|
||||||
<RowDefinition Height="28"/>
|
<RowDefinition Height="28"/>
|
||||||
|
@ -310,7 +295,7 @@
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|
||||||
<TabItem Header="{DynamicResource Text.Preference.Merger}">
|
<TabItem Header="{DynamicResource Text.Preference.Merger}">
|
||||||
<Grid Margin="0,8">
|
<Grid Margin="8">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="28"/>
|
<RowDefinition Height="28"/>
|
||||||
<RowDefinition Height="28"/>
|
<RowDefinition Height="28"/>
|
||||||
|
|
Loading…
Reference in a new issue