Skip to content

Commit

Permalink
Added info about the creation time and date of the current image
Browse files Browse the repository at this point in the history
  • Loading branch information
Luca Auer authored and Luca Auer committed May 25, 2018
1 parent 61a0569 commit f6f7e81
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions Image sort.UI/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@
<TextBlock Name="FileNameInfo"/>
<TextBlock Name="FileTypeInfo"/>
<TextBlock Name="FileSizeInfo"/>
<TextBlock Name="FileCreationTimeInfo"/>
<TextBlock Name="OpenInExplorerLinkHost" Visibility="Collapsed">
<Hyperlink Focusable="False" Name="OpenInExplorerLink"
Command="local:Command.OpenInExplorerCommand">
Expand Down
3 changes: 3 additions & 0 deletions Image sort.UI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,8 @@ private void LoadImage(BitmapImage image)

FileNameInfo.Text = $"Name: {Path.GetFileNameWithoutExtension(pathToImage)}";
FileTypeInfo.Text = $"Format: {Path.GetExtension(pathToImage)}";
DateTime creationTime = File.GetCreationTime(pathToImage).ToLocalTime();
FileCreationTimeInfo.Text = $"Created at: {creationTime.ToLongDateString()} {creationTime.ToShortTimeString()}";
// Calculates the sizes in MB and KB and rounds them to two digits, before filling in the size.
FileSizeInfo.Text = $"Size: " +
$"{Math.Round(((double)(new FileInfo(pathToImage)).Length) / (1024 * 1024), 2)} MB, " +
Expand All @@ -537,6 +539,7 @@ private void LoadImage(BitmapImage image)
{
FileNameInfo.Text = "";
FileTypeInfo.Text = "";
FileCreationTimeInfo.Text = "";
FileSizeInfo.Text = "";

// Show progress
Expand Down

0 comments on commit f6f7e81

Please sign in to comment.