3 Commits

Author SHA1 Message Date
4ab9994897 Update FloatingStatusWindow lib 2026-03-02 18:23:16 -05:00
aa9a7ef568 Update to .NET 10 2026-02-25 11:11:50 -05:00
a73a583ed7 Improve time zone settings
- Add drag/drop reordering
- Display time zone name and ID
2024-10-07 17:12:46 -04:00
8 changed files with 54 additions and 25 deletions

View File

@@ -23,14 +23,14 @@ jobs:
- name: Install .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: 10.0.x
- name: Publish Application
run: dotnet publish WorldClockStatusWindow.csproj -c Debug -o publish
run: dotnet publish WorldClockStatusWindow.csproj -c Release -o publish
- name: Create Velopack Release
run: |
dotnet tool install -g vpk
vpk download github --repoUrl https://github.com/ckaczor/WorldClockStatusWindow
vpk pack -u WorldClockStatusWindow -v ${{ steps.version.outputs.version }} -p publish --packTitle "World Clock Status Window" --shortcuts StartMenuRoot --framework net8.0-x64-desktop
vpk pack -u WorldClockStatusWindow -v ${{ steps.version.outputs.version }} -p publish --packTitle "World Clock Status Window" --shortcuts StartMenuRoot --framework net10.0-x64-desktop
vpk upload github --repoUrl https://github.com/ckaczor/WorldClockStatusWindow --publish --releaseName "${{ steps.version.outputs.version }}" --tag v${{ steps.version.outputs.version }} --token ${{ secrets.GITHUB_TOKEN }}

View File

@@ -6,7 +6,7 @@ namespace WorldClockStatusWindow;
internal static class Data
{
internal static ObservableCollection<TimeZoneEntry> TimeZoneEntries { get; set; }
internal static ObservableCollection<TimeZoneEntry> TimeZoneEntries { get; private set; }
internal static void Load()
{

View File

@@ -8,6 +8,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:windows="clr-namespace:ChrisKaczor.Wpf.Windows;assembly=ChrisKaczor.Wpf.Windows.CategoryWindow"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
mc:Ignorable="d"
Title="TimeZoneWindow"
ResizeMode="NoResize"
@@ -42,12 +43,26 @@
mah:TextBoxHelper.SelectAllOnFocus="True"
Text="{Binding Path=Label, UpdateSourceTrigger=Explicit, ValidatesOnExceptions=True}" />
<ComboBox Name="TimeZoneComboBox"
DisplayMemberPath="DisplayName"
SelectedValuePath="Id"
SelectedValue="{Binding Path=TimeZoneId}"
VirtualizingPanel.IsVirtualizing="False"
mah:TextBoxHelper.UseFloatingWatermark="True"
mah:TextBoxHelper.Watermark="{x:Static properties:Resources.TimeZoneColumnHeader}" />
mah:TextBoxHelper.Watermark="{x:Static properties:Resources.TimeZoneColumnHeader}">
<ComboBox.ItemTemplate>
<DataTemplate DataType="system:TimeZoneInfo">
<StackPanel>
<TextBlock Text="{Binding Path=DisplayName}"
Height="Auto"
VerticalAlignment="Center" />
<TextBlock Text="{Binding Path=Id}"
Height="Auto"
FontSize="11"
VerticalAlignment="Center"
Margin="0,2,0,2" />
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
<StackPanel Grid.Column="0"
Grid.Row="1"
@@ -62,7 +77,8 @@
IsDefault="True"
Click="HandleOkayButtonClick">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
<Style TargetType="Button"
BasedOn="{StaticResource {x:Type Button}}">
<Style.Triggers>
<DataTrigger Binding="{Binding Text.Length, ElementName=LabelTextBox}"
Value="0">

View File

@@ -7,6 +7,7 @@
xmlns:worldClockStatusWindow="clr-namespace:WorldClockStatusWindow"
xmlns:windows="clr-namespace:ChrisKaczor.Wpf.Windows;assembly=ChrisKaczor.Wpf.Windows.CategoryWindow"
xmlns:controls="clr-namespace:ChrisKaczor.Wpf.Controls;assembly=ChrisKaczor.Wpf.Controls.Link"
xmlns:dd="urn:gong-wpf-dragdrop"
mc:Ignorable="d"
d:DesignHeight="150"
d:DesignWidth="300">
@@ -36,21 +37,37 @@
GridLinesVisibility="None"
CanUserResizeRows="False"
IsReadOnly="True"
CanUserSortColumns="False"
SelectionUnit="FullRow"
HeadersVisibility="Column"
BorderThickness="1,1,1,1"
BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}"
Background="{x:Null}"
SelectionChanged="HandleTimeZoneDataGridSelectionChanged"
d:DataContext="{d:DesignInstance worldClockStatusWindow:TimeZoneEntry }">
d:DataContext="{d:DesignInstance worldClockStatusWindow:TimeZoneEntry }"
dd:DragDrop.IsDragSource="True"
dd:DragDrop.IsDropTarget="True">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Path=Label}"
Header="{x:Static properties:Resources.LabelColumnHeader}"
SortDirection="Ascending"
Width="*" />
<DataGridTextColumn Binding="{Binding TimeZoneId}"
Header="{x:Static properties:Resources.TimeZoneColumnHeader}"
Width="*" />
<DataGridTemplateColumn Header="{x:Static properties:Resources.TimeZoneColumnHeader}"
Width="*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Path=TimeZoneInfo.DisplayName}"
Height="Auto"
VerticalAlignment="Center" />
<TextBlock Text="{Binding Path=TimeZoneInfo.Id}"
Height="Auto"
FontSize="11"
VerticalAlignment="Center"
Margin="0,2,0,2" />
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
<DataGrid.RowStyle>
<Style TargetType="DataGridRow"

View File

@@ -1,5 +1,4 @@
using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
@@ -25,7 +24,6 @@ public partial class TimeZonesSettingsPanel
if (_collectionViewSource == null)
{
_collectionViewSource = new CollectionViewSource { Source = Data.TimeZoneEntries };
_collectionViewSource.SortDescriptions.Add(new SortDescription("Label", ListSortDirection.Ascending));
TimeZoneDataGrid.ItemsSource = _collectionViewSource.View;
}

View File

@@ -16,17 +16,15 @@ public class TimeZoneEntry : INotifyDataErrorInfo
_dataErrorDictionary.ErrorsChanged += DataErrorDictionaryErrorsChanged;
}
private string _label;
public string Label
{
get => _label;
get;
set
{
if (!ValidateLabel(value))
return;
_label = value;
field = value;
}
}
@@ -35,6 +33,9 @@ public class TimeZoneEntry : INotifyDataErrorInfo
[JsonIgnore]
public bool HasErrors => _dataErrorDictionary.Any();
[JsonIgnore]
public TimeZoneInfo TimeZoneInfo => TimeZoneInfo.FindSystemTimeZoneById(TimeZoneId);
public IEnumerable GetErrors(string propertyName)
{
return _dataErrorDictionary.GetErrors(propertyName);

View File

@@ -156,10 +156,7 @@ internal class WindowSource : IWindowSource, IDisposable
var settingsWindow = new CategoryWindow(categoryPanels, Resources.SettingsTitle, Resources.CloseButtonText);
var dialogResult = settingsWindow.ShowDialog();
if (!dialogResult.GetValueOrDefault(false))
return;
settingsWindow.ShowDialog();
Save();
}

View File

@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows7.0</TargetFramework>
<TargetFramework>net10.0-windows7.0</TargetFramework>
<OutputType>WinExe</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWPF>true</UseWPF>
@@ -19,8 +19,8 @@
<PackageReference Include="ChrisKaczor.Wpf.Controls.Link" Version="1.0.4" />
<PackageReference Include="ChrisKaczor.Wpf.Validation" Version="1.0.4" />
<PackageReference Include="ChrisKaczor.Wpf.Windows.CategoryWindow" Version="1.0.2" />
<PackageReference Include="ChrisKaczor.Wpf.Windows.FloatingStatusWindow" Version="2.0.0.5" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="ChrisKaczor.Wpf.Windows.FloatingStatusWindow" Version="2.0.0.9" />
<PackageReference Include="gong-wpf-dragdrop" Version="3.2.1" />
<PackageReference Include="Serilog" Version="4.0.2" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />