Skip to content

Commit

Permalink
Added informations about the progress in sorting and added a litle ma…
Browse files Browse the repository at this point in the history
…rgin for clarity
  • Loading branch information
Luca Auer authored and Luca Auer committed May 24, 2018
1 parent 71eb1b3 commit ba909fe
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 8 deletions.
9 changes: 9 additions & 0 deletions Image sort.Logic/FolderSelector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,15 @@ public void GoBackImages(int amount = 2)
{
imageSelectorQuery.GoBackImages(amount);
}

/// <summary>
/// Returns the current progress in the pool
/// </summary>
/// <returns>(currentImage, maxImages)</returns>
public (int, int) GetCurrentProgress()
{
return imageSelectorQuery.GetCurrentProgress();
}
#endregion
}
}
9 changes: 9 additions & 0 deletions Image sort.Logic/ImageSelectorQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,15 @@ public void AppendNewLocation(string newPath)
if (newPath.Length > 0 && File.Exists(newPath))
imagePathPool[currentIndex - 2] += $"*{newPath}";
}

/// <summary>
/// Returns the current progress in the pool
/// </summary>
/// <returns>(currentImage, maxImages)</returns>
public (int, int) GetCurrentProgress()
{
return (currentIndex, imagePathPool.Count);
}
#endregion
}
}
28 changes: 21 additions & 7 deletions Image sort.UI/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,29 @@
<Image x:Name="PreviewImage" Grid.Row="1" Grid.RowSpan="3"
Grid.Column="1" Margin="0,0,5,0" Focusable="False"></Image>

<StackPanel Grid.Row="4" Grid.Column="1" Background="#BFFFFFFF">
<TextBlock Name="FileNameInfo"/>
<TextBlock Name="FileTypeInfo"/>
<TextBlock Name="FileSizeInfo"/>
<TextBlock Name="OpenInExplorerLinkHost" Visibility="Collapsed">
<Grid Grid.Row="4" Grid.Column="1" Background="#BFFFFFFF">
<Grid Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<StackPanel Grid.Column="0" Grid.Row="0" Grid.RowSpan="2">
<TextBlock Name="FileNameInfo"/>
<TextBlock Name="FileTypeInfo"/>
<TextBlock Name="FileSizeInfo"/>
<TextBlock Name="OpenInExplorerLinkHost" Visibility="Collapsed">
<Hyperlink Focusable="False" Name="OpenInExplorerLink" RequestNavigate="RequestOpeningInExplorer">
Open Image in File Explorer
</Hyperlink>
</TextBlock>
</StackPanel>
</TextBlock>
</StackPanel>

<TextBlock Name="ProgressIndicatorText" Grid.Column="1" Grid.Row="1"/>
</Grid>
</Grid>
</Grid>
</Window>
6 changes: 5 additions & 1 deletion Image sort.UI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ private void LoadImage(BitmapImage image)
{
PreviewImage.Source = image;

// if an image was given, fill in the informations
// if an image was given, fill in the information (meta-data)
if (image != null)
{
string pathToImage = folderSelector.GetImagePath();
Expand All @@ -485,13 +485,17 @@ private void LoadImage(BitmapImage image)
// Fill in the links destination and make it visible
OpenInExplorerLink.NavigateUri = new Uri(pathToImage);
OpenInExplorerLinkHost.Visibility = Visibility.Visible;

(int current, int max) = folderSelector.GetCurrentProgress();
ProgressIndicatorText.Text = $"Progress: {current}/{max}";
}
// if that is not the case, remove the old information.
else
{
FileNameInfo.Text = "";
FileTypeInfo.Text = "";
FileSizeInfo.Text = "";
ProgressIndicatorText.Text = "";
OpenInExplorerLink.NavigateUri = null;
// Collapse link again to prevent accidental clicking.
OpenInExplorerLinkHost.Visibility = Visibility.Collapsed;
Expand Down

0 comments on commit ba909fe

Please sign in to comment.