Skip to content

Commit 0386172

Browse files
lukeblukeb
authored andcommitted
Make Empty Folder Text Dis/Appear More Consistently
1 parent 107fe6b commit 0386172

File tree

5 files changed

+21
-27
lines changed

5 files changed

+21
-27
lines changed

Files UWP/Filesystem/ItemViewModel.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,16 @@ public ItemViewModel()
6565
public void AddFileOrFolder(ListedItem item)
6666
{
6767
_filesAndFolders.Add(item);
68+
App.ViewModel.TextState.isVisible = Visibility.Collapsed;
6869
}
6970

7071
public void RemoveFileOrFolder(ListedItem item)
7172
{
7273
_filesAndFolders.Remove(item);
74+
if (_filesAndFolders.Count == 0)
75+
{
76+
App.ViewModel.TextState.isVisible = Visibility.Visible;
77+
}
7378
}
7479

7580
public void CancelLoadAndClearFiles()
@@ -314,6 +319,7 @@ private async Task AddFolder(StorageFolder folder, string pageName, Cancellation
314319
FilePath = folder.Path
315320
});
316321
}
322+
App.ViewModel.TextState.isVisible = Visibility.Collapsed;
317323
}
318324

319325
private async Task AddFile(StorageFile file, string pageName, CancellationToken token)
@@ -418,6 +424,7 @@ private async Task AddFile(StorageFile file, string pageName, CancellationToken
418424
FilePath = itemPath
419425
});
420426
}
427+
App.ViewModel.TextState.isVisible = Visibility.Collapsed;
421428
}
422429

423430
private async void FileContentsChanged(IStorageQueryResultBase sender, object args)
@@ -482,7 +489,6 @@ await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPrio
482489
RemoveFileOrFolder(toRemove);
483490
});
484491
}
485-
486492
_filesRefreshing = false;
487493
Debug.WriteLine("Filesystem refresh complete");
488494
}

Files UWP/GenericFileBrowser.xaml.cs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,15 @@
11
using Microsoft.Toolkit.Uwp.UI.Controls;
22
using System;
33
using System.ComponentModel;
4-
using System.Diagnostics;
5-
using System.Linq;
6-
using Windows.ApplicationModel.Core;
74
using Windows.ApplicationModel.DataTransfer;
85
using Windows.Storage;
9-
using Windows.UI;
10-
using Windows.UI.Core;
11-
using Windows.UI.ViewManagement;
126
using Windows.UI.Xaml;
137
using Windows.UI.Xaml.Controls;
14-
using Windows.UI.Xaml.Media.Animation;
158
using Windows.UI.Xaml.Navigation;
169
using Files.Filesystem;
1710
using Files.Navigation;
1811
using Files.Interacts;
19-
using Windows.System;
20-
using Windows.UI.Xaml.Input;
21-
using Windows.UI.Popups;
22-
using System.IO;
23-
using Windows.UI.Xaml.Controls.Primitives;
24-
using Windows.ApplicationModel.DataTransfer.DragDrop.Core;
25-
using System.Collections.Generic;
12+
using System.Diagnostics;
2613

2714
namespace Files
2815
{
@@ -148,9 +135,14 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
148135
App.PathText.Text = parameters;
149136
}
150137

151-
if (Interaction.dataGridRows != null)
138+
// Reset DataGrid Rows that may be in "cut" command mode
139+
Interaction.FindChildren<DataGridRow>(Interaction.dataGridRows, GenericFileBrowser.GFBPageName.Content);
140+
foreach (DataGridRow dataGridRow in Interaction.dataGridRows)
152141
{
153-
142+
if (data.Columns[0].GetCellContent(dataGridRow).Opacity < 1)
143+
{
144+
data.Columns[0].GetCellContent(dataGridRow).Opacity = 1;
145+
}
154146
}
155147
}
156148

@@ -227,6 +219,8 @@ private void ContentDialog_Loaded(object sender, RoutedEventArgs e)
227219
private void GenericItemView_PointerReleased(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
228220
{
229221
data.SelectedItem = null;
222+
App.HomeItems.isEnabled = false;
223+
App.ShareItems.isEnabled = false;
230224
}
231225

232226
private void AllView_SelectionChanged(object sender, SelectionChangedEventArgs e)

Files UWP/Interacts/Interaction.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,10 +686,10 @@ public async static void CutItem_Click(object sender, RoutedEventArgs e)
686686
if(dataGridRow.GetIndex() == StorItem.RowIndex)
687687
{
688688
Debug.WriteLine(dataGridRow.GetIndex());
689-
dataGrid.Columns[0].GetCellContent(dataGridRow).Opacity = 0.4;
689+
GenericFileBrowser.data.Columns[0].GetCellContent(dataGridRow).Opacity = 0.4;
690690
}
691691
}
692-
var RowPressed = FindParent<DataGridRow>(dataGrid as DependencyObject);
692+
var RowPressed = FindParent<DataGridRow>(GenericFileBrowser.data as DependencyObject);
693693
pathsToDeleteAfterPaste.Add(StorItem.FilePath);
694694
if (StorItem.FileType != "Folder")
695695
{

Files UWP/PhotoAlbum.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,13 @@ private void FileList_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEv
139139
private void PhotoAlbumViewer_PointerReleased(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
140140
{
141141
FileList.SelectedItem = null;
142+
App.HomeItems.isEnabled = false;
143+
App.ShareItems.isEnabled = false;
142144
}
143145

144146
private void PhotoAlbumViewer_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e)
145147
{
146148
gridContext.ShowAt(sender as Grid, e.GetPosition(sender as Grid));
147-
Debug.WriteLine("---context displayed---");
148149
}
149150

150151
private void NameDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)

Files UWP/ProHome.xaml.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,22 @@
11
using Files.Interacts;
2-
using Microsoft.Toolkit.Uwp.UI.Controls;
32
using Microsoft.UI.Xaml.Controls;
43
using System;
5-
using System.Collections.Generic;
64
using System.Collections.ObjectModel;
75
using System.Diagnostics;
86
using System.IO;
97
using System.Linq;
10-
using System.Runtime.InteropServices.WindowsRuntime;
118
using Windows.ApplicationModel.Core;
129
using Windows.Foundation;
13-
using Windows.Foundation.Collections;
1410
using Windows.Storage;
1511
using Windows.System;
1612
using Windows.UI;
1713
using Windows.UI.Popups;
1814
using Windows.UI.ViewManagement;
1915
using Windows.UI.Xaml;
2016
using Windows.UI.Xaml.Controls;
21-
using Windows.UI.Xaml.Controls.Primitives;
22-
using Windows.UI.Xaml.Data;
2317
using Windows.UI.Xaml.Input;
2418
using Windows.UI.Xaml.Media;
2519
using Windows.UI.Xaml.Media.Animation;
26-
using Windows.UI.Xaml.Navigation;
2720

2821
namespace Files
2922
{

0 commit comments

Comments
 (0)