Skip to content

Commit 6b7dfef

Browse files
author
David Khristepher Santos
committed
Add current time display to preview
Try to fix font loading issue for NewRodinProDB.
1 parent fa93b52 commit 6b7dfef

File tree

7 files changed

+38
-9
lines changed

7 files changed

+38
-9
lines changed

PSXPackagerGUI/Models/Resource/FontManager.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,15 @@ namespace PSXPackagerGUI.Models.Resource;
77

88
public static class FontManager
99
{
10-
private static string ResourcePath = Path.Combine(ApplicationInfo.AppPath, "Resources");
11-
1210
public static FontFamily NewRodinProDBFontFamily { get; private set; }
1311

1412
public static Typeface NewRodinProDB { get; private set; }
1513

1614
static FontManager()
1715
{
18-
var fontUri = new Uri(Path.Combine(ResourcePath, "Editor", "NewRodin Pro DB.otf"), UriKind.Absolute);
16+
var fontUri = new Uri("pack://application:,,,/Resources/Editor/#FOT-NewRodin Pro DB", UriKind.Absolute);
1917

20-
NewRodinProDBFontFamily = new FontFamily(fontUri, "NewRodin Pro DB");
18+
NewRodinProDBFontFamily = new FontFamily(fontUri, "FOT-NewRodin Pro DB");
2119

2220
NewRodinProDB = new Typeface(
2321
NewRodinProDBFontFamily,

PSXPackagerGUI/Models/SingleModel.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public class SingleModel : BaseNotifyModel
2626
private bool _showInformation;
2727
private bool _showBackground;
2828
private Track? _selectedTrack;
29+
private string _currentTime;
2930

3031
public SettingsModel Settings
3132
{
@@ -90,5 +91,11 @@ public Track? SelectedTrack
9091
get => _selectedTrack;
9192
set => SetProperty(ref _selectedTrack, value);
9293
}
94+
95+
public string CurrentTime
96+
{
97+
get => _currentTime;
98+
set => SetProperty(ref _currentTime, value);
99+
}
93100
}
94101
}

PSXPackagerGUI/Models/SingleModelDesignTime.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ public SingleModelDesignTime() : base()
3535

3636
SelectedDisc = Discs[0];
3737
}
38+
3839
}

PSXPackagerGUI/PSXPackagerGUI.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<None Remove="Resources\Editor\back.png" />
2020
<None Remove="Resources\Editor\boot.png" />
2121
<None Remove="Resources\Editor\ICON0.PNG" />
22+
<None Remove="Resources\Editor\NewRodin Pro DB.otf" />
2223
<None Remove="Resources\Editor\no_icon0.png" />
2324
<None Remove="Resources\Editor\PIC0.PNG" />
2425
<None Remove="Resources\Editor\PIC1.PNG" />
@@ -50,6 +51,9 @@
5051

5152
<ItemGroup>
5253
<Resource Include="Resources\disc.png" />
54+
<Resource Include="Resources\Editor\NewRodin Pro DB.otf">
55+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
56+
</Resource>
5357
<Resource Include="Resources\floppy-48x48.png" />
5458
<Resource Include="Resources\games-48x48.png" />
5559
<Resource Include="Resources\gear-48x48.png" />
@@ -83,9 +87,6 @@
8387
<None Update="Resources\alpha.png">
8488
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
8589
</None>
86-
<None Update="Resources\Editor\NewRodin Pro DB.otf">
87-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
88-
</None>
8990
<None Update="Resources\overlay.png">
9091
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
9192
</None>

PSXPackagerGUI/Pages/ImageProcessing.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public static void SaveBitmapSource(BitmapSource bitmap, Stream stream, BitmapEn
3838
encoder.Save(stream);
3939
}
4040

41-
public static BitmapSource Resize(
41+
public static ImageSource Resize(
4242
BitmapSource source,
4343
int maxWidth,
4444
int maxHeight)

PSXPackagerGUI/Pages/SinglePage.xaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,14 @@
373373
</Image.Style>
374374
</Image>
375375
</Border>
376+
<TextBlock FontFamily="pack://application:,,,/Resources/Editor/#FOT-NewRodin Pro DB" FontSize="14" FontWeight="Bold" Foreground="White"
377+
Text="{Binding CurrentTime}"
378+
TextAlignment="Right"
379+
Width="480" Height="272" Margin="0,0,25,0">
380+
<TextBlock.Effect>
381+
<DropShadowEffect BlurRadius="5" ShadowDepth="2"></DropShadowEffect>
382+
</TextBlock.Effect>
383+
</TextBlock>
376384
</Grid>
377385
<Grid Grid.Row="2" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}">
378386
<Label>Drag and drop images onto the resource areas to load into the resource. Right-click to show context menu.</Label>

PSXPackagerGUI/Pages/SinglePage.xaml.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,21 @@ public SinglePage(Window window, SettingsModel settings, GameDB gameDb)
9898
ResetModel();
9999
_stopwatch = Stopwatch.StartNew();
100100
CompositionTarget.Rendering += CompositionTargetOnRendering;
101-
//Closing += OnClosing;
101+
102+
timer = new Timer(Callback, null, new TimeSpan(0, 0, 1), new TimeSpan(0, 0, 1));
103+
Window.Closed += Window_Closed;
104+
}
105+
106+
private void Window_Closed(object? sender, EventArgs e)
107+
{
108+
timer?.Dispose();
109+
}
110+
111+
private Timer timer;
112+
113+
private void Callback(object? state)
114+
{
115+
_model.CurrentTime = $"{DateTime.Now:M/d h:mm tt}";
102116
}
103117

104118

0 commit comments

Comments
 (0)