diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index 7e029910f..bdc858527 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -519,6 +519,10 @@ namespace Flow.Launcher { if (DateFormat != null && TimeFormat != null) { + if (DateFormat.SelectedIndex == -1 || TimeFormat.SelectedIndex == -1) + { + return; + } viewModel.UpdateDateTimeDisplayList(DateFormat.SelectedIndex, TimeFormat.SelectedIndex); DateFormat.Items.Refresh(); TimeFormat.Items.Refresh(); // selected = -1 diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index 302310e43..5066d0ca6 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -52,7 +52,7 @@ namespace Flow.Launcher.ViewModel int tmp = 0; TimeFormatIndex = (tmp = TimeFormatList.FindIndex(x => x.Equals(Settings.TimeFormat))) >= 0 ? tmp : 0; DateFormatIndex = (tmp = DateFormatList.FindIndex(x => x.Equals(Settings.DateFormat))) >= 0 ? tmp : 0; - + // TODO: CurrentCulture may equal to settings.language when this is constructed TimeFormatDisplayList = TimeFormatList.Select(x => DateTime.Now.ToString(x, CultureInfo.CurrentCulture)).ToList(); DateFormatDisplayList = DateFormatList.Select(x => DateTime.Now.ToString(x, CultureInfo.CurrentCulture)).ToList(); UpdateSettingsDateTimeFormat(); // just in case something wrong @@ -492,8 +492,6 @@ namespace Flow.Launcher.ViewModel public void UpdateDateTimeDisplayList(int dateIndex, int timeIndex) { - if (dateIndex == -1 || timeIndex == -1) - return; DateFormatIndex = dateIndex; TimeFormatIndex = timeIndex;