Skip to content

Commit 15922e4

Browse files
Luke BlevinsLuke Blevins
authored andcommitted
Fixed PhotoAlbum Dark Mode
1 parent 9f6b8fa commit 15922e4

File tree

7 files changed

+215
-232
lines changed

7 files changed

+215
-232
lines changed

FileLoader.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,17 @@ public static ProgressUIVisibility PVIS
120120
}
121121
}
122122

123-
public ItemViewModel(string ViewPath)
123+
public ItemViewModel(string ViewPath, Page p)
124124
{
125-
125+
// Personalize retrieved items for view they are displayed in
126+
if(p.Name == "GenericItemView")
127+
{
128+
isPhotoAlbumMode = false;
129+
}
130+
else if (p.Name == "PhotoAlbumViewer")
131+
{
132+
isPhotoAlbumMode = true;
133+
}
126134

127135
GenericFileBrowser.P.path = ViewPath;
128136
FilesAndFolders.Clear();

GenericFileBrowser.xaml

Lines changed: 2 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -37,69 +37,7 @@
3737
</Storyboard>
3838
<local1:BackState x:Key="BackObject"/>
3939
<local1:ForwardState x:Key="ForwardObject"/>
40-
<Style x:Key="FluentHistoryButton" TargetType="Button">
41-
<Setter Property="Background" Value="{ThemeResource ButtonRevealBackground}"/>
42-
<Setter Property="Foreground" Value="{ThemeResource ButtonForeground}"/>
43-
<Setter Property="BorderBrush" Value="{ThemeResource ButtonRevealBorderBrush}"/>
44-
<Setter Property="BorderThickness" Value="{ThemeResource ButtonRevealBorderThemeThickness}"/>
45-
<Setter Property="Padding" Value="8,4,8,4"/>
46-
<Setter Property="HorizontalAlignment" Value="Left"/>
47-
<Setter Property="VerticalAlignment" Value="Center"/>
48-
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
49-
<Setter Property="FontWeight" Value="Normal"/>
50-
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
51-
<Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}"/>
52-
<Setter Property="FocusVisualMargin" Value="-3"/>
53-
<Setter Property="Template">
54-
<Setter.Value>
55-
<ControlTemplate TargetType="Button">
56-
<Grid x:Name="RootGrid" Background="{TemplateBinding Background}">
57-
<VisualStateManager.VisualStateGroups>
58-
<VisualStateGroup x:Name="CommonStates">
59-
<VisualState x:Name="Normal">
60-
<Storyboard>
61-
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
62-
</Storyboard>
63-
</VisualState>
64-
<VisualState x:Name="PointerOver">
65-
<VisualState.Setters>
66-
<Setter Target="RootGrid.(RevealBrush.State)" Value="PointerOver"/>
67-
<Setter Target="RootGrid.Background" Value="{ThemeResource ButtonRevealBackgroundPointerOver}"/>
68-
<Setter Target="ContentPresenter.BorderBrush" Value="{ThemeResource ButtonRevealBorderBrushPointerOver}"/>
69-
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource ButtonForegroundPointerOver}"/>
70-
</VisualState.Setters>
71-
<Storyboard>
72-
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
73-
</Storyboard>
74-
</VisualState>
75-
<VisualState x:Name="Pressed">
76-
<VisualState.Setters>
77-
<Setter Target="RootGrid.(RevealBrush.State)" Value="Pressed"/>
78-
<Setter Target="RootGrid.Background" Value="{ThemeResource ButtonRevealBackgroundPressed}"/>
79-
<Setter Target="ContentPresenter.BorderBrush" Value="{ThemeResource ButtonRevealBorderBrushPressed}"/>
80-
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource ButtonForegroundPressed}"/>
81-
</VisualState.Setters>
82-
<Storyboard>
83-
<PointerDownThemeAnimation Storyboard.TargetName="RootGrid"/>
84-
</Storyboard>
85-
</VisualState>
86-
<VisualState x:Name="Disabled">
87-
<VisualState.Setters>
88-
<Setter Target="RootGrid.Background" Value="{ThemeResource ButtonRevealBackgroundDisabled}"/>
89-
<Setter Target="ContentPresenter.BorderBrush" Value="{ThemeResource ButtonRevealBorderBrushDisabled}"/>
90-
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource ButtonForegroundDisabled}"/>
91-
</VisualState.Setters>
92-
</VisualState>
93-
</VisualStateGroup>
94-
</VisualStateManager.VisualStateGroups>
95-
<ContentPresenter x:Name="ContentPresenter" AutomationProperties.AccessibilityView="Raw" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentTransitions="{TemplateBinding ContentTransitions}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
96-
</Grid>
97-
</ControlTemplate>
98-
</Setter.Value>
99-
</Setter>
100-
</Style>
101-
102-
40+
10341

10442

10543
</Page.Resources>
@@ -246,13 +184,7 @@
246184
</MenuFlyout>
247185
</controls:DataGrid.Resources>
248186

249-
<!--<controls:DataGrid.RowStyle>
250-
<Style TargetType="controls:DataGridRow">
251-
<Setter Property="Template">
252-
<Grid/>
253-
</Setter>
254-
</Style>
255-
</controls:DataGrid.RowStyle>-->
187+
256188

257189
<controls:DataGrid.Columns>
258190
<controls:DataGridTemplateColumn>

GenericFileBrowser.xaml.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@ public sealed partial class GenericFileBrowser : Page
3636
public static DataGrid data;
3737
public static MenuFlyout context;
3838
public static MenuFlyout HeaderContextMenu;
39+
public static Page GFBPageName;
3940

4041
public GenericFileBrowser()
4142
{
4243
this.InitializeComponent();
43-
44+
GFBPageName = GenericItemView;
4445
string env = Environment.ExpandEnvironmentVariables("%userprofile%");
4546

4647
this.IsTextScaleFactorEnabled = true;
@@ -102,7 +103,7 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
102103
base.OnNavigatedTo(eventArgs);
103104
var parameters = (string)eventArgs.Parameter;
104105
ItemViewModel.FilesAndFolders.Clear();
105-
ItemViewModel.ViewModel = new ItemViewModel(parameters);
106+
ItemViewModel.ViewModel = new ItemViewModel(parameters, this.GenericItemView);
106107
if (parameters.Equals(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)))
107108
{
108109
P.path = "Desktop";

ItemInteractions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public static async void List_ItemClick(object sender, DoubleTappedRoutedEventAr
178178
break;
179179
}
180180
}
181-
ItemViewModel.ViewModel = new ItemViewModel(clickedOnItem.FilePath);
181+
ItemViewModel.ViewModel = new ItemViewModel(clickedOnItem.FilePath, GenericFileBrowser.GFBPageName);
182182
}
183183
GenericFileBrowser.UpdateAllBindings();
184184
}
@@ -236,7 +236,7 @@ public static async void PhotoAlbumItemList_ClickAsync(object sender, ItemClickE
236236
History.ForwardList.Clear();
237237
ItemViewModel.FS.isEnabled = false;
238238
ItemViewModel.FilesAndFolders.Clear();
239-
ItemViewModel.ViewModel = new ItemViewModel(clickedOnItem.FilePath);
239+
ItemViewModel.ViewModel = new ItemViewModel(clickedOnItem.FilePath, PhotoAlbum.PAPageName);
240240
GenericFileBrowser.P.path = clickedOnItem.FilePath;
241241
GenericFileBrowser.UpdateAllBindings();
242242

@@ -311,7 +311,7 @@ public static async void OpenItem_Click(object sender, RoutedEventArgs e)
311311
History.ForwardList.Clear();
312312
ItemViewModel.FS.isEnabled = false;
313313
ItemViewModel.FilesAndFolders.Clear();
314-
ItemViewModel.ViewModel = new ItemViewModel(RowData.FilePath);
314+
ItemViewModel.ViewModel = new ItemViewModel(RowData.FilePath, GenericFileBrowser.GFBPageName);
315315
GenericFileBrowser.P.path = RowData.FilePath;
316316
GenericFileBrowser.UpdateAllBindings();
317317
}

NavigationSystem.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ public static void Back_Click(object sender, RoutedEventArgs e)
286286
break;
287287
}
288288
}
289-
ItemViewModel.ViewModel = new ItemViewModel(History.HistoryList[History.HistoryList.Count - 1]); // To take into account the correct index without interference from the folder being navigated to
289+
ItemViewModel.ViewModel = new ItemViewModel(History.HistoryList[History.HistoryList.Count - 1], GenericFileBrowser.GFBPageName); // To take into account the correct index without interference from the folder being navigated to
290290
}
291291
GenericFileBrowser.UpdateAllBindings();
292292

@@ -426,7 +426,7 @@ public static void Forward_Click(object sender, RoutedEventArgs e)
426426
break;
427427
}
428428
}
429-
ItemViewModel.ViewModel = new ItemViewModel(History.ForwardList[History.ForwardList.Count() - 1]); // To take into account the correct index without interference from the folder being navigated to
429+
ItemViewModel.ViewModel = new ItemViewModel(History.ForwardList[History.ForwardList.Count() - 1], GenericFileBrowser.GFBPageName); // To take into account the correct index without interference from the folder being navigated to
430430
}
431431

432432

@@ -451,7 +451,7 @@ public static void Refresh_Click(object sender, RoutedEventArgs e)
451451
{
452452
ItemViewModel.TextState.isVisible = Visibility.Collapsed;
453453
ItemViewModel.FilesAndFolders.Clear();
454-
ItemViewModel.ViewModel = new ItemViewModel(ItemViewModel.PUIP.Path);
454+
ItemViewModel.ViewModel = new ItemViewModel(ItemViewModel.PUIP.Path, GenericFileBrowser.GFBPageName);
455455
//GenericFileBrowser.P.path = ItemViewModel.PUIP.Path;
456456
GenericFileBrowser.UpdateAllBindings();
457457
}
@@ -476,7 +476,7 @@ public static void Back_Click(object sender, RoutedEventArgs e)
476476
Debug.WriteLine("\nAfter Removals");
477477
ArrayDiag.DumpArray();
478478
ItemViewModel.FilesAndFolders.Clear();
479-
ItemViewModel.ViewModel = new ItemViewModel(History.HistoryList[History.HistoryList.Count() - 1]); // To take into account the correct index without interference from the folder being navigated to
479+
ItemViewModel.ViewModel = new ItemViewModel(History.HistoryList[History.HistoryList.Count() - 1], PhotoAlbum.PAPageName); // To take into account the correct index without interference from the folder being navigated to
480480
GenericFileBrowser.P.path = History.HistoryList[History.HistoryList.Count() - 1];
481481
GenericFileBrowser.UpdateAllBindings();
482482

@@ -505,7 +505,7 @@ public static void Forward_Click(object sender, RoutedEventArgs e)
505505
{
506506
ItemViewModel.TextState.isVisible = Visibility.Collapsed;
507507
ItemViewModel.FilesAndFolders.Clear();
508-
ItemViewModel.ViewModel = new ItemViewModel(History.ForwardList[History.ForwardList.Count() - 1]); // To take into account the correct index without interference from the folder being navigated to
508+
ItemViewModel.ViewModel = new ItemViewModel(History.ForwardList[History.ForwardList.Count() - 1], PhotoAlbum.PAPageName); // To take into account the correct index without interference from the folder being navigated to
509509
GenericFileBrowser.P.path = History.ForwardList[History.ForwardList.Count() - 1];
510510
History.ForwardList.RemoveAt(History.ForwardList.Count() - 1);
511511
GenericFileBrowser.UpdateAllBindings();
@@ -527,7 +527,7 @@ public static void Refresh_Click(object sender, RoutedEventArgs e)
527527
{
528528
ItemViewModel.TextState.isVisible = Visibility.Collapsed;
529529
ItemViewModel.FilesAndFolders.Clear();
530-
ItemViewModel.ViewModel = new ItemViewModel(ItemViewModel.PUIP.Path);
530+
ItemViewModel.ViewModel = new ItemViewModel(ItemViewModel.PUIP.Path, PhotoAlbum.PAPageName);
531531
GenericFileBrowser.P.path = ItemViewModel.PUIP.Path;
532532
GenericFileBrowser.UpdateAllBindings();
533533
}

0 commit comments

Comments
 (0)