Compare commits

..

3 commits

Author SHA1 Message Date
2dust
aae5906311 Fix GetListNetworkServices
Some checks are pending
release Linux / build (Release) (push) Waiting to run
release macOS / build (Release) (push) Waiting to run
release Windows / build (Release) (push) Waiting to run
2025-01-05 12:24:14 +08:00
2dust
4a7bafd011 Fix Linux restore backup function
Fixed the issue that the guiNConfig.json file cannot be restored in the backup and restore function
2025-01-05 10:22:18 +08:00
2dust
626ebfe65d Improved ModifyFontSize 2025-01-04 20:42:42 +08:00
7 changed files with 30 additions and 23 deletions

View file

@ -93,8 +93,9 @@
{
return LstInterface;
}
var lst = services.Split(Environment.NewLine);
return lst.Length > 0 ? LstInterface.Intersect(lst).ToList() : LstInterface;
var lst = services.Split(Environment.NewLine).Where(t => t.Length > 0 && t.Contains('*') == false);
return lst.ToList();
}
}
}

View file

@ -154,7 +154,7 @@ namespace ServiceLib.ViewModels
ProcUtils.ProcessStart(upgradeFileName, Global.RebootAs, Utils.StartupPath());
}
}
service?.Shutdown();
service?.Shutdown(true);
}
else
{

View file

@ -303,7 +303,7 @@ namespace ServiceLib.ViewModels
{
if (!blWindowsShutDown)
{
_updateView?.Invoke(EViewAction.Shutdown, null);
_updateView?.Invoke(EViewAction.Shutdown, false);
}
}
}
@ -329,9 +329,9 @@ namespace ServiceLib.ViewModels
_updateView?.Invoke(EViewAction.ShowHideWindow, blShow);
}
public void Shutdown()
public void Shutdown(bool byUser)
{
_updateView?.Invoke(EViewAction.Shutdown, null);
_updateView?.Invoke(EViewAction.Shutdown, byUser);
}
#endregion Actions

View file

@ -71,12 +71,8 @@ public partial class App : Application
private async void MenuExit_Click(object? sender, EventArgs e)
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
var service = Locator.Current.GetService<MainWindowViewModel>();
if (service != null) await service.MyAppExitAsync(false);
desktop.Shutdown();
}
var service = Locator.Current.GetService<MainWindowViewModel>();
if (service != null) await service.MyAppExitAsync(true);
service?.Shutdown(true);
}
}

View file

@ -31,6 +31,7 @@ namespace v2rayN.Desktop.ViewModels
{
ModifyTheme();
ModifyFontFamily();
ModifyFontSize();
}
private void BindingUI()
@ -67,11 +68,10 @@ namespace v2rayN.Desktop.ViewModels
y => y > 0)
.Subscribe(c =>
{
if (CurrentFontSize >= Global.MinFontSize)
if (_config.UiItem.CurrentFontSize != CurrentFontSize && CurrentFontSize >= Global.MinFontSize)
{
_config.UiItem.CurrentFontSize = CurrentFontSize;
double size = CurrentFontSize;
ModifyFontSize(size);
ModifyFontSize();
ConfigHandler.SaveConfig(_config);
}
});
@ -100,8 +100,9 @@ namespace v2rayN.Desktop.ViewModels
}
}
private void ModifyFontSize(double size)
private void ModifyFontSize()
{
double size = CurrentFontSize;
Style style = new(x => Selectors.Or(
x.OfType<Button>(),
x.OfType<TextBox>(),

View file

@ -223,6 +223,10 @@ namespace v2rayN.Desktop.Views
break;
case EViewAction.Shutdown:
if (obj != null && _blCloseByUser == false)
{
_blCloseByUser = (bool)obj;
}
StorageUI();
if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{

View file

@ -47,6 +47,7 @@ namespace v2rayN.ViewModels
private void RestoreUI()
{
ModifyTheme();
ModifyFontSize();
if (!_config.UiItem.ColorPrimaryName.IsNullOrEmpty())
{
var swatch = new SwatchesProvider().Swatches.FirstOrDefault(t => t.Name == _config.UiItem.ColorPrimaryName);
@ -121,14 +122,10 @@ namespace v2rayN.ViewModels
y => y > 0)
.Subscribe(c =>
{
if (CurrentFontSize >= Global.MinFontSize)
if (_config.UiItem.CurrentFontSize != CurrentFontSize && CurrentFontSize >= Global.MinFontSize)
{
_config.UiItem.CurrentFontSize = CurrentFontSize;
double size = (long)CurrentFontSize;
Application.Current.Resources["StdFontSize"] = size;
Application.Current.Resources["StdFontSize1"] = size + 1;
Application.Current.Resources["StdFontSize-1"] = size - 1;
ModifyFontSize();
ConfigHandler.SaveConfig(_config);
}
});
@ -158,6 +155,14 @@ namespace v2rayN.ViewModels
WindowsUtils.SetDarkBorder(Application.Current.MainWindow, isDarkTheme);
}
private void ModifyFontSize()
{
double size = (long)CurrentFontSize;
Application.Current.Resources["StdFontSize"] = size;
Application.Current.Resources["StdFontSize1"] = size + 1;
Application.Current.Resources["StdFontSize-1"] = size - 1;
}
public void ChangePrimaryColor(System.Windows.Media.Color color)
{
var theme = _paletteHelper.GetTheme();