diff --git a/Aria2Fast/MainWindow.xaml b/Aria2Fast/MainWindow.xaml
index 148ce1b..4701b51 100644
--- a/Aria2Fast/MainWindow.xaml
+++ b/Aria2Fast/MainWindow.xaml
@@ -2,6 +2,7 @@
x:Class="Aria2Fast.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:converter="clr-namespace:Aria2Fast.View.Contver"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dialogs="clr-namespace:Aria2Fast.Dialogs"
xmlns:local="clr-namespace:Aria2Fast"
@@ -28,6 +29,7 @@
-->
+
@@ -36,6 +38,9 @@
+
+
+
@@ -219,7 +224,7 @@
Margin="5,0,5,0"
VerticalAlignment="Center"
Foreground="White"
- Text="{Binding Source={x:Static service:AppConfig.Instance}, Path=ConfigData.Aria2RpcHost}" />
+ Text="{Binding Source={x:Static service:AppConfig.Instance}, Path=ConfigData.Aria2RpcHost, Converter={StaticResource Aria2HostEmptyStringConverter}}" />
diff --git a/Aria2Fast/MainWindow.xaml.cs b/Aria2Fast/MainWindow.xaml.cs
index ccbedb4..c2379ac 100644
--- a/Aria2Fast/MainWindow.xaml.cs
+++ b/Aria2Fast/MainWindow.xaml.cs
@@ -198,18 +198,13 @@ private void UpdateConnectionStatus(LinkStatus status)
LinkStatusProgressBar.Visibility = Visibility.Collapsed;
myBrush.Color = (Color)ColorConverter.ConvertFromString("#ffed4014");
LinkStatusBorder.Background = myBrush;
-
- if (string.IsNullOrWhiteSpace(AppConfig.Instance.ConfigData.Aria2RpcHost))
- {
- Aria2RpcHostTextBlock.Text = "请在设置中添加Aria2Rpc地址";
- }
break;
case LinkStatus.Success:
LinkStatusProgressBar.IsIndeterminate = false;
LinkStatusProgressBar.Visibility = Visibility.Collapsed;
myBrush.Color = (Color)ColorConverter.ConvertFromString("#ff19be6b");
LinkStatusBorder.Background = myBrush;
-
+
break;
diff --git a/Aria2Fast/View/Contver/TextContver.cs b/Aria2Fast/View/Contver/TextContver.cs
new file mode 100644
index 0000000..59283ec
--- /dev/null
+++ b/Aria2Fast/View/Contver/TextContver.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace Aria2Fast.View.Contver
+{
+ class TextContver
+ {
+ }
+
+ public class Aria2HostEmptyStringConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ if (value is String && String.IsNullOrWhiteSpace(value as String))
+ {
+ return "请在设置中添加Aria2Rpc地址";
+ }
+ else
+ {
+ return value;
+ }
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ throw new NotSupportedException();
+ }
+ }
+}