Skip to content

Commit 311e5e5

Browse files
author
Yair Aichenbaum
committed
Improved layout modes
1 parent 99edea6 commit 311e5e5

File tree

2 files changed

+33
-54
lines changed

2 files changed

+33
-54
lines changed

Files/UserControls/YourHome.xaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,6 @@
832832
Padding="0,0,0,0"
833833
DesiredWidth="175"
834834
IsItemClickEnabled="True"
835-
ItemClick="CardPressed"
836835
ItemContainerStyle="{StaticResource AdaptiveGridViewItemContainerStyle2}"
837836
ItemHeight="100"
838837
ItemsSource="{x:Bind list:ItemLoader.itemsAdded}"
@@ -866,7 +865,7 @@
866865
BorderThickness="1"
867866
IsTapEnabled="True"
868867
Style="{ThemeResource ButtonRevealStyle}"
869-
Tag="{Binding Icon}"
868+
Tag="{Binding Tag}"
870869
Tapped="Button_Tapped">
871870
<StackPanel Orientation="Vertical" Spacing="10">
872871
<TextBlock

Files/UserControls/YourHome.xaml.cs

Lines changed: 32 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -83,36 +83,6 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
8383
public bool recentsListVis { get; set; } = true;
8484
public bool drivesListVis { get; set; } = false;
8585

86-
private void CardPressed(object sender, ItemClickEventArgs e)
87-
{
88-
string BelowCardText = ((Locations.FavoriteLocationItem)e.ClickedItem).Tag;
89-
if (BelowCardText == "Downloads")
90-
{
91-
App.CurrentInstance.ContentFrame.Navigate(typeof(GenericFileBrowser), App.AppSettings.DownloadsPath);
92-
//(App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.LayoutItems.isEnabled = true;
93-
}
94-
else if (BelowCardText == "Documents")
95-
{
96-
App.CurrentInstance.ContentFrame.Navigate(typeof(GenericFileBrowser), App.AppSettings.DocumentsPath);
97-
//(App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.LayoutItems.isEnabled = true;
98-
}
99-
else if (BelowCardText == "Pictures")
100-
{
101-
App.CurrentInstance.ContentFrame.Navigate(typeof(PhotoAlbum), App.AppSettings.PicturesPath);
102-
//(App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.LayoutItems.isEnabled = true;
103-
}
104-
else if (BelowCardText == "Music")
105-
{
106-
App.CurrentInstance.ContentFrame.Navigate(typeof(GenericFileBrowser), App.AppSettings.MusicPath);
107-
//(App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.LayoutItems.isEnabled = true;
108-
}
109-
else if (BelowCardText == "Videos")
110-
{
111-
App.CurrentInstance.ContentFrame.Navigate(typeof(GenericFileBrowser), App.AppSettings.VideosPath);
112-
//(App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.LayoutItems.isEnabled = true;
113-
}
114-
}
115-
11686
private void DropShadowPanel_PointerEntered(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
11787
{
11888
(sender as DropShadowPanel).ShadowOpacity = 0.25;
@@ -125,31 +95,41 @@ private void DropShadowPanel_PointerExited(object sender, Windows.UI.Xaml.Input.
12595

12696
private void Button_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
12797
{
128-
var clickedButton = sender as Button;
129-
if (clickedButton.Tag.ToString() == "\xE896") // Downloads
130-
{
131-
App.CurrentInstance.ContentFrame.Navigate(typeof(GenericFileBrowser), App.AppSettings.DownloadsPath);
132-
//(App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.LayoutItems.isEnabled = true;
133-
}
134-
else if (clickedButton.Tag.ToString() == "\xE8A5") // Documents
135-
{
136-
App.CurrentInstance.ContentFrame.Navigate(typeof(GenericFileBrowser), App.AppSettings.DocumentsPath);
137-
//(App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.LayoutItems.isEnabled = true;
138-
}
139-
else if (clickedButton.Tag.ToString() == "\xEB9F") // Pictures
140-
{
141-
App.CurrentInstance.ContentFrame.Navigate(typeof(PhotoAlbum), App.AppSettings.PicturesPath);
142-
//(App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.LayoutItems.isEnabled = true;
143-
}
144-
else if (clickedButton.Tag.ToString() == "\xEC4F") // Music
98+
string NaviagtionPath = ""; // path to navigate
99+
string ClickedCard = (sender as Button).Tag.ToString();
100+
101+
switch (ClickedCard)
145102
{
146-
App.CurrentInstance.ContentFrame.Navigate(typeof(GenericFileBrowser), App.AppSettings.MusicPath);
147-
//(App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.LayoutItems.isEnabled = true;
103+
case "Downloads":
104+
NaviagtionPath = App.AppSettings.DownloadsPath;
105+
break;
106+
107+
case "Documents":
108+
NaviagtionPath = App.AppSettings.DocumentsPath;
109+
break;
110+
111+
case "Pictures":
112+
NaviagtionPath = App.AppSettings.PicturesPath;
113+
break;
114+
115+
case "Music":
116+
NaviagtionPath = App.AppSettings.MusicPath;
117+
break;
118+
119+
case ("Videos"):
120+
NaviagtionPath = App.AppSettings.VideosPath;
121+
break;
148122
}
149-
else if (clickedButton.Tag.ToString() == "\xE8B2") // Videos
123+
124+
125+
switch (App.AppSettings.LayoutMode)
150126
{
151-
App.CurrentInstance.ContentFrame.Navigate(typeof(GenericFileBrowser), App.AppSettings.VideosPath);
152-
//(App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.LayoutItems.isEnabled = true;
127+
case 0:
128+
App.CurrentInstance.ContentFrame.Navigate(typeof(GenericFileBrowser), NaviagtionPath); // List View
129+
break;
130+
case 1:
131+
App.CurrentInstance.ContentFrame.Navigate(typeof(PhotoAlbum), NaviagtionPath); // Grid View
132+
break;
153133
}
154134
}
155135
public static StorageFile RecentsFile;

0 commit comments

Comments
 (0)