mirror of
https://github.com/2dust/v2rayN.git
synced 2026-03-03 06:33:03 +00:00
Compare commits
3 commits
3cc75cd46d
...
aae5906311
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aae5906311 | ||
|
|
4a7bafd011 | ||
|
|
626ebfe65d |
7 changed files with 30 additions and 23 deletions
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -154,7 +154,7 @@ namespace ServiceLib.ViewModels
|
|||
ProcUtils.ProcessStart(upgradeFileName, Global.RebootAs, Utils.StartupPath());
|
||||
}
|
||||
}
|
||||
service?.Shutdown();
|
||||
service?.Shutdown(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
@ -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>(),
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in a new issue