Compare commits

..

No commits in common. "aae5906311aa76f4667eb772646b62c1678763ca" and "3cc75cd46d328a9f40a5982f8b40598c51941c81" have entirely different histories.

7 changed files with 23 additions and 30 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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