|
@@ -84,9 +84,10 @@ public partial class MainWindow : Window
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
UpdateAdapterDetails(adapter);
|
|
UpdateAdapterDetails(adapter);
|
|
|
- SetStatus(adapter.HasLink
|
|
|
|
|
- ? $"已选择 {adapter.RecommendationLabel} 网卡,可切换到维护网络。{adapter.RecommendationReason}"
|
|
|
|
|
- : "当前网卡未检测到链路,请检查网线连接。", true);
|
|
|
|
|
|
|
+ if (!adapter.HasLink)
|
|
|
|
|
+ {
|
|
|
|
|
+ SetStatus("当前网卡未检测到链路,请检查网线连接。", true);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
UpdateButtonStates();
|
|
UpdateButtonStates();
|
|
|
}
|
|
}
|
|
@@ -280,10 +281,28 @@ public partial class MainWindow : Window
|
|
|
if (adapter is null)
|
|
if (adapter is null)
|
|
|
{
|
|
{
|
|
|
AdapterProbeTextBlock.Text = "-";
|
|
AdapterProbeTextBlock.Text = "-";
|
|
|
|
|
+ ApplyAdapterProbeStyle("未探测");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
AdapterProbeTextBlock.Text = $"{adapter.ProbeStatus} / {adapter.ProbeReason}";
|
|
AdapterProbeTextBlock.Text = $"{adapter.ProbeStatus} / {adapter.ProbeReason}";
|
|
|
|
|
+ ApplyAdapterProbeStyle(adapter.ProbeStatus);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void ApplyAdapterProbeStyle(string probeStatus)
|
|
|
|
|
+ {
|
|
|
|
|
+ var (background, foreground) = probeStatus switch
|
|
|
|
|
+ {
|
|
|
|
|
+ "可达" => ("#ECFDF5", "#065F46"),
|
|
|
|
|
+ "未通" or "不可达" => ("#FEF3C7", "#92400E"),
|
|
|
|
|
+ _ => ("#F3F4F6", "#374151"),
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ var backgroundBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(background));
|
|
|
|
|
+ var foregroundBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(foreground));
|
|
|
|
|
+ AdapterProbeBorder.Background = backgroundBrush;
|
|
|
|
|
+ AdapterProbeTitleTextBlock.Foreground = foregroundBrush;
|
|
|
|
|
+ AdapterProbeTextBlock.Foreground = foregroundBrush;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void OpenDeviceDetailsWindow(string baseAddress, string localIPv4)
|
|
private void OpenDeviceDetailsWindow(string baseAddress, string localIPv4)
|