revert displaying current time in date/time format dropdown

This commit is contained in:
Vic 2022-11-20 13:56:36 +08:00
parent 4940449b41
commit 51dc61376e
2 changed files with 14 additions and 25 deletions

View file

@ -44,7 +44,6 @@
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
<converters:TextConverter x:Key="TextConverter" />
<converters:TranlationConverter x:Key="TranlationConverter" />
<converters:DateTimeFormatToNowConverter x:Key="DateTimeFormatToNowConverter"></converters:DateTimeFormatToNowConverter>
<CollectionViewSource x:Key="SortedFonts" Source="{Binding Source={x:Static Fonts.SystemFontFamilies}}">
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyName="Source" />
@ -2181,12 +2180,7 @@
VerticalAlignment="Center"
FontSize="14"
ItemsSource="{Binding TimeFormatList}"
SelectedIndex="{Binding TimeFormat}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Converter={StaticResource DateTimeFormatToNowConverter}}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
SelectedItem="{Binding TimeFormat}">
</ComboBox>
<ui:ToggleSwitch
IsOn="{Binding UseClock, Mode=TwoWay}"
@ -2223,12 +2217,7 @@
VerticalAlignment="Center"
FontSize="14"
ItemsSource="{Binding DateFormatList}"
SelectedIndex="{Binding DateFormat}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Converter={StaticResource DateTimeFormatToNowConverter}}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
SelectedItem="{Binding DateFormat}">
</ComboBox>
<ui:ToggleSwitch
IsOn="{Binding UseDate, Mode=TwoWay}"

View file

@ -47,6 +47,14 @@ namespace Flow.Launcher.ViewModel
case nameof(Settings.WindowSize):
OnPropertyChanged(nameof(WindowWidthSize));
break;
case nameof(Settings.UseDate):
case nameof(Settings.DateFormat):
OnPropertyChanged(nameof(DateText));
break;
case nameof(Settings.UseClock):
case nameof(Settings.TimeFormat):
OnPropertyChanged(nameof(ClockText));
break;
}
};
}
@ -483,26 +491,18 @@ namespace Flow.Launcher.ViewModel
public string TimeFormat
{
get { return Settings.TimeFormat; }
set
{
Settings.TimeFormat = value;
OnPropertyChanged();
}
set { Settings.TimeFormat = value; }
}
public string DateFormat
{
get { return Settings.DateFormat; }
set
{
Settings.DateFormat = value;
OnPropertyChanged();
}
set { Settings.DateFormat = value; }
}
public string ClockText { get; private set; }
public string ClockText => DateTime.Now.ToString(TimeFormat);
public string DateText { get; private set; }
public string DateText => DateTime.Now.ToString(DateFormat);
public double WindowWidthSize