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;
}
var lst = services.Split(Environment.NewLine).Where(t => t.Length > 0 && t.Contains('*') == false);
return lst.ToList();
var lst = services.Split(Environment.NewLine);
return lst.Length > 0 ? LstInterface.Intersect(lst).ToList() : LstInterface;
}
}
}

View file

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

View file

@ -303,7 +303,7 @@ namespace ServiceLib.ViewModels
{
if (!blWindowsShutDown)
{
_updateView?.Invoke(EViewAction.Shutdown, false);
_updateView?.Invoke(EViewAction.Shutdown, null);
}
}
}
@ -329,9 +329,9 @@ namespace ServiceLib.ViewModels
_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

View file

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

View file

@ -31,7 +31,6 @@ namespace v2rayN.Desktop.ViewModels
{
ModifyTheme();
ModifyFontFamily();
ModifyFontSize();
}
private void BindingUI()
@ -68,10 +67,11 @@ namespace v2rayN.Desktop.ViewModels
y => y > 0)
.Subscribe(c =>
{
if (_config.UiItem.CurrentFontSize != CurrentFontSize && CurrentFontSize >= Global.MinFontSize)
if (CurrentFontSize >= Global.MinFontSize)
{
_config.UiItem.CurrentFontSize = CurrentFontSize;
ModifyFontSize();
double size = CurrentFontSize;
ModifyFontSize(size);
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(
x.OfType<Button>(),
x.OfType<TextBox>(),

View file

@ -223,10 +223,6 @@ 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,7 +47,6 @@ 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);
@ -122,10 +121,14 @@ namespace v2rayN.ViewModels
y => y > 0)
.Subscribe(c =>
{
if (_config.UiItem.CurrentFontSize != CurrentFontSize && CurrentFontSize >= Global.MinFontSize)
if (CurrentFontSize >= Global.MinFontSize)
{
_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);
}
});
@ -155,14 +158,6 @@ 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();