diff --git a/AppTunnel/MainWindow.xaml b/AppTunnel/MainWindow.xaml index 702f82a..18ca72c 100644 --- a/AppTunnel/MainWindow.xaml +++ b/AppTunnel/MainWindow.xaml @@ -6,8 +6,8 @@ xmlns:vm="clr-namespace:AppTunnel.ViewModels" xmlns:model="clr-namespace:AppTunnel.Models" Title="TunnelX — Split Traffic Per App" - Width="580" Height="760" - MinWidth="540" MinHeight="680" + Width="620" Height="760" + MinWidth="580" MinHeight="680" WindowStartupLocation="CenterScreen" WindowStyle="None" AllowsTransparency="True" @@ -169,30 +169,42 @@ - + - + + + + - + - + + + + - + - + + + + - + - + + + + @@ -424,9 +436,12 @@ - + - + + + + diff --git a/AppTunnel/MainWindow.xaml.cs b/AppTunnel/MainWindow.xaml.cs index c9d263a..889a1a5 100644 --- a/AppTunnel/MainWindow.xaml.cs +++ b/AppTunnel/MainWindow.xaml.cs @@ -150,8 +150,8 @@ public partial class MainWindow : Window _trayIcon.Visible = true; _trayIcon.ShowBalloonTip( 2000, - "TunnelX", - "برنامه در System Tray فعال است. برای نمایش دوبار کلیک کنید.", + "TunnelX در پس‌زمینه فعال است", + "برای باز کردن پنجره، روی آیکن کنار ساعت دوبار کلیک کنید.", System.Windows.Forms.ToolTipIcon.Info); } } @@ -167,15 +167,15 @@ public partial class MainWindow : Window switch (state) { case ConnectionState.Connected: - ShowTrayNotification("TunnelX متصل شد", _viewModel.StatusText, + ShowTrayNotification("تونل فعال شد", GetConnectedTrayMessage(), System.Windows.Forms.ToolTipIcon.Info); break; case ConnectionState.Disconnected: - ShowTrayNotification("TunnelX قطع شد", _viewModel.StatusText, + ShowTrayNotification("تونل خاموش شد", "ارتباط امن متوقف شده و ترافیک دیگر از TunnelX عبور نمی‌کند.", System.Windows.Forms.ToolTipIcon.Info); break; case ConnectionState.Error: - ShowTrayNotification("خطا در اتصال TunnelX", _viewModel.StatusText, + ShowTrayNotification("اتصال برقرار نشد", GetErrorTrayMessage(), System.Windows.Forms.ToolTipIcon.Warning); break; } @@ -187,11 +187,31 @@ public partial class MainWindow : Window return; _updateNotificationShown = true; - ShowTrayNotification("بروزرسانی TunnelX آماده است", - _viewModel.UpdateStatusText, + ShowTrayNotification("نسخه جدید آماده است", + "از منوی System Tray یا بخش بروزرسانی، صفحه دانلود TunnelX را باز کنید.", System.Windows.Forms.ToolTipIcon.Info); } + private string GetConnectedTrayMessage() + { + var profileName = _viewModel.SelectedProfileName; + if (!string.IsNullOrWhiteSpace(profileName)) + return $"پروفایل «{profileName}» فعال است و ترافیک انتخاب‌شده از تونل عبور می‌کند."; + + return "ترافیک انتخاب‌شده از TunnelX عبور می‌کند."; + } + + private string GetErrorTrayMessage() + { + var status = _viewModel.StatusText?.Trim(); + if (string.IsNullOrWhiteSpace(status) || status == "خطا") + return "جزئیات خطا را در پنجره برنامه یا لاگ‌ها بررسی کنید."; + + return status.StartsWith("خطا", StringComparison.Ordinal) + ? status + : $"جزئیات: {status}"; + } + private void ShowTrayNotification(string title, string message, System.Windows.Forms.ToolTipIcon icon) { if (_trayIcon == null) return; diff --git a/AppTunnel/Resources/Theme.xaml b/AppTunnel/Resources/Theme.xaml index 5b3c9fa..4b7b56f 100644 --- a/AppTunnel/Resources/Theme.xaml +++ b/AppTunnel/Resources/Theme.xaml @@ -268,7 +268,7 @@ + Padding="6,6,6,4"> @@ -282,16 +282,22 @@