Skip to content

Commit b65e85a

Browse files
lukeblukeb
authored andcommitted
Tweaks to the Item Cut Process
1 parent 04c82c4 commit b65e85a

16 files changed

+243
-442
lines changed

Files UWP/App.xaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public App()
5252
else
5353
{
5454
localSettings.Values["theme"] = "Default";
55+
ProHome.RibbonTeachingTip.IsOpen = false;
5556
}
5657

5758
this.RequestedTheme = SettingsPages.Personalization.TV.ThemeValue;
@@ -63,6 +64,7 @@ public App()
6364
public static Interacts.Home.HomeItemsState HomeItems { get; set; } = new Interacts.Home.HomeItemsState();
6465
public static Interacts.Share.ShareItemsState ShareItems { get; set; } = new Interacts.Share.ShareItemsState();
6566
public static Interacts.Layout.LayoutItemsState LayoutItems { get; set; } = new Interacts.Layout.LayoutItemsState();
67+
public static Interacts.AlwaysPresentCommandsState AlwaysPresentCommands { get; set; } = new Interacts.AlwaysPresentCommandsState();
6668
public static DisplayedPathText PathText { get; set; } = new DisplayedPathText();
6769

6870
/// <summary>

Files UWP/FilesUWP.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<DefaultLanguage>en-US</DefaultLanguage>
1313
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
1414
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.17763.0</TargetPlatformVersion>
15-
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
15+
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
1616
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
1717
<FileAlignment>512</FileAlignment>
1818
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

Files UWP/Filesystem/ItemViewModel.cs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public async void AddItemsToCollectionAsync(string path, Page currentPage)
228228
TextState.isVisible = Visibility.Visible;
229229
}
230230
stopwatch.Stop();
231-
Debug.WriteLine("Loading of items in " + Universal.path + " completed in " + stopwatch.Elapsed.Seconds + " seconds.\n");
231+
Debug.WriteLine("Loading of items in " + Universal.path + " completed in " + stopwatch.Elapsed.Milliseconds + " milliseconds.\n");
232232

233233
}
234234
catch (UnauthorizedAccessException e)
@@ -297,7 +297,9 @@ private async Task AddFolder(StorageFolder folder, string pageName, Cancellation
297297
FileIconVis = Visibility.Collapsed,
298298
FilePath = folder.Path,
299299
EmptyImgVis = Visibility.Collapsed,
300-
FileSize = null
300+
FileSize = null,
301+
RowIndex = _filesAndFolders.Count
302+
301303
});
302304
}
303305
else
@@ -397,7 +399,8 @@ private async Task AddFile(StorageFile file, string pageName, CancellationToken
397399
FileDateReal = itemDate,
398400
FileType = itemType,
399401
FilePath = itemPath,
400-
FileSize = itemSize
402+
FileSize = itemSize,
403+
RowIndex = _filesAndFolders.Count
401404
});
402405
}
403406
else
@@ -483,14 +486,5 @@ await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPrio
483486
_filesRefreshing = false;
484487
Debug.WriteLine("Filesystem refresh complete");
485488
}
486-
487-
//private async void FolderContentsChanged(IStorageQueryResultBase sender, object args)
488-
//{
489-
// if (_foldersRefreshing) { return; }
490-
491-
// _foldersRefreshing = true;
492-
493-
// _foldersRefreshing = false;
494-
//}
495489
}
496490
}

Files UWP/Filesystem/ListedItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ namespace Files.Filesystem
77
public class ListedItem
88
{
99
public string FolderRelativeId { get; }
10-
1110
public Visibility FolderImg { get; set; }
1211
public Visibility FileIconVis { get; set; }
1312
public Visibility EmptyImgVis { get; set; }
@@ -18,6 +17,7 @@ public class ListedItem
1817
public string DotFileExtension { get; set; }
1918
public string FilePath { get; set; }
2019
public string FileSize { get; set; }
20+
public int RowIndex { get; set; }
2121

2222
public DateTimeOffset FileDateReal
2323
{

Files UWP/GenericFileBrowser.xaml

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
xmlns:local2="using:Files.Filesystem"
1313
xmlns:local3="using:Files.Interacts"
1414
Name="GenericItemView"
15-
mc:Ignorable="d" NavigationCacheMode="Required" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" IsRightTapEnabled="True" RightTapped="GenericItemView_RightTapped" PointerReleased="GenericItemView_PointerReleased">
15+
mc:Ignorable="d" NavigationCacheMode="Required" PointerReleased="GenericItemView_PointerReleased" Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
1616
<Page.Resources>
1717
<Style x:Key="TextBoxStyleForPathBar" TargetType="TextBox">
1818
<Setter Property="Foreground" Value="{ThemeResource DefaultTextForegroundThemeBrush}"/>
@@ -144,41 +144,39 @@
144144
</Setter.Value>
145145
</Setter>
146146
</Style>
147-
148147
</Page.Resources>
149-
<Page.ContextFlyout>
150-
<MenuFlyout x:Name="EmptySpaceFlyout">
151-
<MenuFlyout.Items>
152-
<MenuFlyoutItem Text="Refresh" Name="RefreshEmptySpace">
153-
<MenuFlyoutItem.Icon>
154-
<FontIcon Glyph="&#xE72C;"/>
155-
</MenuFlyoutItem.Icon>
156-
</MenuFlyoutItem>
157-
<MenuFlyoutItem Text="Paste" Name="PasteEmptySpace" IsEnabled="{x:Bind local3:Interaction.PS.isEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
158-
<MenuFlyoutItem.Icon>
159-
<FontIcon Glyph="&#xE77F;"/>
160-
</MenuFlyoutItem.Icon>
161-
</MenuFlyoutItem>
162-
<MenuFlyoutItem Text="Open in PowerShell...">
163-
<MenuFlyoutItem.Icon>
164-
<FontIcon Glyph="&#xE756;"/>
165-
</MenuFlyoutItem.Icon>
166-
</MenuFlyoutItem>
167-
<MenuFlyoutSeparator/>
168-
<MenuFlyoutItem Text="Properties">
169-
<MenuFlyoutItem.Icon>
170-
<FontIcon Glyph="&#xE946;"/>
171-
</MenuFlyoutItem.Icon>
172-
</MenuFlyoutItem>
173148

174-
</MenuFlyout.Items>
175-
</MenuFlyout>
176-
</Page.ContextFlyout>
177-
178-
<Grid Name="RootGrid">
179-
<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" Canvas.ZIndex="0"/>
180-
<controls:DataGrid AllowDrop="True" Drop="AllView_DropAsync" DragLeave="AllView_DragLeave" DragStarting="AllView_DragStarting" ContextRequested="AllView_ContextRequested" SelectionChanged="AllView_SelectionChanged" Margin="24,24,0,0" Grid.Row="3" CellEditEnded="AllView_CellEditEnded" FocusVisualPrimaryThickness="0" SelectionMode="Extended" IsDoubleTapEnabled="True" x:FieldModifier="public" x:Name="AllView" AutoGenerateColumns="False" CanDrag="True" DragOver="AllView_DragOver" IsRightTapEnabled="True" CanUserReorderColumns="False" IsReadOnly="True" ItemsSource="{x:Bind local:App.ViewModel.FilesAndFolders}" HorizontalAlignment="Left">
149+
<Grid Background="Transparent" Name="RootGrid">
150+
<Grid.ContextFlyout>
151+
<MenuFlyout>
152+
<MenuFlyout.Items>
153+
<MenuFlyoutItem Text="Refresh" Name="RefreshEmptySpace">
154+
<MenuFlyoutItem.Icon>
155+
<FontIcon Glyph="&#xE72C;"/>
156+
</MenuFlyoutItem.Icon>
157+
</MenuFlyoutItem>
158+
<MenuFlyoutItem Text="Paste" Name="PasteEmptySpace" IsEnabled="{x:Bind local3:Interaction.PS.isEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
159+
<MenuFlyoutItem.Icon>
160+
<FontIcon Glyph="&#xE77F;"/>
161+
</MenuFlyoutItem.Icon>
162+
</MenuFlyoutItem>
163+
<MenuFlyoutItem Text="Open in PowerShell...">
164+
<MenuFlyoutItem.Icon>
165+
<FontIcon Glyph="&#xE756;"/>
166+
</MenuFlyoutItem.Icon>
167+
</MenuFlyoutItem>
168+
<MenuFlyoutSeparator/>
169+
<MenuFlyoutItem Text="Properties">
170+
<MenuFlyoutItem.Icon>
171+
<FontIcon Glyph="&#xE946;"/>
172+
</MenuFlyoutItem.Icon>
173+
</MenuFlyoutItem>
181174

175+
</MenuFlyout.Items>
176+
</MenuFlyout>
177+
</Grid.ContextFlyout>
178+
<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"/>
179+
<controls:DataGrid DataContext="{x:Bind local:App.ViewModel.FilesAndFolders}" RowDetailsVisibilityMode="Collapsed" AllowDrop="True" Drop="AllView_DropAsync" DragLeave="AllView_DragLeave" DragStarting="AllView_DragStarting" SelectionChanged="AllView_SelectionChanged" Margin="24,24,0,0" Grid.Row="3" CellEditEnded="AllView_CellEditEnded" FocusVisualPrimaryThickness="0" SelectionMode="Extended" IsDoubleTapEnabled="True" x:FieldModifier="public" x:Name="AllView" AutoGenerateColumns="False" CanDrag="True" DragOver="AllView_DragOver" IsRightTapEnabled="True" CanUserReorderColumns="False" IsReadOnly="True" ItemsSource="{x:Bind local:App.ViewModel.FilesAndFolders}" HorizontalAlignment="Left">
182180
<controls:DataGrid.ColumnHeaderStyle>
183181
<Style TargetType="controlsprimitives:DataGridColumnHeader">
184182
<Setter Property="ContextFlyout">
@@ -282,7 +280,8 @@
282280
<controls:DataGridTemplateColumn IsReadOnly="True">
283281
<controls:DataGridTemplateColumn.CellTemplate>
284282
<DataTemplate>
285-
<Grid Margin="15, 0, 0, 0">
283+
<Grid Name="Icon" Margin="15, 0, 0, 0">
284+
<Rectangle Visibility="Collapsed" Name="CutIndicator" Opacity="0.1" Fill="LightGray"/>
286285
<FontIcon Visibility="{Binding FolderImg}" Glyph="&#xE8D5;" FontFamily="Segoe MDL2 Assets" Foreground="#ffe793"/>
287286
<FontIcon Visibility="{Binding EmptyImgVis}" Glyph="&#xE7C3;" FontFamily="Segoe MDL2 Assets"/>
288287
<Image Visibility="{Binding FileIconVis}" Height="20" Width="20" Source="{Binding FileImg}" Stretch="UniformToFill" />
@@ -293,7 +292,7 @@
293292
<controls:DataGridTextColumn IsReadOnly="True" Header="Name" Width="275" Binding="{Binding FileName}" Tag="Name"/>
294293
<controls:DataGridTextColumn IsReadOnly="True" Header="Date modified" Width="Auto" Binding="{Binding FileDate}" Tag="Date"/>
295294
<controls:DataGridTextColumn IsReadOnly="True" Header="Type" Width="150" Binding="{Binding FileType}" Tag="Type"/>
296-
<controls:DataGridTextColumn IsReadOnly="True" Header="Size" Binding="{Binding FileSize}" Tag="Size"/>
295+
<controls:DataGridTextColumn IsReadOnly="True" Header="Size" Width="100" Binding="{Binding FileSize}" Tag="Size"/>
297296
</controls:DataGrid.Columns>
298297
</controls:DataGrid>
299298

Files UWP/GenericFileBrowser.xaml.cs

Lines changed: 10 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,10 @@ public GenericFileBrowser()
6161
CopyItem.Click += Interaction.CopyItem_ClickAsync;
6262
AllView.RightTapped += Interaction.AllView_RightTapped;
6363
AllView.DoubleTapped += Interaction.List_ItemClick;
64-
//Clipboard.ContentChanged += Clipboard_ContentChanged;
64+
Clipboard.ContentChanged += Clipboard_ContentChanged;
6565
//AddItemBox = AddDialog;
6666
//NameBox = NameDialog;
6767
//inputFromRename = RenameInput;
68-
emptySpaceContext = EmptySpaceFlyout;
6968
RefreshEmptySpace.Click += NavigationActions.Refresh_Click;
7069
PasteEmptySpace.Click += Interaction.PasteItem_ClickAsync;
7170
//CopiedFlyout = CopiedPathFlyout;
@@ -107,126 +106,52 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
107106
base.OnNavigatedTo(eventArgs);
108107
ProHome.BackButton.IsEnabled = ProHome.accessibleContentFrame.CanGoBack;
109108
ProHome.ForwardButton.IsEnabled = ProHome.accessibleContentFrame.CanGoForward;
109+
ProHome.RS.isEnabled = true;
110+
App.AlwaysPresentCommands.isEnabled = true;
110111
var parameters = (string)eventArgs.Parameter;
111112
App.ViewModel.CancelLoadAndClearFiles();
112113
App.ViewModel.Universal.path = parameters;
113-
//ProHome.BackButton.Click += NavigationActions.Back_Click;
114-
//ProHome.ForwardButton.Click += NavigationActions.Forward_Click;
115114
ProHome.RefreshButton.Click += NavigationActions.Refresh_Click;
116115
ProHome.AddItemButton.Click += AddItem_Click;
117116
App.ViewModel.AddItemsToCollectionAsync(App.ViewModel.Universal.path, GenericItemView);
117+
Interaction.page = this;
118118
if (parameters.Equals(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)))
119119
{
120120
App.PathText.Text = "Desktop";
121-
//foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
122-
//{
123-
// if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Name.ToString() == "DesktopIC")
124-
// {
125-
// MainPage.Select.itemSelected = NavItemChoice;
126-
// break;
127-
// }
128-
//}
129121
}
130122
else if (parameters.Equals(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)))
131123
{
132124
App.PathText.Text = "Documents";
133-
//foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
134-
//{
135-
// if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Name.ToString() == "DocumentsIC")
136-
// {
137-
// MainPage.Select.itemSelected = NavItemChoice;
138-
// break;
139-
// }
140-
//}
141125
}
142126
else if (parameters.Equals(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\Downloads"))
143127
{
144128
App.PathText.Text = "Downloads";
145-
//foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
146-
//{
147-
// if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Name.ToString() == "DownloadsIC")
148-
// {
149-
// MainPage.Select.itemSelected = NavItemChoice;
150-
// break;
151-
// }
152-
//}
153129
}
154130
else if (parameters.Equals(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures)))
155131
{
156132
App.PathText.Text = "Pictures";
157-
//foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
158-
//{
159-
// if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Name.ToString() == "PicturesIC")
160-
// {
161-
// MainPage.Select.itemSelected = NavItemChoice;
162-
// break;
163-
// }
164-
//}
165133
}
166134
else if (parameters.Equals(Environment.GetFolderPath(Environment.SpecialFolder.MyMusic)))
167135
{
168136
App.PathText.Text = "Music";
169-
//foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
170-
//{
171-
// if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Name.ToString() == "MusicIC")
172-
// {
173-
// MainPage.Select.itemSelected = NavItemChoice;
174-
// break;
175-
// }
176-
//}
177137
}
178138
else if (parameters.Equals(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\OneDrive"))
179139
{
180140
App.PathText.Text = "OneDrive";
181-
//foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
182-
//{
183-
// if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Name.ToString() == "OneD_IC")
184-
// {
185-
// MainPage.Select.itemSelected = NavItemChoice;
186-
// break;
187-
// }
188-
//}
189141
}
190142
else if (parameters.Equals(Environment.GetFolderPath(Environment.SpecialFolder.MyVideos)))
191143
{
192144
App.PathText.Text = "Videos";
193-
//foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
194-
//{
195-
// if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Name.ToString() == "VideosIC")
196-
// {
197-
// MainPage.Select.itemSelected = NavItemChoice;
198-
// break;
199-
// }
200-
//}
201145
}
202146
else
203147
{
204-
//App.ViewModel.Universal.path = parameters;
205148
App.PathText.Text = parameters;
206-
if (parameters.Contains("C:\\") || parameters.Contains("c:\\"))
207-
{
208-
//foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
209-
//{
210-
// if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Tag.ToString() == "LDPage")
211-
// {
212-
// MainPage.Select.itemSelected = NavItemChoice;
213-
// break;
214-
// }
215-
//}
216-
}
217-
else
218-
{
219-
//foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
220-
//{
221-
// if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Tag.ToString().Contains(parameters.Split("\\")[0]))
222-
// {
223-
// MainPage.Select.itemSelected = NavItemChoice;
224-
// break;
225-
// }
226-
//}
227-
}
228149
}
229150

151+
if(Interaction.dataGridRows != null)
152+
{
153+
154+
}
230155
}
231156

232157

@@ -301,12 +226,12 @@ private void ContentDialog_Loaded(object sender, RoutedEventArgs e)
301226

302227
private void GenericItemView_PointerReleased(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
303228
{
304-
data.SelectedItems.Clear();
229+
data.SelectedItem = null;
305230
}
306231

307232
private void AllView_SelectionChanged(object sender, SelectionChangedEventArgs e)
308233
{
309-
234+
310235
AllView.CommitEdit();
311236
if(e.AddedItems.Count > 0)
312237
{
@@ -331,22 +256,6 @@ private void NameDialog_SecondaryButtonClick(ContentDialog sender, ContentDialog
331256

332257
}
333258

334-
private async void VisiblePath_TextChanged(object sender, KeyRoutedEventArgs e)
335-
{
336-
337-
338-
}
339-
340-
private void GenericItemView_RightTapped(object sender, RightTappedRoutedEventArgs e)
341-
{
342-
GFBPageName.ContextFlyout.ShowAt(GFBPageName);
343-
}
344-
345-
private void AllView_ContextRequested(UIElement sender, ContextRequestedEventArgs args)
346-
{
347-
348-
}
349-
350259
private void AllView_DragStarting(UIElement sender, DragStartingEventArgs args)
351260
{
352261
args.DragUI.SetContentFromDataPackage();

0 commit comments

Comments
 (0)