Browse Source

Hide to tray when closing the window

https://github.com/2dust/v2rayN/issues/6076
pull/6080/head
2dust 6 days ago
parent
commit
8f6d443104
  1. 3
      v2rayN/ServiceLib/Models/ConfigItems.cs
  2. 9
      v2rayN/ServiceLib/Resx/ResUI.Designer.cs
  3. 3
      v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx
  4. 3
      v2rayN/ServiceLib/Resx/ResUI.resx
  5. 3
      v2rayN/ServiceLib/Resx/ResUI.ru.resx
  6. 3
      v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx
  7. 3
      v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx
  8. 2
      v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs
  9. 3
      v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs
  10. 4
      v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs
  11. 12
      v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml
  12. 1
      v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs

3
v2rayN/ServiceLib/Models/ConfigItems.cs

@ -80,7 +80,7 @@
public bool IgnoreGeoUpdateCore { get; set; } = true;
public int AutoUpdateInterval { get; set; }
public bool EnableSecurityProtocolTls13 { get; set; }
public int TrayMenuServersLimit { get; set; } = 20;
@ -116,6 +116,7 @@
public bool EnableDragDropSort { get; set; }
public bool DoubleClick2Activate { get; set; }
public bool AutoHideStartup { get; set; }
public bool Hide2TrayWhenClose { get; set; }
public List<ColumnItem> MainColumnItem { get; set; }
public bool ShowInTaskbar { get; set; }
}

9
v2rayN/ServiceLib/Resx/ResUI.Designer.cs generated

@ -3103,6 +3103,15 @@ namespace ServiceLib.Resx {
}
}
/// <summary>
/// 查找类似 Hide to tray when closing the window 的本地化字符串。
/// </summary>
public static string TbSettingsHide2TrayWhenClose {
get {
return ResourceManager.GetString("TbSettingsHide2TrayWhenClose", resourceCulture);
}
}
/// <summary>
/// 查找类似 HTTP Port 的本地化字符串。
/// </summary>

3
v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx

@ -1387,4 +1387,7 @@
<data name="TransportExtraTip" xml:space="preserve">
<value>XHTTP Extra raw JSON, format: { XHTTPObject }</value>
</data>
<data name="TbSettingsHide2TrayWhenClose" xml:space="preserve">
<value>Hide to tray when closing the window</value>
</data>
</root>

3
v2rayN/ServiceLib/Resx/ResUI.resx

@ -1387,4 +1387,7 @@
<data name="TransportExtraTip" xml:space="preserve">
<value>XHTTP Extra raw JSON, format: { XHTTPObject }</value>
</data>
<data name="TbSettingsHide2TrayWhenClose" xml:space="preserve">
<value>Hide to tray when closing the window</value>
</data>
</root>

3
v2rayN/ServiceLib/Resx/ResUI.ru.resx

@ -1387,4 +1387,7 @@
<data name="TransportExtraTip" xml:space="preserve">
<value>XHTTP Extra raw JSON, format: { XHTTPObject }</value>
</data>
<data name="TbSettingsHide2TrayWhenClose" xml:space="preserve">
<value>Hide to tray when closing the window</value>
</data>
</root>

3
v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx

@ -1384,4 +1384,7 @@
<data name="TransportExtraTip" xml:space="preserve">
<value>XHTTP Extra 原始 JSON,格式: { XHTTPObject }</value>
</data>
<data name="TbSettingsHide2TrayWhenClose" xml:space="preserve">
<value>关闭窗口时隐藏至托盘</value>
</data>
</root>

3
v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx

@ -1384,4 +1384,7 @@
<data name="TransportExtraTip" xml:space="preserve">
<value>XHTTP Extra 原始 JSON,格式: { XHTTPObject }</value>
</data>
<data name="TbSettingsHide2TrayWhenClose" xml:space="preserve">
<value>關閉視窗時隱藏至托盤</value>
</data>
</root>

2
v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs

@ -267,7 +267,7 @@ namespace ServiceLib.ViewModels
var filesList = (new DirectoryInfo(toPath)).GetFiles().Select(u => u.FullName).ToList();
foreach (var file in filesList)
{
await Utils.SetLinuxChmod(Path.Combine(toPath, item.CoreType));
await Utils.SetLinuxChmod(Path.Combine(toPath, item.CoreType.ToLower()));
}
}

3
v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs

@ -53,6 +53,7 @@ namespace ServiceLib.ViewModels
[Reactive] public bool EnableUpdateSubOnlyRemarksExist { get; set; }
[Reactive] public bool EnableSecurityProtocolTls13 { get; set; }
[Reactive] public bool AutoHideStartup { get; set; }
[Reactive] public bool Hide2TrayWhenClose { get; set; }
[Reactive] public bool EnableDragDropSort { get; set; }
[Reactive] public bool DoubleClick2Activate { get; set; }
[Reactive] public int AutoUpdateInterval { get; set; }
@ -166,6 +167,7 @@ namespace ServiceLib.ViewModels
EnableUpdateSubOnlyRemarksExist = _config.UiItem.EnableUpdateSubOnlyRemarksExist;
EnableSecurityProtocolTls13 = _config.GuiItem.EnableSecurityProtocolTls13;
AutoHideStartup = _config.UiItem.AutoHideStartup;
Hide2TrayWhenClose = _config.UiItem.Hide2TrayWhenClose;
EnableDragDropSort = _config.UiItem.EnableDragDropSort;
DoubleClick2Activate = _config.UiItem.DoubleClick2Activate;
AutoUpdateInterval = _config.GuiItem.AutoUpdateInterval;
@ -316,6 +318,7 @@ namespace ServiceLib.ViewModels
_config.UiItem.EnableUpdateSubOnlyRemarksExist = EnableUpdateSubOnlyRemarksExist;
_config.GuiItem.EnableSecurityProtocolTls13 = EnableSecurityProtocolTls13;
_config.UiItem.AutoHideStartup = AutoHideStartup;
_config.UiItem.Hide2TrayWhenClose = Hide2TrayWhenClose;
_config.GuiItem.AutoUpdateInterval = AutoUpdateInterval;
_config.UiItem.EnableDragDropSort = EnableDragDropSort;
_config.UiItem.DoubleClick2Activate = DoubleClick2Activate;

4
v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs

@ -382,7 +382,7 @@ namespace v2rayN.Desktop.Views
#endregion Event
#region UI
public void ShowHideWindow(bool? blShow)
{
var bl = blShow ?? !_config.UiItem.ShowInTaskbar;
@ -398,7 +398,7 @@ namespace v2rayN.Desktop.Views
}
else
{
if (Utils.IsWindows())
if (_config.UiItem.Hide2TrayWhenClose)
{
this.Hide();
}

12
v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml

@ -489,6 +489,18 @@
HorizontalAlignment="Left"
Classes="Margin8" />
<TextBlock
Grid.Row="9"
Grid.Column="0"
VerticalAlignment="Center"
Classes="Margin8"
Text="{x:Static resx:ResUI.TbSettingsHide2TrayWhenClose}" />
<ToggleSwitch
x:Name="togHide2TrayWhenClose"
Grid.Row="9"
Grid.Column="1"
HorizontalAlignment="Left"
Classes="Margin8" />
<TextBlock

1
v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs

@ -131,6 +131,7 @@ namespace v2rayN.Desktop.Views
this.Bind(ViewModel, vm => vm.EnableUpdateSubOnlyRemarksExist, v => v.togEnableUpdateSubOnlyRemarksExist.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.EnableSecurityProtocolTls13, v => v.togEnableSecurityProtocolTls13.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.AutoHideStartup, v => v.togAutoHideStartup.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.Hide2TrayWhenClose, v => v.togHide2TrayWhenClose.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.DoubleClick2Activate, v => v.togDoubleClick2Activate.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.AutoUpdateInterval, v => v.txtautoUpdateInterval.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.CurrentFontFamily, v => v.cmbcurrentFontFamily.SelectedValue).DisposeWith(disposables);

Loading…
Cancel
Save