Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 03d2cf30d0 | |||
| 0d07bc468c | |||
| 80bc33b85e | |||
| 3482ed7336 | |||
| 5b0508721f | |||
| 69292b6410 | |||
| 4d722c0220 | |||
| 6fa58d3a62 | |||
| 15038f5feb | |||
| 3b776e2534 | |||
| ec99595303 | |||
| 5fd61f1f84 | |||
| 23e8b2533a | |||
| 4d89e49c96 | |||
| 58c59dfc0a | |||
| 867f57dcff | |||
| 72abb6cbb3 | |||
| 62307e09a1 | |||
| f39b643b00 |
@@ -3,7 +3,7 @@
|
|||||||
; Non-commercial use only
|
; Non-commercial use only
|
||||||
|
|
||||||
#define MyAppName "MayShow"
|
#define MyAppName "MayShow"
|
||||||
#define MyAppVersion "1.4.2"
|
#define MyAppVersion "1.4.3"
|
||||||
#define MyAppPublisher "Quickity Quack Productions"
|
#define MyAppPublisher "Quickity Quack Productions"
|
||||||
#define MyAppExeName "MayShow.exe"
|
#define MyAppExeName "MayShow.exe"
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
VERSION="1.4.2"
|
VERSION="1.4.3"
|
||||||
SRC_DIR="src" # user ran script from main folder
|
SRC_DIR="src" # user ran script from main folder
|
||||||
if [ ! -d "$SRC_DIR" ]; then
|
if [ ! -d "$SRC_DIR" ]; then
|
||||||
SRC_DIR= "../src" # try
|
SRC_DIR= "../src" # try
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<AvaloniaVersion>11.3.12</AvaloniaVersion>
|
<AvaloniaVersion>11.3.13</AvaloniaVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,15 +1,34 @@
|
|||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using MayShow.Models;
|
||||||
|
|
||||||
namespace MayShow.Helpers;
|
namespace MayShow.Helpers;
|
||||||
|
|
||||||
class Constants
|
class Constants
|
||||||
{
|
{
|
||||||
public static string AppVersion = "1.4.2";
|
public static string AppVersion = "1.4.3";
|
||||||
|
|
||||||
public static string[] AllowedFileExtensionPatterns = [ "*.png", "*.jpg", "*.jpeg", "*.gif", "*.bmp", "*.webp", "*.pdf", "*.heic", ];
|
public static string[] AllowedFileExtensionPatterns = [ "*.png", "*.jpg", "*.jpeg", "*.gif", "*.bmp", "*.webp", "*.pdf", "*.heic", ];
|
||||||
public static string[] AllowedFileExtensionsNoStar = [ "png", "jpg", "jpeg", "gif", "bmp", "webp", "pdf", "heic", ];
|
public static string[] AllowedFileExtensionsNoStar = [ "png", "jpg", "jpeg", "gif", "bmp", "webp", "pdf", "heic", ];
|
||||||
|
|
||||||
public static string ReportSavedDataFileName = "report_data.json";
|
public static string ReportSavedDataFileName = "report_data.json";
|
||||||
|
|
||||||
|
public static List<DateDisplayFormat> GetDateDisplayFormats()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
new DateDisplayFormat("Month/Day/Year", "4/5/2026", "M/d/yyyy"),
|
||||||
|
new DateDisplayFormat("Year-Month-Day", "2026-04-05", "yyyy-MM-dd"),
|
||||||
|
new DateDisplayFormat("Month Day, Year", "April 5, 2026", "MMMM d, yyyy"),
|
||||||
|
new DateDisplayFormat("DOW, Month Day, Year", "Sunday, April 5, 2026", "dddd, MMMM d, yyyy"),
|
||||||
|
new DateDisplayFormat("Abbreviated-Month Day, Year", "Apr 5, 2026", "MMM d, yyyy"),
|
||||||
|
new DateDisplayFormat("DOW, Abbreviated-Month Day, Year", "Sunday, Apr 5, 2026", "dddd, MMM d, yyyy"),
|
||||||
|
new DateDisplayFormat("Day Month, Year", "5 April 2026", "d MMMM yyyy"),
|
||||||
|
new DateDisplayFormat("Day Abbreviated-Month, Year", "5 Apr 2026", "d MMM yyyy"),
|
||||||
|
new DateDisplayFormat("Day Month, Year", "05 April 2026", "dd MMMM yyyy"),
|
||||||
|
new DateDisplayFormat("Day Abbreviated-Month, Year", "05 Apr 2026", "dd MMM yyyy"),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public static string[] GetQuotes()
|
public static string[] GetQuotes()
|
||||||
{
|
{
|
||||||
// sources:
|
// sources:
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using Avalonia.Data.Converters;
|
||||||
|
|
||||||
|
namespace MayShow.Helpers;
|
||||||
|
|
||||||
|
public class DateFormatConverter : IMultiValueConverter
|
||||||
|
{
|
||||||
|
public object? Convert(
|
||||||
|
IList<object?> values,
|
||||||
|
Type targetType,
|
||||||
|
object? parameter,
|
||||||
|
CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (values.Count >= 2 && values[0] is DateOnly date && values[1] is string format)
|
||||||
|
{
|
||||||
|
return date.ToString(format);
|
||||||
|
}
|
||||||
|
if (values.Count >= 2 && values[0] is string dateFormat && values[1] is DateOnly dateOnly)
|
||||||
|
{
|
||||||
|
return dateOnly.ToString(dateFormat);
|
||||||
|
}
|
||||||
|
if (values.Count >= 2 && values[0] is DateTime dateTime && values[1] is string format3)
|
||||||
|
{
|
||||||
|
return dateTime.ToString(format3);
|
||||||
|
}
|
||||||
|
if (values.Count >= 2 && values[0] is string format4 && values[1] is DateTime dateTime2)
|
||||||
|
{
|
||||||
|
return dateTime2.ToString(format4);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace MayShows.Helpers;
|
namespace MayShow.Helpers;
|
||||||
|
|
||||||
public static class ThreadSafeRandom
|
public static class ThreadSafeRandom
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ using System.Text.Json.Serialization;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Tmds.DBus.Protocol;
|
using Tmds.DBus.Protocol;
|
||||||
|
|
||||||
namespace MayShows.Helpers;
|
namespace MayShow.Helpers;
|
||||||
|
|
||||||
class Utilities
|
class Utilities
|
||||||
{
|
{
|
||||||
|
|||||||
+4
-2
@@ -12,7 +12,7 @@
|
|||||||
<PublishTrimmed>true</PublishTrimmed>
|
<PublishTrimmed>true</PublishTrimmed>
|
||||||
<PublishAot>true</PublishAot>
|
<PublishAot>true</PublishAot>
|
||||||
<AssemblyName>MayShow</AssemblyName>
|
<AssemblyName>MayShow</AssemblyName>
|
||||||
<AssemblyVersion>1.4.2</AssemblyVersion> <!-- Also update Constants version -->
|
<AssemblyVersion>1.4.3</AssemblyVersion> <!-- Also update Constants version -->
|
||||||
<ApplicationIcon>MayShow-icon.ico</ApplicationIcon>
|
<ApplicationIcon>MayShow-icon.ico</ApplicationIcon>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -58,7 +58,9 @@
|
|||||||
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="PDFsharp-MigraDoc" Version="6.2.4" />
|
<PackageReference Include="PDFsharp-MigraDoc" Version="6.2.4" />
|
||||||
<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="14.10.4" />
|
<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="14.11.1" Condition="'$(RuntimeIdentifier)' != 'osx-x64'" />
|
||||||
|
<!-- DO NOT UPDATE BEYOND 14.9.1 OR YOU WILL BREAK macOS MONTEREY USERS -->
|
||||||
|
<PackageReference Include="Magick.NET-Q8-x64" Version="14.9.1" Condition="'$(RuntimeIdentifier)' == 'osx-x64'" />
|
||||||
<PackageReference Include="Deadpikle.AvaloniaProgressRing" Version="0.10.11-preview20251127001" />
|
<PackageReference Include="Deadpikle.AvaloniaProgressRing" Version="0.10.11-preview20251127001" />
|
||||||
<PackageReference Include="DialogHost.Avalonia" Version="0.10.4" />
|
<PackageReference Include="DialogHost.Avalonia" Version="0.10.4" />
|
||||||
<PackageReference Include="Xaml.Behaviors.Interactions.DragAndDrop.DataGrid" Version="11.3.9.5" />
|
<PackageReference Include="Xaml.Behaviors.Interactions.DragAndDrop.DataGrid" Version="11.3.9.5" />
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using MayShow.Helpers;
|
||||||
|
|
||||||
|
namespace MayShow.Models;
|
||||||
|
|
||||||
|
class DateDisplayFormat : ChangeNotifier
|
||||||
|
{
|
||||||
|
private string _title;
|
||||||
|
private string _example;
|
||||||
|
private string _value;
|
||||||
|
|
||||||
|
public DateDisplayFormat(string title, string example, string value)
|
||||||
|
{
|
||||||
|
_title = title;
|
||||||
|
_example = example;
|
||||||
|
_value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Title
|
||||||
|
{
|
||||||
|
get => _title;
|
||||||
|
set { _title = value; NotifyPropertyChanged(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Example
|
||||||
|
{
|
||||||
|
get => _example;
|
||||||
|
set { _example = value; NotifyPropertyChanged(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Value
|
||||||
|
{
|
||||||
|
get => _value;
|
||||||
|
set { _value = value; NotifyPropertyChanged(); }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,7 +23,7 @@ class ReportFile : ChangeNotifier
|
|||||||
public ReportFile(ReportFile other)
|
public ReportFile(ReportFile other)
|
||||||
{
|
{
|
||||||
Title = _title = other.Title;
|
Title = _title = other.Title;
|
||||||
ReceiptDateTime = _receiptDateTime = other.ReceiptDateTime;
|
ReceiptDateTime = _receiptDateTime = other.ReceiptDateTime ?? DateTime.Now;
|
||||||
Notes = _notes = other.Notes;
|
Notes = _notes = other.Notes;
|
||||||
FilePath = _filePath = other.FilePath;
|
FilePath = _filePath = other.FilePath;
|
||||||
}
|
}
|
||||||
@@ -34,12 +34,12 @@ class ReportFile : ChangeNotifier
|
|||||||
set { _title = value; NotifyPropertyChanged(); }
|
set { _title = value; NotifyPropertyChanged(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTime ReceiptDateTime
|
public DateTime? ReceiptDateTime
|
||||||
{
|
{
|
||||||
get => _receiptDateTime;
|
get => _receiptDateTime;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_receiptDateTime = value;
|
_receiptDateTime = value ?? DateTime.Now;
|
||||||
NotifyPropertyChanged();
|
NotifyPropertyChanged();
|
||||||
NotifyPropertyChanged(nameof(ReceiptDate));
|
NotifyPropertyChanged(nameof(ReceiptDate));
|
||||||
}
|
}
|
||||||
|
|||||||
+20
-1
@@ -6,7 +6,6 @@ using System.Text.Json;
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MayShow.Helpers;
|
using MayShow.Helpers;
|
||||||
using MayShows.Helpers;
|
|
||||||
|
|
||||||
namespace MayShow.Models;
|
namespace MayShow.Models;
|
||||||
|
|
||||||
@@ -19,6 +18,8 @@ class Settings : ChangeNotifier
|
|||||||
private decimal _imageResizeThreshold;
|
private decimal _imageResizeThreshold;
|
||||||
private bool _saveReportJsonDataInInternalDir;
|
private bool _saveReportJsonDataInInternalDir;
|
||||||
private Dictionary<string, string> _workingFolderToInternalFolderName;
|
private Dictionary<string, string> _workingFolderToInternalFolderName;
|
||||||
|
public string _dataGridDateFormat;
|
||||||
|
public string _reportDateFormat;
|
||||||
public int _settingsVersion;
|
public int _settingsVersion;
|
||||||
|
|
||||||
public Settings()
|
public Settings()
|
||||||
@@ -31,6 +32,8 @@ class Settings : ChangeNotifier
|
|||||||
_saveReportJsonDataInInternalDir = false;
|
_saveReportJsonDataInInternalDir = false;
|
||||||
_workingFolderToInternalFolderName = [];
|
_workingFolderToInternalFolderName = [];
|
||||||
_settingsVersion = 1;
|
_settingsVersion = 1;
|
||||||
|
_dataGridDateFormat = "dd/MM/yyyy";
|
||||||
|
_reportDateFormat = "yyyy-MM-dd";
|
||||||
}
|
}
|
||||||
|
|
||||||
public Settings(Settings other)
|
public Settings(Settings other)
|
||||||
@@ -43,6 +46,8 @@ class Settings : ChangeNotifier
|
|||||||
_saveReportJsonDataInInternalDir = other.SaveReportJsonDataInInternalDir;
|
_saveReportJsonDataInInternalDir = other.SaveReportJsonDataInInternalDir;
|
||||||
_workingFolderToInternalFolderName = other.WorkingFolderToInternalFolderName;
|
_workingFolderToInternalFolderName = other.WorkingFolderToInternalFolderName;
|
||||||
_settingsVersion = other.SettingsVersion;
|
_settingsVersion = other.SettingsVersion;
|
||||||
|
_dataGridDateFormat = "yyyy-MM-dd";
|
||||||
|
_reportDateFormat = "yyyy-MM-dd";
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonInclude]
|
[JsonInclude]
|
||||||
@@ -102,6 +107,20 @@ class Settings : ChangeNotifier
|
|||||||
set { _settingsVersion = value; NotifyPropertyChanged(); }
|
set { _settingsVersion = value; NotifyPropertyChanged(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonInclude]
|
||||||
|
public string DataGridDateFormat
|
||||||
|
{
|
||||||
|
get => _dataGridDateFormat;
|
||||||
|
set { _dataGridDateFormat = value; NotifyPropertyChanged(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonInclude]
|
||||||
|
public string ReportDateFormat
|
||||||
|
{
|
||||||
|
get => _reportDateFormat;
|
||||||
|
set { _reportDateFormat = value; NotifyPropertyChanged(); }
|
||||||
|
}
|
||||||
|
|
||||||
public static string SettingsFileName = "settings.json";
|
public static string SettingsFileName = "settings.json";
|
||||||
|
|
||||||
public static string GetSettingsPath()
|
public static string GetSettingsPath()
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ using PdfSharp.Snippets.Font;
|
|||||||
using MayShow.Helpers;
|
using MayShow.Helpers;
|
||||||
using MayShow.Interfaces;
|
using MayShow.Interfaces;
|
||||||
using MayShow.Models;
|
using MayShow.Models;
|
||||||
using MayShows.Helpers;
|
|
||||||
|
|
||||||
using Docnet.Core.Models;
|
using Docnet.Core.Models;
|
||||||
using Docnet.Core;
|
using Docnet.Core;
|
||||||
@@ -29,6 +28,8 @@ using SixLabors.ImageSharp.Processing;
|
|||||||
using System.Reflection.Metadata.Ecma335;
|
using System.Reflection.Metadata.Ecma335;
|
||||||
using Docnet.Core.Readers;
|
using Docnet.Core.Readers;
|
||||||
using MigraDoc.DocumentObjectModel.Visitors;
|
using MigraDoc.DocumentObjectModel.Visitors;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace MayShow.ViewModels;
|
namespace MayShow.ViewModels;
|
||||||
|
|
||||||
@@ -45,6 +46,7 @@ class MainViewModel : BaseViewModel, IFontResolver, ICanCheckShutdown
|
|||||||
private DateTime? _lastGeneratedTime;
|
private DateTime? _lastGeneratedTime;
|
||||||
|
|
||||||
private Settings _settings;
|
private Settings _settings;
|
||||||
|
private List<DateDisplayFormat> _dateDisplayFormats;
|
||||||
|
|
||||||
private bool _hasUnsavedWork;
|
private bool _hasUnsavedWork;
|
||||||
|
|
||||||
@@ -57,7 +59,9 @@ class MainViewModel : BaseViewModel, IFontResolver, ICanCheckShutdown
|
|||||||
var quotes = Constants.GetQuotes();
|
var quotes = Constants.GetQuotes();
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
var quoteIndex = random.Next(0, quotes.Length);
|
var quoteIndex = random.Next(0, quotes.Length);
|
||||||
_programLog = "----- MayShow v" + Constants.AppVersion + " ------" + Environment.NewLine;
|
var compDetails = RuntimeInformation.OSDescription + " | " +
|
||||||
|
RuntimeInformation.OSArchitecture.ToString();
|
||||||
|
_programLog = "----- MayShow v" + Constants.AppVersion + " | " + compDetails + " ------" + Environment.NewLine;
|
||||||
_programLog += quotes[quoteIndex] + Environment.NewLine;
|
_programLog += quotes[quoteIndex] + Environment.NewLine;
|
||||||
_programLog += "---------------------------------------" + Environment.NewLine;
|
_programLog += "---------------------------------------" + Environment.NewLine;
|
||||||
_programLog += "Loaded and ready to create report!" + Environment.NewLine;
|
_programLog += "Loaded and ready to create report!" + Environment.NewLine;
|
||||||
@@ -67,6 +71,9 @@ class MainViewModel : BaseViewModel, IFontResolver, ICanCheckShutdown
|
|||||||
_reportTitle = "";
|
_reportTitle = "";
|
||||||
_lastGeneratedTime = null;
|
_lastGeneratedTime = null;
|
||||||
_settings = Settings.LoadSettings();
|
_settings = Settings.LoadSettings();
|
||||||
|
_dateDisplayFormats = Constants.GetDateDisplayFormats();
|
||||||
|
NotifyPropertyChanged(nameof(DataGridDateFormat));
|
||||||
|
NotifyPropertyChanged(nameof(DataGridDateFormatWatermark));
|
||||||
if (!string.IsNullOrWhiteSpace(_settings.LastUsedPath))
|
if (!string.IsNullOrWhiteSpace(_settings.LastUsedPath))
|
||||||
{
|
{
|
||||||
LogInfo("Loading data at last used path of {0}", _settings.LastUsedPath);
|
LogInfo("Loading data at last used path of {0}", _settings.LastUsedPath);
|
||||||
@@ -173,6 +180,16 @@ class MainViewModel : BaseViewModel, IFontResolver, ICanCheckShutdown
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string DataGridDateFormat
|
||||||
|
{
|
||||||
|
get => _settings.DataGridDateFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string DataGridDateFormatWatermark
|
||||||
|
{
|
||||||
|
get => _dateDisplayFormats.FirstOrDefault(x => x.Value == _settings.DataGridDateFormat)?.Example ?? "2025-12-04";
|
||||||
|
}
|
||||||
|
|
||||||
private void LogInfo(string message, params object[]? arguments)
|
private void LogInfo(string message, params object[]? arguments)
|
||||||
{
|
{
|
||||||
var timestamp = string.Format("[{0:s}]", DateTime.Now);
|
var timestamp = string.Format("[{0:s}]", DateTime.Now);
|
||||||
@@ -299,6 +316,8 @@ class MainViewModel : BaseViewModel, IFontResolver, ICanCheckShutdown
|
|||||||
_settings = (Settings)updatedSettings;
|
_settings = (Settings)updatedSettings;
|
||||||
await _settings.SaveSettingsAsync();
|
await _settings.SaveSettingsAsync();
|
||||||
LogInfo("Saved updated settings!");
|
LogInfo("Saved updated settings!");
|
||||||
|
NotifyPropertyChanged(nameof(DataGridDateFormat));
|
||||||
|
NotifyPropertyChanged(nameof(DataGridDateFormatWatermark));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -509,13 +528,15 @@ class MainViewModel : BaseViewModel, IFontResolver, ICanCheckShutdown
|
|||||||
{
|
{
|
||||||
LogInfo(e.StackTrace);
|
LogInfo(e.StackTrace);
|
||||||
}
|
}
|
||||||
if (e.InnerException != null)
|
var otherException = e.InnerException;
|
||||||
|
while (otherException != null)
|
||||||
{
|
{
|
||||||
LogInfo("Inner exception: " + e.InnerException.Message);
|
LogInfo(">> Inner exception: " + otherException.Message);
|
||||||
if (e.InnerException.StackTrace != null)
|
if (otherException.StackTrace != null)
|
||||||
{
|
{
|
||||||
LogInfo(e.InnerException.StackTrace);
|
LogInfo(otherException.StackTrace);
|
||||||
}
|
}
|
||||||
|
otherException = otherException.InnerException;
|
||||||
}
|
}
|
||||||
LogInfo("Please report this error to a programmer or fix the issue listed above.");
|
LogInfo("Please report this error to a programmer or fix the issue listed above.");
|
||||||
IsCreatingPDF = false;
|
IsCreatingPDF = false;
|
||||||
@@ -809,7 +830,7 @@ class MainViewModel : BaseViewModel, IFontResolver, ICanCheckShutdown
|
|||||||
receiptDatePar.Format.Font.Size = 12;
|
receiptDatePar.Format.Font.Size = 12;
|
||||||
receiptDatePar.Format.Font.Bold = true;
|
receiptDatePar.Format.Font.Bold = true;
|
||||||
receiptDatePar.Format.Font.Name = "Noto Sans JP"; // has english letters in it, too
|
receiptDatePar.Format.Font.Name = "Noto Sans JP"; // has english letters in it, too
|
||||||
receiptDatePar.AddText(file.ReceiptDate.ToString("yyyy-MM-dd"));
|
receiptDatePar.AddText(file.ReceiptDate.ToString(_settings.ReportDateFormat));
|
||||||
receiptDatePar.Tag = "ReceiptDatePar";
|
receiptDatePar.Tag = "ReceiptDatePar";
|
||||||
if (!string.IsNullOrWhiteSpace(file.Notes))
|
if (!string.IsNullOrWhiteSpace(file.Notes))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ using PdfSharp.Snippets.Font;
|
|||||||
using MayShow.Interfaces;
|
using MayShow.Interfaces;
|
||||||
using MayShow.Models;
|
using MayShow.Models;
|
||||||
using MayShow.Helpers;
|
using MayShow.Helpers;
|
||||||
using MayShows.Helpers;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace MayShow.ViewModels;
|
namespace MayShow.ViewModels;
|
||||||
|
|
||||||
@@ -28,6 +28,9 @@ class SettingsViewModel: ChangeNotifier
|
|||||||
private Settings _settings;
|
private Settings _settings;
|
||||||
private string _errorMessage;
|
private string _errorMessage;
|
||||||
private ITopLevelGrabber? _topLevelGrabber;
|
private ITopLevelGrabber? _topLevelGrabber;
|
||||||
|
private List<DateDisplayFormat> _dateFormats;
|
||||||
|
private int _gridDisplayDateFormatSelectedIndex;
|
||||||
|
private int _reportDisplayDateFormatSelectedIndex;
|
||||||
|
|
||||||
public SettingsViewModel(Settings settingsToEdit, ITopLevelGrabber? topLevelGrabber)
|
public SettingsViewModel(Settings settingsToEdit, ITopLevelGrabber? topLevelGrabber)
|
||||||
{
|
{
|
||||||
@@ -35,6 +38,17 @@ class SettingsViewModel: ChangeNotifier
|
|||||||
_settings = new Settings(settingsToEdit); // clone it
|
_settings = new Settings(settingsToEdit); // clone it
|
||||||
_errorMessage = "";
|
_errorMessage = "";
|
||||||
_topLevelGrabber = topLevelGrabber;
|
_topLevelGrabber = topLevelGrabber;
|
||||||
|
_dateFormats = Constants.GetDateDisplayFormats();
|
||||||
|
_gridDisplayDateFormatSelectedIndex = _dateFormats.FindIndex(x => x.Value == _previousSettings.DataGridDateFormat);
|
||||||
|
if (_gridDisplayDateFormatSelectedIndex == -1)
|
||||||
|
{
|
||||||
|
_gridDisplayDateFormatSelectedIndex = 0;
|
||||||
|
}
|
||||||
|
_reportDisplayDateFormatSelectedIndex = _dateFormats.FindIndex(x => x.Value == _previousSettings.ReportDateFormat);
|
||||||
|
if (_reportDisplayDateFormatSelectedIndex == -1)
|
||||||
|
{
|
||||||
|
_reportDisplayDateFormatSelectedIndex = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool UseDocnetPDFImageRendering
|
public bool UseDocnetPDFImageRendering
|
||||||
@@ -109,6 +123,33 @@ class SettingsViewModel: ChangeNotifier
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DateDisplayFormat> DateFormats
|
||||||
|
{
|
||||||
|
get => _dateFormats;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int DataGridDisplayDateFormatSelectedIndex
|
||||||
|
{
|
||||||
|
get => _gridDisplayDateFormatSelectedIndex;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_gridDisplayDateFormatSelectedIndex = value;
|
||||||
|
_settings.DataGridDateFormat = _dateFormats[value].Value;
|
||||||
|
NotifyPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int ReportDisplayDateFormatSelectedIndex
|
||||||
|
{
|
||||||
|
get => _reportDisplayDateFormatSelectedIndex;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_reportDisplayDateFormatSelectedIndex = value;
|
||||||
|
_settings.ReportDateFormat = _dateFormats[value].Value;
|
||||||
|
NotifyPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async void ChooseOutputFolder()
|
public async void ChooseOutputFolder()
|
||||||
{
|
{
|
||||||
var topLevel = _topLevelGrabber?.GetTopLevel();
|
var topLevel = _topLevelGrabber?.GetTopLevel();
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
MaxWidth="450">
|
MaxWidth="450">
|
||||||
<StackPanel Orientation="Vertical"
|
<StackPanel Orientation="Vertical"
|
||||||
Spacing="4">
|
Spacing="4">
|
||||||
<TextBlock Text="MayShow 1.4.2"
|
<TextBlock Text="MayShow 1.4.3"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
TextWrapping="Wrap"
|
TextWrapping="Wrap"
|
||||||
FontSize="18"
|
FontSize="18"
|
||||||
|
|||||||
+30
-14
@@ -10,6 +10,9 @@
|
|||||||
xmlns:vm="clr-namespace:MayShow.ViewModels"
|
xmlns:vm="clr-namespace:MayShow.ViewModels"
|
||||||
xmlns:progRing="clr-namespace:AvaloniaProgressRing;assembly=AvaloniaProgressRing"
|
xmlns:progRing="clr-namespace:AvaloniaProgressRing;assembly=AvaloniaProgressRing"
|
||||||
x:DataType="vm:MainViewModel">
|
x:DataType="vm:MainViewModel">
|
||||||
|
<UserControl.Resources>
|
||||||
|
<helpers:DateFormatConverter x:Key="DateFormatter" />
|
||||||
|
</UserControl.Resources>
|
||||||
<Grid ColumnDefinitions="*"
|
<Grid ColumnDefinitions="*"
|
||||||
RowDefinitions="Auto, 2*, Auto, Auto, *">
|
RowDefinitions="Auto, 2*, Auto, Auto, *">
|
||||||
<Button Command="{Binding ShowSettings}"
|
<Button Command="{Binding ShowSettings}"
|
||||||
@@ -97,7 +100,7 @@
|
|||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Grid ColumnDefinitions="Auto, *">
|
<Grid ColumnDefinitions="Auto, *">
|
||||||
<Button Command="{Binding $parent[DataGrid].((vm:MainViewModel)DataContext).LocateFile}"
|
<Button Command="{Binding $parent[UserControl].((vm:MainViewModel)DataContext).LocateFile}"
|
||||||
CommandParameter="{Binding}"
|
CommandParameter="{Binding}"
|
||||||
IsVisible="{Binding !IsFileFoundOnDisk}"
|
IsVisible="{Binding !IsFileFoundOnDisk}"
|
||||||
Margin="2"
|
Margin="2"
|
||||||
@@ -107,7 +110,7 @@
|
|||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
FontFamily="{StaticResource FontAwesomeSolid}"
|
FontFamily="{StaticResource FontAwesomeSolid}"
|
||||||
ToolTip.Tip="File not found; click to locate..."
|
ToolTip.Tip="File not found; click to locate..."
|
||||||
IsEnabled="{Binding !$parent[DataGrid].((vm:MainViewModel)DataContext).IsCreatingPDF}"/>
|
IsEnabled="{Binding !$parent[UserControl].((vm:MainViewModel)DataContext).IsCreatingPDF}"/>
|
||||||
<TextBlock Text="{Binding Title}"
|
<TextBlock Text="{Binding Title}"
|
||||||
TextTrimming="CharacterEllipsis"
|
TextTrimming="CharacterEllipsis"
|
||||||
TextWrapping="NoWrap"
|
TextWrapping="NoWrap"
|
||||||
@@ -133,19 +136,29 @@
|
|||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
<DataGridTemplateColumn Header="Receipt Date"
|
<DataGridTemplateColumn Header="Receipt Date"
|
||||||
IsReadOnly="False"
|
IsReadOnly="False"
|
||||||
Width="125">
|
Width="150">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Label Content="{Binding ReceiptDate}"
|
<Label VerticalAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
|
||||||
Margin="8,0,8,0"
|
Margin="8,0,8,0"
|
||||||
HorizontalAlignment="Left"/>
|
HorizontalAlignment="Left">
|
||||||
|
<Label.Content>
|
||||||
|
<MultiBinding Converter="{StaticResource DateFormatter}">
|
||||||
|
<Binding Path="ReceiptDate" />
|
||||||
|
<Binding Path="$parent[UserControl].((vm:MainViewModel)DataContext).DataGridDateFormat" />
|
||||||
|
</MultiBinding>
|
||||||
|
</Label.Content>
|
||||||
|
</Label>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
<DataGridTemplateColumn.CellEditingTemplate>
|
<DataGridTemplateColumn.CellEditingTemplate>
|
||||||
<DataTemplate DataType="models:ReportFile">
|
<DataTemplate DataType="models:ReportFile">
|
||||||
<CalendarDatePicker SelectedDate="{Binding ReceiptDateTime}"
|
<CalendarDatePicker SelectedDate="{Binding ReceiptDateTime}"
|
||||||
DisplayDate="{Binding ReceiptDateTime}"/>
|
DisplayDate="{Binding ReceiptDateTime}"
|
||||||
|
SelectedDateFormat="Custom"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
Watermark="{Binding $parent[UserControl].((vm:MainViewModel)DataContext).DataGridDateFormatWatermark}"
|
||||||
|
CustomDateFormatString="{Binding $parent[UserControl].((vm:MainViewModel)DataContext).DataGridDateFormat}"/>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellEditingTemplate>
|
</DataGridTemplateColumn.CellEditingTemplate>
|
||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
@@ -156,6 +169,7 @@
|
|||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBlock Text="{Binding FileName}"
|
<TextBlock Text="{Binding FileName}"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
TextTrimming="PrefixCharacterEllipsis"
|
||||||
ToolTip.Tip="{Binding FileName}"
|
ToolTip.Tip="{Binding FileName}"
|
||||||
Margin="8,0,8,0"
|
Margin="8,0,8,0"
|
||||||
HorizontalAlignment="Left"/>
|
HorizontalAlignment="Left"/>
|
||||||
@@ -164,25 +178,27 @@
|
|||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
<DataGridTemplateColumn Header=""
|
<DataGridTemplateColumn Header=""
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
Width="*">
|
Width="200">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel Orientation="Horizontal"
|
<StackPanel Orientation="Horizontal"
|
||||||
Spacing="4">
|
Spacing="4">
|
||||||
<Button Command="{Binding $parent[DataGrid].((vm:MainViewModel)DataContext).EditFileProperties}"
|
<Button Command="{Binding $parent[UserControl].((vm:MainViewModel)DataContext).EditFileProperties}"
|
||||||
CommandParameter="{Binding}"
|
CommandParameter="{Binding}"
|
||||||
Classes="accent"
|
Classes="accent"
|
||||||
Margin="2"
|
Margin="2"
|
||||||
IsEnabled="{Binding !$parent[DataGrid].((vm:MainViewModel)DataContext).IsCreatingPDF}">
|
FontSize="12"
|
||||||
|
IsEnabled="{Binding !$parent[UserControl].((vm:MainViewModel)DataContext).IsCreatingPDF}">
|
||||||
<Button.Content>
|
<Button.Content>
|
||||||
<TextBlock><Run Text="" FontFamily="{StaticResource FontAwesomeSolid}"/> Edit</TextBlock>
|
<TextBlock><Run Text="" FontFamily="{StaticResource FontAwesomeSolid}"/> Edit</TextBlock>
|
||||||
</Button.Content>
|
</Button.Content>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Command="{Binding $parent[DataGrid].((vm:MainViewModel)DataContext).RemoveFile}"
|
<Button Command="{Binding $parent[UserControl].((vm:MainViewModel)DataContext).RemoveFile}"
|
||||||
CommandParameter="{Binding}"
|
CommandParameter="{Binding}"
|
||||||
Classes="Danger"
|
Classes="Danger"
|
||||||
Margin="2"
|
Margin="2"
|
||||||
IsEnabled="{Binding !$parent[DataGrid].((vm:MainViewModel)DataContext).IsCreatingPDF}">
|
FontSize="12"
|
||||||
|
IsEnabled="{Binding !$parent[UserControl].((vm:MainViewModel)DataContext).IsCreatingPDF}">
|
||||||
<Button.Content>
|
<Button.Content>
|
||||||
<TextBlock><Run Text="" FontFamily="{StaticResource FontAwesomeSolid}"/> Remove</TextBlock>
|
<TextBlock><Run Text="" FontFamily="{StaticResource FontAwesomeSolid}"/> Remove</TextBlock>
|
||||||
</Button.Content>
|
</Button.Content>
|
||||||
@@ -206,13 +222,13 @@
|
|||||||
Spacing="8"
|
Spacing="8"
|
||||||
Margin="4"
|
Margin="4"
|
||||||
Grid.Row="2">
|
Grid.Row="2">
|
||||||
<Button Command="{Binding $parent[DataGrid].((vm:MainViewModel)DataContext).OpenFileLocation}"
|
<Button Command="{Binding $parent[UserControl].((vm:MainViewModel)DataContext).OpenFileLocation}"
|
||||||
CommandParameter="{Binding}">
|
CommandParameter="{Binding}">
|
||||||
<Button.Content>
|
<Button.Content>
|
||||||
<TextBlock FontSize="12"><Run Text="" FontFamily="{StaticResource FontAwesomeSolid}"/> Open File Location</TextBlock>
|
<TextBlock FontSize="12"><Run Text="" FontFamily="{StaticResource FontAwesomeSolid}"/> Open File Location</TextBlock>
|
||||||
</Button.Content>
|
</Button.Content>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Command="{Binding $parent[DataGrid].((vm:MainViewModel)DataContext).OpenFile}"
|
<Button Command="{Binding $parent[UserControl].((vm:MainViewModel)DataContext).OpenFile}"
|
||||||
CommandParameter="{Binding}">
|
CommandParameter="{Binding}">
|
||||||
<Button.Content>
|
<Button.Content>
|
||||||
<TextBlock FontSize="12"><Run Text="" FontFamily="{StaticResource FontAwesomeSolid}"/> Open File</TextBlock>
|
<TextBlock FontSize="12"><Run Text="" FontFamily="{StaticResource FontAwesomeSolid}"/> Open File</TextBlock>
|
||||||
|
|||||||
@@ -46,8 +46,34 @@
|
|||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
VerticalAlignment="Top"/>
|
VerticalAlignment="Top"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
<Label Content="File List Date Format"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
FontSize="14" />
|
||||||
|
<ComboBox SelectedIndex="{Binding DataGridDisplayDateFormatSelectedIndex}"
|
||||||
|
ItemsSource="{Binding DateFormats}"
|
||||||
|
MaxDropDownHeight="300">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate x:DataType="models:DateDisplayFormat">
|
||||||
|
<TextBlock Text="{Binding Example}"
|
||||||
|
TextWrapping="Wrap"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
<Label Content="PDF Report Date Format"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
FontSize="14" />
|
||||||
|
<ComboBox SelectedIndex="{Binding ReportDisplayDateFormatSelectedIndex}"
|
||||||
|
ItemsSource="{Binding DateFormats}"
|
||||||
|
MaxDropDownHeight="300">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate x:DataType="models:DateDisplayFormat">
|
||||||
|
<TextBlock Text="{Binding Example}"
|
||||||
|
TextWrapping="Wrap"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
<CheckBox IsChecked="{Binding SaveReportJsonDataInInternalDir}">Save report data (names, notes, etc.) in MayShow settings directory (saves in working directory by default)</CheckBox>
|
<CheckBox IsChecked="{Binding SaveReportJsonDataInInternalDir}">Save report data (names, notes, etc.) in MayShow settings directory (saves in working directory by default)</CheckBox>
|
||||||
<Button Command="{Binding OpenSettingsDir}">
|
<Button Command="{Binding OpenSettingsDir}">
|
||||||
<TextBlock>
|
<TextBlock>
|
||||||
<Run Text=""
|
<Run Text=""
|
||||||
FontFamily="{StaticResource FontAwesomeSolid}" /> Open MayShow Settings Directory</TextBlock>
|
FontFamily="{StaticResource FontAwesomeSolid}" /> Open MayShow Settings Directory</TextBlock>
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
<!-- This manifest is used on Windows only.
|
<!-- This manifest is used on Windows only.
|
||||||
Don't remove it as it might cause problems with window transparency and embedded controls.
|
Don't remove it as it might cause problems with window transparency and embedded controls.
|
||||||
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
|
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
|
||||||
<assemblyIdentity version="1.4.2.0" name="MayShow.Desktop"/>
|
<assemblyIdentity version="1.4.3.0" name="MayShow.Desktop"/>
|
||||||
|
|
||||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||||
<application>
|
<application>
|
||||||
|
|||||||
Reference in New Issue
Block a user