fix:issue #339
This commit is contained in:
@@ -709,7 +709,49 @@ namespace Ink_Canvas
|
|||||||
BlackBoardWaterMark.Visibility = Visibility.Collapsed;
|
BlackBoardWaterMark.Visibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
_ = UpdateChickenSoupTextAsync();
|
try
|
||||||
|
{
|
||||||
|
_ = UpdateChickenSoupTextAsync();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"进入白板模式时更新名言失败: {ex.Message}", LogHelper.LogType.Warning);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
if (Settings.Appearance.EnableChickenSoupInWhiteboardMode && Settings.Appearance.ChickenSoupSource != 3)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (Settings.Appearance.ChickenSoupSource == 0)
|
||||||
|
{
|
||||||
|
int randChickenSoupIndex = new Random().Next(ChickenSoup.OSUPlayerYuLu.Length);
|
||||||
|
BlackBoardWaterMark.Text = ChickenSoup.OSUPlayerYuLu[randChickenSoupIndex];
|
||||||
|
}
|
||||||
|
else if (Settings.Appearance.ChickenSoupSource == 1)
|
||||||
|
{
|
||||||
|
int randChickenSoupIndex = new Random().Next(ChickenSoup.MingYanJingJu.Length);
|
||||||
|
BlackBoardWaterMark.Text = ChickenSoup.MingYanJingJu[randChickenSoupIndex];
|
||||||
|
}
|
||||||
|
else if (Settings.Appearance.ChickenSoupSource == 2)
|
||||||
|
{
|
||||||
|
int randChickenSoupIndex = new Random().Next(ChickenSoup.GaoKaoPhrases.Length);
|
||||||
|
BlackBoardWaterMark.Text = ChickenSoup.GaoKaoPhrases[randChickenSoupIndex];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
BlackBoardWaterMark.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (Settings.Appearance.EnableChickenSoupInWhiteboardMode && Settings.Appearance.ChickenSoupSource == 3)
|
||||||
|
{
|
||||||
|
BlackBoardWaterMark.Text = "一言功能不可用";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Settings.Canvas.UsingWhiteboard)
|
if (Settings.Canvas.UsingWhiteboard)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -360,7 +360,18 @@ namespace Ink_Canvas
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var clientObj = HitokotoHttpClient.Value;
|
object clientObj = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
clientObj = HitokotoHttpClient.Value;
|
||||||
|
}
|
||||||
|
catch (Exception initEx)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"HTTP 客户端初始化失败: {initEx.Message}", LogHelper.LogType.Warning);
|
||||||
|
BlackBoardWaterMark.Text = "一言功能不可用(缺少 System.Net.Http)";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (clientObj == null || !(clientObj is HttpClient client))
|
if (clientObj == null || !(clientObj is HttpClient client))
|
||||||
{
|
{
|
||||||
BlackBoardWaterMark.Text = "一言功能不可用(缺少 System.Net.Http)";
|
BlackBoardWaterMark.Text = "一言功能不可用(缺少 System.Net.Http)";
|
||||||
|
|||||||
Reference in New Issue
Block a user