Improve watermark for date display

This commit is contained in:
2026-04-13 19:10:33 +09:00
parent 5b0508721f
commit 3482ed7336
2 changed files with 11 additions and 1 deletions
+10
View File
@@ -28,6 +28,7 @@ using SixLabors.ImageSharp.Processing;
using System.Reflection.Metadata.Ecma335;
using Docnet.Core.Readers;
using MigraDoc.DocumentObjectModel.Visitors;
using System.Collections.Generic;
namespace MayShow.ViewModels;
@@ -44,6 +45,7 @@ class MainViewModel : BaseViewModel, IFontResolver, ICanCheckShutdown
private DateTime? _lastGeneratedTime;
private Settings _settings;
private List<DateDisplayFormat> _dateDisplayFormats;
private bool _hasUnsavedWork;
@@ -66,7 +68,9 @@ class MainViewModel : BaseViewModel, IFontResolver, ICanCheckShutdown
_reportTitle = "";
_lastGeneratedTime = null;
_settings = Settings.LoadSettings();
_dateDisplayFormats = Constants.GetDateDisplayFormats();
NotifyPropertyChanged(nameof(DataGridDateFormat));
NotifyPropertyChanged(nameof(DataGridDateFormatWatermark));
if (!string.IsNullOrWhiteSpace(_settings.LastUsedPath))
{
LogInfo("Loading data at last used path of {0}", _settings.LastUsedPath);
@@ -178,6 +182,11 @@ class MainViewModel : BaseViewModel, IFontResolver, ICanCheckShutdown
get => _settings.DataGridDateFormat;
}
public string DataGridDateFormatWatermark
{
get => _dateDisplayFormats.Where(x => x.Value == _settings.DataGridDateFormat).FirstOrDefault()?.Example ?? "2025-12-04";
}
private void LogInfo(string message, params object[]? arguments)
{
var timestamp = string.Format("[{0:s}]", DateTime.Now);
@@ -305,6 +314,7 @@ class MainViewModel : BaseViewModel, IFontResolver, ICanCheckShutdown
await _settings.SaveSettingsAsync();
LogInfo("Saved updated settings!");
NotifyPropertyChanged(nameof(DataGridDateFormat));
NotifyPropertyChanged(nameof(DataGridDateFormatWatermark));
}
}