diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 6b783a210..26b89be86 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -43,6 +43,8 @@ namespace Flow.Launcher.Infrastructure.UserSettings public bool UseSound { get; set; } = true; public bool UseClock { get; set; } = true; public bool UseDate { get; set; } = false; + public string TimeFormat { get; set; } = "hh:mm tt "; + public string DateFormat { get; set; } = "MM'/'dd ddd"; public bool FirstLaunch { get; set; } = true; public int CustomExplorerIndex { get; set; } = 0; diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 080486c5e..bc18d8dbc 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -63,24 +63,7 @@ namespace Flow.Launcher } private void Timer_Tick(object sender, EventArgs e) { - if (_settings.UseClock == true) - { - ClockBox.Text = System.DateTime.Now.ToString("tt hh:mm"); - } - else if(_settings.UseClock == false) - { - ClockBox.Visibility = Visibility.Collapsed; - } - if (_settings.UseDate == true) - { - DateBox.Text = System.DateTime.Now.ToString("MM/dd ddd"); - } - else if (_settings.UseDate == false) - { - DateBox.Visibility = Visibility.Collapsed; - } - - + ClockDisplay(); } public void ClockDisplay() @@ -88,7 +71,7 @@ namespace Flow.Launcher if (_settings.UseClock == true) { ClockBox.Visibility = Visibility.Visible; - ClockBox.Text = System.DateTime.Now.ToString("tt hh:mm"); + ClockBox.Text = System.DateTime.Now.ToString(_settings.TimeFormat); } else if (_settings.UseClock == false) { @@ -97,7 +80,7 @@ namespace Flow.Launcher if (_settings.UseDate == true) { DateBox.Visibility = Visibility.Visible; - DateBox.Text = System.DateTime.Now.ToString("MM/dd ddd"); + DateBox.Text = System.DateTime.Now.ToString(_settings.DateFormat); } else if (_settings.UseDate == false) { diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index ca310fce8..0c92f073f 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -1,17 +1,16 @@ + ItemsSource="{Binding TimeFormatList}" + SelectedValue="{Binding Settings.TimeFormat}"/> + ItemsSource="{Binding DateFormatList}" + SelectedValue="{Binding Settings.DateFormat}" + /> TimeFormatList { get; set; } = new List() + { + "hh:mm", + "HH:mm", + "tt hh:mm", + "hh:mm tt" + }; + + public List DateFormatList { get; set; } = new List() + { + "MM'/'dd dddd", + "MM'/'dd ddd", + "MM'/'dd", + "dd'/'MM", + "ddd MM'/'dd", + "dddd MM'/'dd", + "dddd" + }; + public double WindowWidthSize { get => Settings.WindowSize;