From 4aaa268be79f55e1cf0fa1e1e00fceaeb007e648 Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Thu, 24 Nov 2022 15:30:57 +0800 Subject: [PATCH] cache culture info --- Flow.Launcher/ViewModel/SettingWindowViewModel.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index 60dc95e2e..c00fed851 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -56,11 +56,14 @@ namespace Flow.Launcher.ViewModel OnPropertyChanged(nameof(ClockText)); break; case nameof(Settings.Language): + Culture = new CultureInfo(Settings.Language); OnPropertyChanged(nameof(ClockText)); OnPropertyChanged(nameof(DateText)); break; } }; + + Culture = new CultureInfo(Settings.Language); } 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 { @@ -506,10 +509,9 @@ namespace Flow.Launcher.ViewModel set { Settings.DateFormat = value; } } - public string ClockText => DateTime.Now.ToString(TimeFormat, cultureInfo); - - public string DateText => DateTime.Now.ToString(DateFormat, cultureInfo); + public string ClockText => DateTime.Now.ToString(TimeFormat, Culture); + public string DateText => DateTime.Now.ToString(DateFormat, Culture); public double WindowWidthSize {