Skip to content

Commit

Permalink
做了读取画笔颜色配置文件时的错误处理
Browse files Browse the repository at this point in the history
  • Loading branch information
STBBRD committed Nov 4, 2023
1 parent acc3a0c commit 228b687
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions Ink Canvas/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@ private void TimerKillProcess_Elapsed(object sender, ElapsedEventArgs e)
}
}
catch { }
}
}

#endregion Timer

#region Ink Canvas Functions

DrawingAttributes drawingAttributes;
private void loadPenCanvas()
{
Expand Down Expand Up @@ -5888,11 +5888,15 @@ private void SetLightColors()
{
if (File.Exists(App.RootPath + "Colors\\Light.ini"))
{
string[] lightColors = File.ReadAllLines(App.RootPath + "Colors\\Light.ini");
BtnColorRed.Background = new SolidColorBrush(StringToColor(lightColors[0]));
BtnColorGreen.Background = new SolidColorBrush(StringToColor(lightColors[1]));
BtnColorBlue.Background = new SolidColorBrush(StringToColor(lightColors[2]));
BtnColorYellow.Background = new SolidColorBrush(StringToColor(lightColors[3]));
try
{
string[] lightColors = File.ReadAllLines(App.RootPath + "Colors\\Light.ini");
BtnColorRed.Background = new SolidColorBrush(StringToColor(lightColors[0]));
BtnColorGreen.Background = new SolidColorBrush(StringToColor(lightColors[1]));
BtnColorBlue.Background = new SolidColorBrush(StringToColor(lightColors[2]));
BtnColorYellow.Background = new SolidColorBrush(StringToColor(lightColors[3]));
}
catch (Exception) { ShowNotification("读取亮色画笔颜色配置文件时遇到问题"); }
}
else
{
Expand All @@ -5907,11 +5911,15 @@ private void SetDarkColors()
{
if (File.Exists(App.RootPath + "Colors\\Dark.ini"))
{
string[] darkColors = File.ReadAllLines(App.RootPath + "Colors\\Dark.ini");
BtnColorRed.Background = new SolidColorBrush(StringToColor(darkColors[0]));
BtnColorGreen.Background = new SolidColorBrush(StringToColor(darkColors[1]));
BtnColorBlue.Background = new SolidColorBrush(StringToColor(darkColors[2]));
BtnColorYellow.Background = new SolidColorBrush(StringToColor(darkColors[3]));
try
{
string[] darkColors = File.ReadAllLines(App.RootPath + "Colors\\Dark.ini");
BtnColorRed.Background = new SolidColorBrush(StringToColor(darkColors[0]));
BtnColorGreen.Background = new SolidColorBrush(StringToColor(darkColors[1]));
BtnColorBlue.Background = new SolidColorBrush(StringToColor(darkColors[2]));
BtnColorYellow.Background = new SolidColorBrush(StringToColor(darkColors[3]));
}
catch (Exception) { ShowNotification("读取深色画笔颜色配置文件时遇到问题"); }
}
else
{
Expand Down

0 comments on commit 228b687

Please sign in to comment.