optimize<Preference>: remove avater server

This commit is contained in:
leo 2022-10-18 15:25:27 +08:00
parent 0b8c23c02d
commit d827c1fbe1
4 changed files with 7 additions and 49 deletions

View file

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

View file

@ -58,11 +58,6 @@ namespace SourceGit.Models {
set => FontFamilyContentSetting = value;
}
/// <summary>
/// 头像服务器
/// </summary>
public string AvatarServer { get; set; } = "https://www.gravatar.com/avatar/";
/// <summary>
/// 是否启用深色主题
/// </summary>

View file

@ -193,7 +193,7 @@ namespace SourceGit.Views.Controls {
if (!requesting.ContainsKey(email)) return;
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();
var rsp = req.Result;

View file

@ -57,7 +57,7 @@
<TabControl Grid.Row="2" Margin="0,4">
<!-- General Setting -->
<TabItem Header="{DynamicResource Text.Preference.General}">
<Grid Margin="0,8">
<Grid Margin="8">
<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
@ -66,7 +66,6 @@
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
@ -133,36 +132,22 @@
</ComboBox.Resources>
</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 -->
<CheckBox
Grid.Row="4" Grid.Column="1"
Grid.Row="3" Grid.Column="1"
Content="{DynamicResource Text.Preference.CheckUpdate}"
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=General.CheckForUpdate, Mode=TwoWay}"/>
<!-- Enable Dark Theme -->
<CheckBox
Grid.Row="5" Grid.Column="1"
Grid.Row="4" Grid.Column="1"
Content="{DynamicResource Text.Preference.UseDarkTheme}"
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=General.UseDarkTheme, Mode=TwoWay}"
Checked="ChangeTheme" Unchecked="ChangeTheme"/>
<!-- Restore Windows -->
<CheckBox
Grid.Row="6" Grid.Column="1"
Grid.Row="5" Grid.Column="1"
Content="{DynamicResource Text.Preference.RestoreTabs}"
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=Restore.IsEnabled, Mode=TwoWay}"/>
</Grid>
@ -170,7 +155,7 @@
<!-- Git Setting -->
<TabItem Header="{DynamicResource Text.Preference.Git}">
<Grid Margin="0,8">
<Grid Margin="8">
<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
@ -310,7 +295,7 @@
</TabItem>
<TabItem Header="{DynamicResource Text.Preference.Merger}">
<Grid Margin="0,8">
<Grid Margin="8">
<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>