mirror of https://github.com/2dust/v2rayN
Improved ModifyFontSize
parent
3cc75cd46d
commit
626ebfe65d
|
@ -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>(),
|
||||||
|
|
|
@ -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 New Issue