-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added delete current image using button or "delete" key, added save f…
…unctionality on rotated image - using top border button or "ctrl+s" combination, added backup functionality - move image to "backup" folder on delete, other small fixes and improvements. Updated the version number.
- Loading branch information
1 parent
4961b70
commit 4aeae87
Showing
37 changed files
with
845 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System.Windows; | ||
using System.Windows.Media; | ||
|
||
namespace FileExplorerGallery.Behaviors | ||
{ | ||
public static class BehaviorExtensions | ||
{ | ||
public static T GetChildOfType<T>(this DependencyObject depObj) | ||
where T : DependencyObject | ||
{ | ||
if (depObj == null) return null; | ||
|
||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++) | ||
{ | ||
var child = VisualTreeHelper.GetChild(depObj, i); | ||
|
||
var result = (child as T) ?? GetChildOfType<T>(child); | ||
if (result != null) return result; | ||
} | ||
return null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System.Windows; | ||
using System.Windows.Interactivity; | ||
|
||
namespace FileExplorerGallery.Behaviors | ||
{ | ||
public class CloseWindowOnEsc : Behavior<Window> | ||
{ | ||
protected override void OnAttached() | ||
{ | ||
base.OnAttached(); | ||
AssociatedObject.Loaded += AssociatedObject_Loaded; | ||
} | ||
|
||
private void AssociatedObject_Loaded(object sender, RoutedEventArgs e) | ||
{ | ||
AssociatedObject.KeyDown += AssociatedObject_KeyDown; | ||
} | ||
|
||
private void AssociatedObject_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) | ||
{ | ||
if (e.Key == System.Windows.Input.Key.Escape) | ||
{ | ||
AssociatedObject.Loaded -= AssociatedObject_Loaded; | ||
AssociatedObject.KeyDown -= AssociatedObject_KeyDown; | ||
AssociatedObject.Close(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Interactivity; | ||
|
||
namespace FileExplorerGallery.Behaviors | ||
{ | ||
public class FocusFirstButtonBehavior : Behavior<Window> | ||
{ | ||
protected override void OnAttached() | ||
{ | ||
base.OnAttached(); | ||
AssociatedObject.Loaded += AssociatedObject_Loaded; | ||
} | ||
|
||
private void AssociatedObject_Loaded(object sender, RoutedEventArgs e) | ||
{ | ||
AssociatedObject.GetChildOfType<Button>().Focus(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
FileExplorerGallery/Converters/UriToCachedImageConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using FileExplorerGallery.ViewModelContracts; | ||
using System; | ||
using System.Globalization; | ||
using System.Windows.Data; | ||
using System.Windows.Media.Imaging; | ||
|
||
namespace FileExplorerGallery.Converters | ||
{ | ||
public class UriToCachedImageConverter : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
if(value == null) | ||
{ | ||
return null; | ||
} | ||
|
||
var image = (IImagePreviewItemViewModel)value; | ||
|
||
var fullPath = new Uri(image.Path, UriKind.Absolute); | ||
|
||
var bitmapImage = new BitmapImage(); | ||
bitmapImage.BeginInit(); | ||
bitmapImage.CacheOption = BitmapCacheOption.OnLoad; | ||
bitmapImage.CreateOptions = image.NeedRefresh ? BitmapCreateOptions.IgnoreImageCache : BitmapCreateOptions.None; | ||
bitmapImage.UriSource = fullPath; | ||
bitmapImage.EndInit(); | ||
bitmapImage.Freeze(); | ||
|
||
image.NeedRefresh = false; | ||
|
||
return bitmapImage; | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<Window x:Class="FileExplorerGallery.DialogWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:FileExplorerGallery" | ||
xmlns:e="http://schemas.microsoft.com/expression/2010/interactivity" | ||
xmlns:behaviors="clr-namespace:FileExplorerGallery.Behaviors" | ||
mc:Ignorable="d" | ||
Title="" WindowStartupLocation="CenterScreen" WindowStyle="None" AllowsTransparency="True" ShowInTaskbar="False" ResizeMode="NoResize" Topmost="True" Background="Transparent" Height="450" Width="800" SizeToContent="WidthAndHeight"> | ||
<e:Interaction.Behaviors> | ||
<behaviors:FocusFirstButtonBehavior /> | ||
<behaviors:CloseWindowOnEsc /> | ||
</e:Interaction.Behaviors> | ||
<Grid> | ||
|
||
</Grid> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Shapes; | ||
|
||
namespace FileExplorerGallery | ||
{ | ||
/// <summary> | ||
/// Interaction logic for DialogWindow.xaml | ||
/// </summary> | ||
public partial class DialogWindow : Window | ||
{ | ||
public DialogWindow() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.