cache culture info

This commit is contained in:
Vic 2022-11-24 15:30:57 +08:00
parent 0e6fbf236a
commit 4aaa268be7

View file

@ -56,11 +56,14 @@ namespace Flow.Launcher.ViewModel
OnPropertyChanged(nameof(ClockText)); OnPropertyChanged(nameof(ClockText));
break; break;
case nameof(Settings.Language): case nameof(Settings.Language):
Culture = new CultureInfo(Settings.Language);
OnPropertyChanged(nameof(ClockText)); OnPropertyChanged(nameof(ClockText));
OnPropertyChanged(nameof(DateText)); OnPropertyChanged(nameof(DateText));
break; break;
} }
}; };
Culture = new CultureInfo(Settings.Language);
} }
public Settings Settings { get; set; } public Settings Settings { get; set; }
@ -84,7 +87,7 @@ namespace Flow.Launcher.ViewModel
} }
} }
public CultureInfo cultureInfo => new CultureInfo(Settings.Language); public CultureInfo Culture { get; private set; }
public bool StartFlowLauncherOnSystemStartup public bool StartFlowLauncherOnSystemStartup
{ {
@ -506,10 +509,9 @@ namespace Flow.Launcher.ViewModel
set { Settings.DateFormat = value; } set { Settings.DateFormat = value; }
} }
public string ClockText => DateTime.Now.ToString(TimeFormat, cultureInfo); public string ClockText => DateTime.Now.ToString(TimeFormat, Culture);
public string DateText => DateTime.Now.ToString(DateFormat, cultureInfo);
public string DateText => DateTime.Now.ToString(DateFormat, Culture);
public double WindowWidthSize public double WindowWidthSize
{ {