mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
- Refresh Preview when Change Time/Date Format
This commit is contained in:
parent
7ae6f2ac7d
commit
7e0ef2a400
2 changed files with 73 additions and 47 deletions
|
|
@ -1,16 +1,16 @@
|
|||
<Window
|
||||
x:Class="Flow.Launcher.SettingWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
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: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:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:ui="http://schemas.modernwpf.com/2019"
|
||||
xmlns:userSettings="clr-namespace:Flow.Launcher.Infrastructure.UserSettings;assembly=Flow.Launcher.Infrastructure"
|
||||
xmlns:vm="clr-namespace:Flow.Launcher.ViewModel"
|
||||
Title="{DynamicResource flowlauncher_settings}"
|
||||
Width="1000"
|
||||
Height="700"
|
||||
|
|
@ -1554,14 +1554,8 @@
|
|||
Text="{DynamicResource hiThere}" />
|
||||
</Border>
|
||||
<StackPanel x:Name="ClockPanel" Style="{DynamicResource ClockPanel}">
|
||||
<TextBlock
|
||||
x:Name="DateBox"
|
||||
Style="{DynamicResource DateBox}"
|
||||
Text="09-01 Thu" />
|
||||
<TextBlock
|
||||
x:Name="ClockBox"
|
||||
Style="{DynamicResource ClockBox}"
|
||||
Text="PM 12:04" />
|
||||
<TextBlock x:Name="DateBox" Style="{DynamicResource DateBox}" />
|
||||
<TextBlock x:Name="ClockBox" Style="{DynamicResource ClockBox}" />
|
||||
</StackPanel>
|
||||
<Canvas Style="{DynamicResource SearchIconPosition}">
|
||||
<Path
|
||||
|
|
@ -1896,23 +1890,25 @@
|
|||
<StackPanel Style="{StaticResource TextPanel}">
|
||||
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource Clock}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0"
|
||||
Grid.Column="2" Orientation="Horizontal">
|
||||
<ComboBox
|
||||
x:Name="TimeFormat"
|
||||
Grid.Column="2"
|
||||
MinWidth="180"
|
||||
VerticalAlignment="Center"
|
||||
Margin="0,0,18,0"
|
||||
FontSize="14"
|
||||
ItemsSource="{Binding TimeFormatList}"
|
||||
SelectedValue="{Binding Settings.TimeFormat}"/>
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Grid.Column="2"
|
||||
Orientation="Horizontal">
|
||||
<ComboBox
|
||||
x:Name="TimeFormat"
|
||||
Grid.Column="2"
|
||||
MinWidth="180"
|
||||
Margin="0,0,18,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
ItemsSource="{Binding TimeFormatList}"
|
||||
SelectedValue="{Binding Settings.TimeFormat}"
|
||||
SelectionChanged="PreviewClockAndDate" />
|
||||
<ui:ToggleSwitch
|
||||
|
||||
IsOn="{Binding UseClock, Mode=TwoWay}"
|
||||
OffContent="{DynamicResource disable}"
|
||||
OnContent="{DynamicResource enable}"
|
||||
Style="{DynamicResource SideToggleSwitch}" />
|
||||
IsOn="{Binding UseClock, Mode=TwoWay}"
|
||||
OffContent="{DynamicResource disable}"
|
||||
OnContent="{DynamicResource enable}"
|
||||
Style="{DynamicResource SideToggleSwitch}" />
|
||||
</StackPanel>
|
||||
<TextBlock Style="{StaticResource Glyph}">
|
||||

|
||||
|
|
@ -1931,23 +1927,25 @@
|
|||
<StackPanel Style="{StaticResource TextPanel}">
|
||||
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource Date}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0"
|
||||
Grid.Column="2" Orientation="Horizontal">
|
||||
<ComboBox
|
||||
x:Name="DateFormat"
|
||||
Grid.Column="2"
|
||||
MinWidth="180"
|
||||
VerticalAlignment="Center"
|
||||
Margin="0,0,18,0"
|
||||
FontSize="14"
|
||||
ItemsSource="{Binding DateFormatList}"
|
||||
SelectedValue="{Binding Settings.DateFormat}"
|
||||
/>
|
||||
<ui:ToggleSwitch
|
||||
IsOn="{Binding UseDate, Mode=TwoWay}"
|
||||
OffContent="{DynamicResource disable}"
|
||||
OnContent="{DynamicResource enable}"
|
||||
Style="{DynamicResource SideToggleSwitch}" />
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Grid.Column="2"
|
||||
Orientation="Horizontal">
|
||||
<ComboBox
|
||||
x:Name="DateFormat"
|
||||
Grid.Column="2"
|
||||
MinWidth="180"
|
||||
Margin="0,0,18,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
ItemsSource="{Binding DateFormatList}"
|
||||
SelectedValue="{Binding Settings.DateFormat}"
|
||||
SelectionChanged="PreviewClockAndDate" />
|
||||
<ui:ToggleSwitch
|
||||
IsOn="{Binding UseDate, Mode=TwoWay}"
|
||||
OffContent="{DynamicResource disable}"
|
||||
OnContent="{DynamicResource enable}"
|
||||
Style="{DynamicResource SideToggleSwitch}" />
|
||||
</StackPanel>
|
||||
<TextBlock Style="{StaticResource Glyph}">
|
||||

|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ namespace Flow.Launcher
|
|||
HwndSource hwndSource = PresentationSource.FromVisual(this) as HwndSource;
|
||||
HwndTarget hwndTarget = hwndSource.CompositionTarget;
|
||||
hwndTarget.RenderMode = RenderMode.SoftwareOnly;
|
||||
ClockDisplay();
|
||||
}
|
||||
|
||||
private void OnSelectPythonDirectoryClick(object sender, RoutedEventArgs e)
|
||||
|
|
@ -353,5 +354,32 @@ namespace Flow.Launcher
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
private void PreviewClockAndDate(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ClockDisplay();
|
||||
}
|
||||
public void ClockDisplay()
|
||||
{
|
||||
if (settings.UseClock == true)
|
||||
{
|
||||
ClockBox.Visibility = Visibility.Visible;
|
||||
ClockBox.Text = System.DateTime.Now.ToString(settings.TimeFormat);
|
||||
}
|
||||
else if (settings.UseClock == false)
|
||||
{
|
||||
ClockBox.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
if (settings.UseDate == true)
|
||||
{
|
||||
DateBox.Visibility = Visibility.Visible;
|
||||
DateBox.Text = System.DateTime.Now.ToString(settings.DateFormat);
|
||||
}
|
||||
else if (settings.UseDate == false)
|
||||
{
|
||||
DateBox.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue