mirror of
https://github.com/2dust/v2rayN.git
synced 2026-03-09 01:43: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;
|
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());
|
ProcUtils.ProcessStart(upgradeFileName, Global.RebootAs, Utils.StartupPath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
service?.Shutdown();
|
service?.Shutdown(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -303,7 +303,7 @@ namespace ServiceLib.ViewModels
|
||||||
{
|
{
|
||||||
if (!blWindowsShutDown)
|
if (!blWindowsShutDown)
|
||||||
{
|
{
|
||||||
_updateView?.Invoke(EViewAction.Shutdown, null);
|
_updateView?.Invoke(EViewAction.Shutdown, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -329,9 +329,9 @@ namespace ServiceLib.ViewModels
|
||||||
_updateView?.Invoke(EViewAction.ShowHideWindow, blShow);
|
_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
|
#endregion Actions
|
||||||
|
|
|
||||||
|
|
@ -71,12 +71,8 @@ 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>();
|
||||||
{
|
if (service != null) await service.MyAppExitAsync(true);
|
||||||
var service = Locator.Current.GetService<MainWindowViewModel>();
|
service?.Shutdown(true);
|
||||||
if (service != null) await service.MyAppExitAsync(false);
|
|
||||||
|
|
||||||
desktop.Shutdown();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -31,6 +31,7 @@ namespace v2rayN.Desktop.ViewModels
|
||||||
{
|
{
|
||||||
ModifyTheme();
|
ModifyTheme();
|
||||||
ModifyFontFamily();
|
ModifyFontFamily();
|
||||||
|
ModifyFontSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BindingUI()
|
private void BindingUI()
|
||||||
|
|
@ -67,11 +68,10 @@ namespace v2rayN.Desktop.ViewModels
|
||||||
y => y > 0)
|
y => y > 0)
|
||||||
.Subscribe(c =>
|
.Subscribe(c =>
|
||||||
{
|
{
|
||||||
if (CurrentFontSize >= Global.MinFontSize)
|
if (_config.UiItem.CurrentFontSize != CurrentFontSize && CurrentFontSize >= Global.MinFontSize)
|
||||||
{
|
{
|
||||||
_config.UiItem.CurrentFontSize = CurrentFontSize;
|
_config.UiItem.CurrentFontSize = CurrentFontSize;
|
||||||
double size = CurrentFontSize;
|
ModifyFontSize();
|
||||||
ModifyFontSize(size);
|
|
||||||
ConfigHandler.SaveConfig(_config);
|
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(
|
Style style = new(x => Selectors.Or(
|
||||||
x.OfType<Button>(),
|
x.OfType<Button>(),
|
||||||
x.OfType<TextBox>(),
|
x.OfType<TextBox>(),
|
||||||
|
|
|
||||||
|
|
@ -223,6 +223,10 @@ 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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ 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);
|
||||||
|
|
@ -121,14 +122,10 @@ namespace v2rayN.ViewModels
|
||||||
y => y > 0)
|
y => y > 0)
|
||||||
.Subscribe(c =>
|
.Subscribe(c =>
|
||||||
{
|
{
|
||||||
if (CurrentFontSize >= Global.MinFontSize)
|
if (_config.UiItem.CurrentFontSize != CurrentFontSize && CurrentFontSize >= Global.MinFontSize)
|
||||||
{
|
{
|
||||||
_config.UiItem.CurrentFontSize = CurrentFontSize;
|
_config.UiItem.CurrentFontSize = CurrentFontSize;
|
||||||
double size = (long)CurrentFontSize;
|
ModifyFontSize();
|
||||||
Application.Current.Resources["StdFontSize"] = size;
|
|
||||||
Application.Current.Resources["StdFontSize1"] = size + 1;
|
|
||||||
Application.Current.Resources["StdFontSize-1"] = size - 1;
|
|
||||||
|
|
||||||
ConfigHandler.SaveConfig(_config);
|
ConfigHandler.SaveConfig(_config);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -158,6 +155,14 @@ 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();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue