Skip to content

Commit 159e195

Browse files
committed
Improvements to PhotoAlbum layout commands
1 parent 518e892 commit 159e195

File tree

4 files changed

+111
-85
lines changed

4 files changed

+111
-85
lines changed

Files UWP/Interacts/Interaction.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -372,21 +372,6 @@ public static T FindParent<T>(DependencyObject child) where T : DependencyObject
372372
return parent;
373373
}
374374

375-
public static void FileList_RightTapped(object sender, RightTappedRoutedEventArgs e)
376-
{
377-
GridView gridView = (GridView)sender;
378-
var selItems = gridView.SelectedItems;
379-
if(selItems.Count > 0)
380-
{
381-
PhotoAlbum.context.ShowAt(gridView);
382-
}
383-
else
384-
{
385-
PhotoAlbum.gridContext.ShowAt(PhotoAlbum.PAPageName, e.GetPosition(PhotoAlbum.PAPageName));
386-
}
387-
388-
}
389-
390375
public static async void OpenItem_Click(object sender, RoutedEventArgs e)
391376
{
392377
if (page.Name == "GenericItemView")

Files UWP/PhotoAlbum.xaml

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -376,18 +376,18 @@
376376
<Grid.ContextFlyout>
377377
<MenuFlyout x:Name="GridRightClickContextMenu">
378378
<MenuFlyout.Items>
379-
<MenuFlyoutItem Text="Refresh" Name="RefreshGrid">
379+
<MenuFlyoutItem Click="RefreshGrid_Click" Text="Refresh" Name="RefreshGrid">
380380
<MenuFlyoutItem.Icon>
381381
<FontIcon Glyph="&#xE72C;"/>
382382
</MenuFlyoutItem.Icon>
383383
</MenuFlyoutItem>
384-
<MenuFlyoutItem Text="Paste" IsEnabled="{x:Bind local3:Interaction.PS.isEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Name="PasteGrid">
384+
<MenuFlyoutItem Click="PasteGrid_Click" Text="Paste" IsEnabled="{x:Bind local3:Interaction.PS.isEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Name="PasteGrid">
385385
<MenuFlyoutItem.Icon>
386386
<FontIcon Glyph="&#xE77F;"/>
387387
</MenuFlyoutItem.Icon>
388388
</MenuFlyoutItem>
389389
<MenuFlyoutSeparator/>
390-
<MenuFlyoutItem Text="Properties" Name="PropertiesItemGrid">
390+
<MenuFlyoutItem Click="PropertiesItemGrid_Click" Text="Properties" Name="PropertiesItemGrid">
391391
<MenuFlyoutItem.Icon>
392392
<FontIcon Glyph="&#xE946;"/>
393393
</MenuFlyoutItem.Icon>
@@ -398,57 +398,57 @@
398398
<ProgressBar Visibility="{x:Bind local:App.Loading.isVisible, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Height="10" VerticalAlignment="Top" IsIndeterminate="True"/>
399399
<TextBlock Name="EmptyText" Visibility="{x:Bind local:App.ViewModel.TextState.isVisible, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" Text="This folder is empty." TextWrapping="Wrap" VerticalAlignment="Top" Margin="0,125,0,0" Grid.Row="3" Canvas.ZIndex="0"/>
400400

401-
<controls:AdaptiveGridView animations:ReorderGridAnimation.Duration="300" ShowsScrollingPlaceholders="True" Margin="24,24,24,0" Grid.Row="3" SelectionMode="Extended" IsDoubleTapEnabled="True" IsRightTapEnabled="True" ItemsSource="{x:Bind local:App.ViewModel.FilesAndFolders}" Name="FileList" Padding="0, 0, 0, 0" >
402-
<controls:AdaptiveGridView.Resources>
403-
<MenuFlyout x:Name="RightClickContextMenu" x:Key="RightClickFlyout">
404-
<MenuFlyout.Items>
405-
<MenuFlyoutItem Text="Open With..." Name="OpenItem">
406-
<MenuFlyoutItem.Icon>
407-
<FontIcon Glyph="&#xE7AC;"/>
408-
</MenuFlyoutItem.Icon>
409-
</MenuFlyoutItem>
410-
<MenuFlyoutItem Text="Share" Name="ShareItem">
411-
<MenuFlyoutItem.Icon>
412-
<FontIcon Glyph="&#xE72D;"/>
413-
</MenuFlyoutItem.Icon>
414-
</MenuFlyoutItem>
415-
<MenuFlyoutSeparator/>
416-
<MenuFlyoutItem Text="Delete" Name="DeleteItem" >
417-
<MenuFlyoutItem.Icon>
418-
<FontIcon Glyph="&#xE74D;"/>
419-
</MenuFlyoutItem.Icon>
420-
</MenuFlyoutItem>
421-
<MenuFlyoutItem Text="Rename" Name="RenameItem" >
422-
<MenuFlyoutItem.Icon>
423-
<FontIcon Glyph="&#xE8AC;"/>
424-
</MenuFlyoutItem.Icon>
425-
</MenuFlyoutItem>
426-
<MenuFlyoutSeparator/>
427-
<MenuFlyoutItem Text="Cut" Name="CutItem" >
428-
<MenuFlyoutItem.Icon>
429-
<FontIcon Glyph="&#xE8C6;"/>
430-
</MenuFlyoutItem.Icon>
431-
</MenuFlyoutItem>
432-
<MenuFlyoutItem Text="Copy" Name="CopyItem" >
433-
<MenuFlyoutItem.Icon>
434-
<FontIcon Glyph="&#xE8C8;"/>
435-
</MenuFlyoutItem.Icon>
436-
</MenuFlyoutItem>
437-
438-
<MenuFlyoutSeparator/>
439-
<MenuFlyoutItem Text="Properties" Name="PropertiesItem">
440-
<MenuFlyoutItem.Icon>
441-
<FontIcon Glyph="&#xE946;"/>
442-
</MenuFlyoutItem.Icon>
443-
</MenuFlyoutItem>
444-
</MenuFlyout.Items>
445-
446-
</MenuFlyout>
447-
</controls:AdaptiveGridView.Resources>
448-
401+
<controls:AdaptiveGridView animations:ReorderGridAnimation.Duration="300" ShowsScrollingPlaceholders="True" Margin="24,24,24,0" Grid.Row="3" SelectionMode="Extended" IsRightTapEnabled="True" IsDoubleTapEnabled="True" ItemsSource="{x:Bind local:App.ViewModel.FilesAndFolders}" Name="FileList" Padding="0, 0, 0, 0" >
449402
<controls:AdaptiveGridView.ItemTemplate>
450403
<DataTemplate>
451-
<Grid IsRightTapEnabled="True" RightTapped="Grid_RightTapped" Margin="0, 0, 0, 0" Padding="5, 5, 5, 5" Width="150" Height="150" HorizontalAlignment="Center" VerticalAlignment="Center">
404+
<Grid ToolTipService.ToolTip="{Binding FileName}" Background="Transparent" IsRightTapEnabled="True" Margin="0, 0, 0, 0" Padding="5, 5, 5, 5" Width="150" Height="150" HorizontalAlignment="Center" VerticalAlignment="Center">
405+
<Grid.ContextFlyout>
406+
<MenuFlyout x:Name="RightClickContextMenu">
407+
<MenuFlyout.Items>
408+
<MenuFlyoutItem Click="OpenItem_Click" Text="Open With..." Name="OpenItem">
409+
<MenuFlyoutItem.Icon>
410+
<FontIcon Glyph="&#xE7AC;"/>
411+
</MenuFlyoutItem.Icon>
412+
</MenuFlyoutItem>
413+
<MenuFlyoutItem Click="ShareItem_Click" Text="Share" Name="ShareItem">
414+
<MenuFlyoutItem.Icon>
415+
<FontIcon Glyph="&#xE72D;"/>
416+
</MenuFlyoutItem.Icon>
417+
</MenuFlyoutItem>
418+
<MenuFlyoutSeparator/>
419+
<MenuFlyoutItem Click="DeleteItem_Click" Text="Delete" Name="DeleteItem" >
420+
<MenuFlyoutItem.Icon>
421+
<FontIcon Glyph="&#xE74D;"/>
422+
</MenuFlyoutItem.Icon>
423+
</MenuFlyoutItem>
424+
<MenuFlyoutItem Click="RenameItem_Click" Text="Rename" Name="RenameItem" >
425+
<MenuFlyoutItem.Icon>
426+
<FontIcon Glyph="&#xE8AC;"/>
427+
</MenuFlyoutItem.Icon>
428+
</MenuFlyoutItem>
429+
<MenuFlyoutSeparator/>
430+
<MenuFlyoutItem Click="CutItem_Click" Text="Cut" Name="CutItem" >
431+
<MenuFlyoutItem.Icon>
432+
<FontIcon Glyph="&#xE8C6;"/>
433+
</MenuFlyoutItem.Icon>
434+
</MenuFlyoutItem>
435+
<MenuFlyoutItem Click="CopyItem_Click" Text="Copy" Name="CopyItem" >
436+
<MenuFlyoutItem.Icon>
437+
<FontIcon Glyph="&#xE8C8;"/>
438+
</MenuFlyoutItem.Icon>
439+
</MenuFlyoutItem>
440+
441+
<MenuFlyoutSeparator/>
442+
<MenuFlyoutItem Click="PropertiesItem_Click" Text="Properties" Name="PropertiesItem">
443+
<MenuFlyoutItem.Icon>
444+
<FontIcon Glyph="&#xE946;"/>
445+
</MenuFlyoutItem.Icon>
446+
</MenuFlyoutItem>
447+
</MenuFlyout.Items>
448+
449+
</MenuFlyout>
450+
</Grid.ContextFlyout>
451+
452452
<Grid.RowDefinitions>
453453
<RowDefinition Height="75*"/>
454454
<RowDefinition Height="25*"/>

Files UWP/PhotoAlbum.xaml.cs

Lines changed: 54 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using Windows.ApplicationModel.DataTransfer;
1414
using Files.Navigation;
1515
using System.Diagnostics;
16+
using Windows.UI.Xaml.Media.Animation;
1617

1718
namespace Files
1819
{
@@ -34,11 +35,8 @@ public PhotoAlbum()
3435
this.InitializeComponent();
3536
PAPageName = PhotoAlbumViewer;
3637
gv = FileList;
37-
context = RightClickContextMenu;
3838
gridContext = GridRightClickContextMenu;
3939
Clipboard.ContentChanged += Clipboard_ContentChanged;
40-
ShareItem.Click += Interaction.ShareItem_Click;
41-
RenameItem.Click += Interaction.RenameItem_Click;
4240
}
4341

4442

@@ -54,14 +52,6 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
5452
App.ViewModel.AddItemsToCollectionAsync(parameters, PhotoAlbumViewer);
5553
Interaction.page = this;
5654
FileList.DoubleTapped += Interaction.List_ItemClick;
57-
58-
FileList.RightTapped += Interaction.FileList_RightTapped;
59-
OpenItem.Click += Interaction.OpenItem_Click;
60-
CopyItem.Click += Interaction.CopyItem_ClickAsync;
61-
RefreshGrid.Click += NavigationActions.Refresh_Click;
62-
63-
DeleteItem.Click += Interaction.DeleteItem_Click;
64-
6555

6656
if (parameters.Equals(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)))
6757
{
@@ -127,12 +117,6 @@ private void Clipboard_ContentChanged(object sender, object e)
127117

128118
}
129119

130-
private void Grid_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e)
131-
{
132-
var ObjectPressed = (sender as Grid).DataContext as ListedItem;
133-
gv.SelectedItem = ObjectPressed;
134-
context.ShowAt(sender as Grid, e.GetPosition(sender as Grid));
135-
}
136120

137121
private void FileList_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
138122
{
@@ -159,5 +143,58 @@ private void NameDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogBu
159143
{
160144
inputForRename = inputFromRename.Text;
161145
}
146+
147+
private void OpenItem_Click(object sender, RoutedEventArgs e)
148+
{
149+
Interaction.OpenItem_Click(null, null);
150+
}
151+
152+
private void ShareItem_Click(object sender, RoutedEventArgs e)
153+
{
154+
Interaction.ShareItem_Click(null, null);
155+
}
156+
157+
private void DeleteItem_Click(object sender, RoutedEventArgs e)
158+
{
159+
Interaction.DeleteItem_Click(null, null);
160+
}
161+
162+
private void RenameItem_Click(object sender, RoutedEventArgs e)
163+
{
164+
Interaction.RenameItem_Click(null, null);
165+
}
166+
167+
private void CutItem_Click(object sender, RoutedEventArgs e)
168+
{
169+
Interaction.CutItem_Click(null, null);
170+
}
171+
172+
private void CopyItem_Click(object sender, RoutedEventArgs e)
173+
{
174+
Interaction.CopyItem_ClickAsync(null, null);
175+
}
176+
177+
private async void PropertiesItem_Click(object sender, RoutedEventArgs e)
178+
{
179+
ProHome.accessiblePropertiesFrame.Navigate(typeof(Properties), (PhotoAlbum.gv.SelectedItem as ListedItem).FilePath, new SuppressNavigationTransitionInfo());
180+
await ProHome.propertiesBox.ShowAsync();
181+
182+
}
183+
184+
private void RefreshGrid_Click(object sender, RoutedEventArgs e)
185+
{
186+
NavigationActions.Refresh_Click(null, null);
187+
}
188+
189+
private void PasteGrid_Click(object sender, RoutedEventArgs e)
190+
{
191+
Interaction.PasteItem_ClickAsync(null, null);
192+
}
193+
194+
private async void PropertiesItemGrid_Click(object sender, RoutedEventArgs e)
195+
{
196+
ProHome.accessiblePropertiesFrame.Navigate(typeof(Properties), App.PathText.Text, new SuppressNavigationTransitionInfo());
197+
await ProHome.propertiesBox.ShowAsync();
198+
}
162199
}
163200
}

Files UWP/ProHome.xaml.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ namespace Files
2929
public sealed partial class ProHome : Page
3030
{
3131
public static ContentDialog permissionBox;
32+
public static ContentDialog propertiesBox;
3233
public static ListView locationsList;
3334
public static ListView drivesList;
3435
public static Frame accessibleContentFrame;
36+
public static Frame accessiblePropertiesFrame;
3537
public static Button BackButton;
3638
public static Button ForwardButton;
3739
public static Button accessiblePasteButton;
@@ -64,8 +66,10 @@ public ProHome()
6466
locationsList = LocationsList;
6567
drivesList = DrivesList;
6668
accessibleContentFrame = ItemDisplayFrame;
69+
accessiblePropertiesFrame = propertiesFrame;
6770
AddItemBox = AddDialog;
6871
NameBox = NameDialog;
72+
propertiesBox = PropertiesDialog;
6973
inputFromRename = RenameInput;
7074
BackButton = Back;
7175
ForwardButton = Forward;
@@ -699,7 +703,7 @@ private void NameDialog_SecondaryButtonClick(ContentDialog sender, ContentDialog
699703
inputForRename = null;
700704
}
701705

702-
private async void ShowPropertiesButton_Click(object sender, RoutedEventArgs e)
706+
public async void ShowPropertiesButton_Click(object sender, RoutedEventArgs e)
703707
{
704708

705709
if (Interaction.page.Name == "GenericItemView")

0 commit comments

Comments
 (0)