Skip to content

Commit 199be7a

Browse files
author
Yair Aichenbaum
committed
Started work on LayoutModes
1 parent fc75bf3 commit 199be7a

File tree

3 files changed

+61
-34
lines changed

3 files changed

+61
-34
lines changed

Files/UserControls/ModernSidebar.xaml.cs

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,16 @@ private void Sidebar_ItemInvoked(Microsoft.UI.Xaml.Controls.NavigationView sende
7676
//(App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.ShareItems.isEnabled = false;
7777
//(App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.LayoutItems.isEnabled = false;
7878
}
79-
else if (ItemPath.Equals(App.AppSettings.PicturesPath, StringComparison.OrdinalIgnoreCase)) // Photo item
80-
{
81-
App.CurrentInstance.ContentFrame.Navigate(typeof(PhotoAlbum), args.InvokedItemContainer.Tag.ToString(), new SuppressNavigationTransitionInfo());
82-
83-
//(App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.HomeItems.isEnabled = false;
84-
//(App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.ShareItems.isEnabled = false;
85-
//(App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.LayoutItems.isEnabled = true;
86-
87-
}
8879
else // Any other item
8980
{
90-
App.CurrentInstance.ContentFrame.Navigate(typeof(GenericFileBrowser), args.InvokedItemContainer.Tag.ToString(), new SuppressNavigationTransitionInfo());
91-
81+
if (App.AppSettings.LayoutMode == 0) // List View
82+
{
83+
App.CurrentInstance.ContentFrame.Navigate(typeof(GenericFileBrowser), args.InvokedItemContainer.Tag.ToString(), new SuppressNavigationTransitionInfo());
84+
}
85+
else
86+
{
87+
App.CurrentInstance.ContentFrame.Navigate(typeof(PhotoAlbum), args.InvokedItemContainer.Tag.ToString(), new SuppressNavigationTransitionInfo());
88+
}
9289
//(App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.HomeItems.isEnabled = false;
9390
//(App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.ShareItems.isEnabled = false;
9491
//(App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.LayoutItems.isEnabled = true;
@@ -98,14 +95,29 @@ private void Sidebar_ItemInvoked(Microsoft.UI.Xaml.Controls.NavigationView sende
9895
}
9996
case NavigationControlItemType.OneDrive:
10097
{
101-
App.CurrentInstance.ContentFrame.Navigate(typeof(GenericFileBrowser), App.AppSettings.OneDrivePath, new SuppressNavigationTransitionInfo());
98+
if (App.AppSettings.LayoutMode == 0) // List View
99+
{
100+
App.CurrentInstance.ContentFrame.Navigate(typeof(GenericFileBrowser), App.AppSettings.OneDrivePath, new SuppressNavigationTransitionInfo());
101+
}
102+
else
103+
{
104+
App.CurrentInstance.ContentFrame.Navigate(typeof(PhotoAlbum), App.AppSettings.OneDrivePath, new SuppressNavigationTransitionInfo());
105+
}
102106
break;
103107
}
104108
default:
105109
{
106110
var clickedItem = args.InvokedItemContainer;
107111

108-
App.CurrentInstance.ContentFrame.Navigate(typeof(GenericFileBrowser), clickedItem.Tag.ToString(), new SuppressNavigationTransitionInfo());
112+
if (App.AppSettings.LayoutMode == 0) // List View
113+
{
114+
App.CurrentInstance.ContentFrame.Navigate(typeof(GenericFileBrowser), clickedItem.Tag.ToString(), new SuppressNavigationTransitionInfo());
115+
}
116+
else
117+
{
118+
App.CurrentInstance.ContentFrame.Navigate(typeof(PhotoAlbum), clickedItem.Tag.ToString(), new SuppressNavigationTransitionInfo());
119+
}
120+
109121
App.CurrentInstance.NavigationToolbar.PathControlDisplayText = clickedItem.Tag.ToString();
110122
//(App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.LayoutItems.isEnabled = true;
111123

Files/UserControls/NavigationToolbar/ModernNavigationToolbar.xaml.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,15 @@ public async void CheckPathInput(ItemViewModel instance, string CurrentInput)
244244
try
245245
{
246246
await StorageFolder.GetFolderFromPathAsync(CurrentInput);
247-
App.CurrentInstance.ContentFrame.Navigate(typeof(GenericFileBrowser), CurrentInput); // navigate to folder
247+
248+
if (App.AppSettings.LayoutMode == 0) // List View
249+
{
250+
App.CurrentInstance.ContentFrame.Navigate(typeof(GenericFileBrowser), CurrentInput); // navigate to folder
251+
}
252+
else
253+
{
254+
App.CurrentInstance.ContentFrame.Navigate(typeof(PhotoAlbum), CurrentInput); // navigate to folder
255+
}
248256
}
249257
catch (Exception) // Not a folder or inaccessible
250258
{
@@ -292,7 +300,14 @@ private void PathViewInteract_ItemClick(object sender, ItemClickEventArgs e)
292300
if (itemTappedPath == "Home" || itemTappedPath == "New tab")
293301
return;
294302

295-
App.CurrentInstance.ContentFrame.Navigate(typeof(GenericFileBrowser), itemTappedPath, new SuppressNavigationTransitionInfo());
303+
if (App.AppSettings.LayoutMode == 0) // List View
304+
{
305+
App.CurrentInstance.ContentFrame.Navigate(typeof(GenericFileBrowser), itemTappedPath); // navigate to folder
306+
}
307+
else
308+
{
309+
App.CurrentInstance.ContentFrame.Navigate(typeof(PhotoAlbum), itemTappedPath); // navigate to folder
310+
}
296311
}
297312
}
298313
}

Files/View Models/SettingsViewModel.cs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
using Files.Enums;
1+
using Files.DataModels;
2+
using Files.Enums;
3+
using Files.Filesystem;
24
using GalaSoft.MvvmLight;
5+
using GalaSoft.MvvmLight.Command;
6+
using Newtonsoft.Json;
37
using System;
48
using System.Collections.Generic;
59
using System.Collections.ObjectModel;
10+
using System.Diagnostics;
611
using System.IO;
712
using System.Linq;
813
using Windows.ApplicationModel;
914
using Windows.Storage;
1015
using Windows.UI;
1116
using Windows.UI.ViewManagement;
1217
using Windows.UI.Xaml;
13-
using Files.Filesystem;
14-
using Newtonsoft.Json;
15-
using Files.DataModels;
16-
using System.Diagnostics;
17-
using GalaSoft.MvvmLight.Command;
1818

1919
namespace Files.View_Models
2020
{
@@ -153,7 +153,7 @@ private async void PopulatePinnedSidebarItems()
153153
private void RemoveAllSidebarItems(NavigationControlItemType type)
154154
{
155155
var itemsOfType = App.sideBarItems.TakeWhile(x => x.ItemType == type);
156-
foreach(var item in itemsOfType)
156+
foreach (var item in itemsOfType)
157157
{
158158
App.sideBarItems.Remove(item);
159159
}
@@ -394,7 +394,7 @@ private async void LoadTerminalApps()
394394
}
395395

396396
private SidebarOpacity _SidebarThemeMode = SidebarOpacity.Opaque;
397-
397+
398398
private IList<TerminalModel> _Terminals = null;
399399
public IList<TerminalModel> Terminals
400400
{
@@ -498,9 +498,9 @@ public bool ShowConfirmDeleteDialog
498498
public bool PinOneDriveToSideBar
499499
{
500500
get => _PinOneDriveToSideBar;
501-
set
502-
{
503-
if(value != _PinOneDriveToSideBar)
501+
set
502+
{
503+
if (value != _PinOneDriveToSideBar)
504504
{
505505
Set(ref _PinOneDriveToSideBar, value);
506506
if (value == true)
@@ -637,14 +637,14 @@ public bool ShowRibbonContent
637637
}
638638
}
639639

640-
private string _ToggleLayoutModeIcon = ""; // Grid View
640+
private string _ToggleLayoutModeIcon = ""; // List View
641641
public string ToggleLayoutModeIcon
642642
{
643643
get => _ToggleLayoutModeIcon;
644644
set => Set(ref _ToggleLayoutModeIcon, value);
645645
}
646646

647-
private Int16 _LayoutMode = 0; // Grid View
647+
private Int16 _LayoutMode = 0; // List View
648648
public Int16 LayoutMode
649649
{
650650
get => _LayoutMode;
@@ -654,27 +654,27 @@ public Int16 LayoutMode
654654
private RelayCommand toggleLayoutMode;
655655
public RelayCommand ToggleLayoutMode => toggleLayoutMode = new RelayCommand(() =>
656656
{
657-
if (LayoutMode == 0) // Grid View
657+
if (LayoutMode == 0) // List View
658658
{
659-
LayoutMode = 1; // List View
659+
LayoutMode = 1; // Grid View
660660
}
661661
else
662662
{
663-
LayoutMode = 0; // Grid View
663+
LayoutMode = 0; // List View
664664
}
665665

666666
UpdateToggleLayouModeIcon();
667667
});
668668

669669
public void UpdateToggleLayouModeIcon()
670670
{
671-
if (LayoutMode == 0) // Grid View
671+
if (LayoutMode == 0) // List View
672672
{
673-
ToggleLayoutModeIcon = ""; // Grid View;
673+
ToggleLayoutModeIcon = ""; // List View;
674674
}
675675
else // List View
676676
{
677-
ToggleLayoutModeIcon = ""; // List View
677+
ToggleLayoutModeIcon = ""; // Grid View
678678
}
679679
}
680680

0 commit comments

Comments
 (0)