- Add Timeformat to changable list

This commit is contained in:
DB p 2022-09-05 15:48:10 +09:00
parent 8e6af08b4d
commit 7ae6f2ac7d
4 changed files with 35 additions and 38 deletions

View file

@ -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;

View file

@ -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)
{

View file

@ -1,17 +1,16 @@
<Window
x:Class="Flow.Launcher.SettingWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:Flow.Launcher.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:flowlauncher="clr-namespace:Flow.Launcher"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
xmlns:svgc="http://sharpvectors.codeplex.com/svgc/"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="http://schemas.modernwpf.com/2019"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:flowlauncher="clr-namespace:Flow.Launcher"
xmlns:converters="clr-namespace:Flow.Launcher.Converters"
xmlns:userSettings="clr-namespace:Flow.Launcher.Infrastructure.UserSettings;assembly=Flow.Launcher.Infrastructure"
xmlns:vm="clr-namespace:Flow.Launcher.ViewModel"
xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Title="{DynamicResource flowlauncher_settings}"
Width="1000"
Height="700"
@ -1905,12 +1904,9 @@
MinWidth="180"
VerticalAlignment="Center"
Margin="0,0,18,0"
DisplayMemberPath="Display"
FontSize="14"
ItemsSource="{Binding ColorSchemes}"
SelectedValue="{Binding Settings.ColorScheme}"
SelectedValuePath="Value"
SelectionChanged="ColorSchemeSelectedIndexChanged" />
ItemsSource="{Binding TimeFormatList}"
SelectedValue="{Binding Settings.TimeFormat}"/>
<ui:ToggleSwitch
IsOn="{Binding UseClock, Mode=TwoWay}"
@ -1943,14 +1939,11 @@
MinWidth="180"
VerticalAlignment="Center"
Margin="0,0,18,0"
DisplayMemberPath="Display"
FontSize="14"
ItemsSource="{Binding ColorSchemes}"
SelectedValue="{Binding Settings.ColorScheme}"
SelectedValuePath="Value"
SelectionChanged="ColorSchemeSelectedIndexChanged" />
ItemsSource="{Binding DateFormatList}"
SelectedValue="{Binding Settings.DateFormat}"
/>
<ui:ToggleSwitch
IsOn="{Binding UseDate, Mode=TwoWay}"
OffContent="{DynamicResource disable}"
OnContent="{DynamicResource enable}"

View file

@ -361,6 +361,25 @@ namespace Flow.Launcher.ViewModel
}
}
public List<string> TimeFormatList { get; set; } = new List<string>()
{
"hh:mm",
"HH:mm",
"tt hh:mm",
"hh:mm tt"
};
public List<string> DateFormatList { get; set; } = new List<string>()
{
"MM'/'dd dddd",
"MM'/'dd ddd",
"MM'/'dd",
"dd'/'MM",
"ddd MM'/'dd",
"dddd MM'/'dd",
"dddd"
};
public double WindowWidthSize
{
get => Settings.WindowSize;