Skip to content

Commit 7ae6f2a

Browse files
committed
- Add Timeformat to changable list
1 parent 8e6af08 commit 7ae6f2a

File tree

4 files changed

+35
-38
lines changed

4 files changed

+35
-38
lines changed

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ public string Language
4343
public bool UseSound { get; set; } = true;
4444
public bool UseClock { get; set; } = true;
4545
public bool UseDate { get; set; } = false;
46+
public string TimeFormat { get; set; } = "hh:mm tt ";
47+
public string DateFormat { get; set; } = "MM'/'dd ddd";
4648
public bool FirstLaunch { get; set; } = true;
4749

4850
public int CustomExplorerIndex { get; set; } = 0;

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -63,32 +63,15 @@ public MainWindow()
6363
}
6464
private void Timer_Tick(object sender, EventArgs e)
6565
{
66-
if (_settings.UseClock == true)
67-
{
68-
ClockBox.Text = System.DateTime.Now.ToString("tt hh:mm");
69-
}
70-
else if(_settings.UseClock == false)
71-
{
72-
ClockBox.Visibility = Visibility.Collapsed;
73-
}
74-
if (_settings.UseDate == true)
75-
{
76-
DateBox.Text = System.DateTime.Now.ToString("MM/dd ddd");
77-
}
78-
else if (_settings.UseDate == false)
79-
{
80-
DateBox.Visibility = Visibility.Collapsed;
81-
}
82-
83-
66+
ClockDisplay();
8467
}
8568

8669
public void ClockDisplay()
8770
{
8871
if (_settings.UseClock == true)
8972
{
9073
ClockBox.Visibility = Visibility.Visible;
91-
ClockBox.Text = System.DateTime.Now.ToString("tt hh:mm");
74+
ClockBox.Text = System.DateTime.Now.ToString(_settings.TimeFormat);
9275
}
9376
else if (_settings.UseClock == false)
9477
{
@@ -97,7 +80,7 @@ public void ClockDisplay()
9780
if (_settings.UseDate == true)
9881
{
9982
DateBox.Visibility = Visibility.Visible;
100-
DateBox.Text = System.DateTime.Now.ToString("MM/dd ddd");
83+
DateBox.Text = System.DateTime.Now.ToString(_settings.DateFormat);
10184
}
10285
else if (_settings.UseDate == false)
10386
{

Flow.Launcher/SettingWindow.xaml

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
<Window
22
x:Class="Flow.Launcher.SettingWindow"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5-
xmlns:converters="clr-namespace:Flow.Launcher.Converters"
64
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7-
xmlns:flowlauncher="clr-namespace:Flow.Launcher"
8-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9-
xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
10-
xmlns:svgc="http://sharpvectors.codeplex.com/svgc/"
11-
xmlns:sys="clr-namespace:System;assembly=mscorlib"
5+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
126
xmlns:ui="http://schemas.modernwpf.com/2019"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
xmlns:flowlauncher="clr-namespace:Flow.Launcher"
9+
xmlns:converters="clr-namespace:Flow.Launcher.Converters"
1310
xmlns:userSettings="clr-namespace:Flow.Launcher.Infrastructure.UserSettings;assembly=Flow.Launcher.Infrastructure"
1411
xmlns:vm="clr-namespace:Flow.Launcher.ViewModel"
12+
xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
13+
xmlns:sys="clr-namespace:System;assembly=mscorlib"
1514
Title="{DynamicResource flowlauncher_settings}"
1615
Width="1000"
1716
Height="700"
@@ -1905,12 +1904,9 @@
19051904
MinWidth="180"
19061905
VerticalAlignment="Center"
19071906
Margin="0,0,18,0"
1908-
DisplayMemberPath="Display"
19091907
FontSize="14"
1910-
ItemsSource="{Binding ColorSchemes}"
1911-
SelectedValue="{Binding Settings.ColorScheme}"
1912-
SelectedValuePath="Value"
1913-
SelectionChanged="ColorSchemeSelectedIndexChanged" />
1908+
ItemsSource="{Binding TimeFormatList}"
1909+
SelectedValue="{Binding Settings.TimeFormat}"/>
19141910
<ui:ToggleSwitch
19151911

19161912
IsOn="{Binding UseClock, Mode=TwoWay}"
@@ -1943,14 +1939,11 @@
19431939
MinWidth="180"
19441940
VerticalAlignment="Center"
19451941
Margin="0,0,18,0"
1946-
DisplayMemberPath="Display"
19471942
FontSize="14"
1948-
ItemsSource="{Binding ColorSchemes}"
1949-
SelectedValue="{Binding Settings.ColorScheme}"
1950-
SelectedValuePath="Value"
1951-
SelectionChanged="ColorSchemeSelectedIndexChanged" />
1943+
ItemsSource="{Binding DateFormatList}"
1944+
SelectedValue="{Binding Settings.DateFormat}"
1945+
/>
19521946
<ui:ToggleSwitch
1953-
19541947
IsOn="{Binding UseDate, Mode=TwoWay}"
19551948
OffContent="{DynamicResource disable}"
19561949
OnContent="{DynamicResource enable}"

Flow.Launcher/ViewModel/SettingWindowViewModel.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,25 @@ public List<ColorScheme> ColorSchemes
361361
}
362362
}
363363

364+
public List<string> TimeFormatList { get; set; } = new List<string>()
365+
{
366+
"hh:mm",
367+
"HH:mm",
368+
"tt hh:mm",
369+
"hh:mm tt"
370+
};
371+
372+
public List<string> DateFormatList { get; set; } = new List<string>()
373+
{
374+
"MM'/'dd dddd",
375+
"MM'/'dd ddd",
376+
"MM'/'dd",
377+
"dd'/'MM",
378+
"ddd MM'/'dd",
379+
"dddd MM'/'dd",
380+
"dddd"
381+
};
382+
364383
public double WindowWidthSize
365384
{
366385
get => Settings.WindowSize;

0 commit comments

Comments
 (0)