Skip to content

Commit c7de446

Browse files
committed
Utilize UWP Frame Forward Navigation System
1 parent b16f8f4 commit c7de446

File tree

12 files changed

+240
-375
lines changed

12 files changed

+240
-375
lines changed

Files UWP/FilesUWP.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,8 @@
123123
<Compile Include="Interacts\RibbonActions\Layout.cs" />
124124
<Compile Include="Interacts\RibbonActions\Share.cs" />
125125
<Compile Include="LocationsList.cs" />
126-
<Compile Include="Navigation\ArrayDiag.cs" />
127126
<Compile Include="Navigation\BackState.cs" />
128127
<Compile Include="Navigation\ForwardState.cs" />
129-
<Compile Include="Navigation\History.cs" />
130128
<Compile Include="Navigation\NavigationActions.cs" />
131129
<Compile Include="Navigation\PhotoAlbumNavActions.cs" />
132130
<Compile Include="Navigation\UniversalPath.cs" />

Files UWP/Filesystem/ItemViewModel.cs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,10 @@ public async void AddItemsToCollectionAsync(string path, Page currentPage)
142142
{
143143
_rootFolder = await StorageFolder.GetFolderFromPathAsync(Universal.path);
144144

145-
History.AddToHistory(Universal.path);
146-
if (History.HistoryList.Count == 1) // If this is the only item present in History, we don't want back button to be enabled
147-
{
148-
BS.isEnabled = false;
149-
}
150-
else if (History.HistoryList.Count > 1) // Otherwise, if this is not the first item, we'll enable back click
151-
{
152-
BS.isEnabled = true;
153-
}
145+
//History.AddToHistory(Universal.path);
146+
147+
ProHome.BackButton.IsEnabled = ProHome.accessibleContentFrame.CanGoBack;
148+
ProHome.ForwardButton.IsEnabled = ProHome.accessibleContentFrame.CanGoForward;
154149

155150
switch (await _rootFolder.GetIndexedStateAsync())
156151
{

Files UWP/GenericFileBrowser.xaml.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ public GenericFileBrowser()
7474
//PathBarTip.IsOpen = true;
7575
}
7676

77-
78-
79-
private async void AddItem_ClickAsync(object sender, RoutedEventArgs e)
77+
private void AddItem_Click(object sender, RoutedEventArgs e)
8078
{
8179
//await AddDialog.ShowAsync();
8280
}
@@ -107,13 +105,15 @@ private void Clipboard_ContentChanged(object sender, object e)
107105
protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
108106
{
109107
base.OnNavigatedTo(eventArgs);
108+
ProHome.BackButton.IsEnabled = ProHome.accessibleContentFrame.CanGoBack;
109+
ProHome.ForwardButton.IsEnabled = ProHome.accessibleContentFrame.CanGoForward;
110110
var parameters = (string)eventArgs.Parameter;
111111
App.ViewModel.CancelLoadAndClearFiles();
112112
App.ViewModel.Universal.path = parameters;
113113
//ProHome.BackButton.Click += NavigationActions.Back_Click;
114114
//ProHome.ForwardButton.Click += NavigationActions.Forward_Click;
115115
ProHome.RefreshButton.Click += NavigationActions.Refresh_Click;
116-
ProHome.AddItemButton.Click += AddItem_ClickAsync;
116+
ProHome.AddItemButton.Click += AddItem_Click;
117117
App.ViewModel.AddItemsToCollectionAsync(App.ViewModel.Universal.path, GenericItemView);
118118
if (parameters.Equals(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)))
119119
{

Files UWP/Interacts/Interaction.cs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ public static async void List_ItemClick(object sender, DoubleTappedRoutedEventAr
5959
App.ViewModel.Universal.path = clickedOnItem.FilePath;
6060
App.PathText.Text = clickedOnItem.FilePath;
6161
App.ViewModel.TextState.isVisible = Visibility.Collapsed;
62-
History.ForwardList.Clear();
6362
App.ViewModel.FS.isEnabled = false;
6463
App.ViewModel.CancelLoadAndClearFiles();
6564
if (clickedOnItem.FilePath == Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory))
@@ -155,7 +154,6 @@ public static async void List_ItemClick(object sender, DoubleTappedRoutedEventAr
155154
App.ViewModel.Universal.path = clickedOnItem.FilePath;
156155
App.PathText.Text = clickedOnItem.FilePath;
157156
App.ViewModel.TextState.isVisible = Visibility.Collapsed;
158-
History.ForwardList.Clear();
159157
App.ViewModel.FS.isEnabled = false;
160158
App.ViewModel.CancelLoadAndClearFiles();
161159
if (clickedOnItem.FilePath == Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory))
@@ -390,7 +388,6 @@ public static async void OpenItem_Click(object sender, RoutedEventArgs e)
390388
if (RowData.FileType == "Folder")
391389
{
392390
App.ViewModel.TextState.isVisible = Visibility.Collapsed;
393-
History.ForwardList.Clear();
394391
App.ViewModel.FS.isEnabled = false;
395392
App.ViewModel.CancelLoadAndClearFiles();
396393
App.ViewModel.Universal.path = RowData.FilePath;
@@ -412,7 +409,6 @@ public static async void OpenItem_Click(object sender, RoutedEventArgs e)
412409
if (RowData.FileType == "Folder")
413410
{
414411
App.ViewModel.TextState.isVisible = Visibility.Collapsed;
415-
History.ForwardList.Clear();
416412
App.ViewModel.FS.isEnabled = false;
417413
App.ViewModel.CancelLoadAndClearFiles();
418414
App.ViewModel.Universal.path = RowData.FilePath;
@@ -508,7 +504,6 @@ public static async void DeleteItem_Click(object sender, RoutedEventArgs e)
508504
App.ViewModel.RemoveFileOrFolder(storItem);
509505
}
510506
Debug.WriteLine("Ended for loop");
511-
History.ForwardList.Clear();
512507
App.ViewModel.FS.isEnabled = false;
513508
}
514509
else if (page.Name == "PhotoAlbumViewer")
@@ -535,7 +530,6 @@ public static async void DeleteItem_Click(object sender, RoutedEventArgs e)
535530
App.ViewModel.RemoveFileOrFolder(storItem);
536531
}
537532
Debug.WriteLine("Ended for loop");
538-
History.ForwardList.Clear();
539533
App.ViewModel.FS.isEnabled = false;
540534
}
541535

@@ -657,7 +651,6 @@ public static async void RenameItem_Click(object sender, RoutedEventArgs e)
657651
await itemAlreadyExistsDialog.ShowAsync();
658652
}
659653
}
660-
History.ForwardList.Clear();
661654
App.ViewModel.FS.isEnabled = false;
662655
}
663656

@@ -799,14 +792,14 @@ public static async void PasteItem_ClickAsync(object sender, RoutedEventArgs e)
799792
}
800793
}
801794
}
802-
if (page.Name == "GenericItemView")
803-
{
804-
NavigationActions.Refresh_Click(null, null);
805-
}
806-
else if (page.Name == "PhotoAlbumViewer")
807-
{
808-
PhotoAlbumNavActions.Refresh_Click(null, null);
809-
}
795+
//if (page.Name == "GenericItemView")
796+
//{
797+
// NavigationActions.Refresh_Click(null, null);
798+
//}
799+
//else if (page.Name == "PhotoAlbumViewer")
800+
//{
801+
// PhotoAlbumNavActions.Refresh_Click(null, null);
802+
//}
810803

811804

812805
}

Files UWP/Navigation/ArrayDiag.cs

Lines changed: 0 additions & 25 deletions
This file was deleted.

Files UWP/Navigation/History.cs

Lines changed: 0 additions & 65 deletions
This file was deleted.

Files UWP/Navigation/NavigationActions.cs

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -201,46 +201,7 @@ await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatch
201201

202202
App.ViewModel.TextState.isVisible = Visibility.Collapsed;
203203
App.ViewModel.AddItemsToCollectionAsync(App.ViewModel.Universal.path, GenericFileBrowser.GFBPageName);
204-
if ((History.HistoryList[History.HistoryList.Count - 1]) == Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory))
205-
{
206-
App.PathText.Text = "Desktop";
207-
208-
}
209-
else if ((History.HistoryList[History.HistoryList.Count - 1]) == Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments))
210-
{
211-
App.PathText.Text = "Documents";
212-
213-
}
214-
else if ((History.HistoryList[History.HistoryList.Count - 1]) == (Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\Downloads"))
215-
{
216-
App.PathText.Text = "Downloads";
217-
218-
}
219-
else if ((History.HistoryList[History.HistoryList.Count - 1]) == Environment.GetFolderPath(Environment.SpecialFolder.MyPictures))
220-
{
221-
222-
App.PathText.Text = "Pictures";
223-
}
224-
else if ((History.HistoryList[History.HistoryList.Count - 1]) == Environment.GetFolderPath(Environment.SpecialFolder.MyMusic))
225-
{
226-
App.PathText.Text = "Music";
227-
228-
}
229-
else if ((History.HistoryList[History.HistoryList.Count - 1]) == (Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\OneDrive"))
230-
{
231-
App.PathText.Text = "OneDrive";
232-
233-
}
234-
else if ((History.HistoryList[History.HistoryList.Count - 1]) == Environment.GetFolderPath(Environment.SpecialFolder.MyVideos))
235-
{
236-
App.PathText.Text = "Videos";
237-
238-
}
239-
else
240-
{
241-
App.PathText.Text = (History.HistoryList[History.HistoryList.Count - 1]);
242-
243-
}
204+
244205
});
245206
}
246207
}

0 commit comments

Comments
 (0)