Skip to content

Commit 62c5555

Browse files
Luke BlevinsLuke Blevins
authored andcommitted
Tweaks to UI, Dark Mode
1 parent e326b79 commit 62c5555

File tree

6 files changed

+125
-121
lines changed

6 files changed

+125
-121
lines changed

App.xaml.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ public App()
5555
}
5656
}
5757
}
58+
else
59+
{
60+
localSettings.Values["theme"] = "Default";
61+
}
5862

5963
this.RequestedTheme = SettingsPages.Personalization.TV.ThemeValue;
6064
Debug.WriteLine("!!Requested Theme!!" + RequestedTheme.ToString());

FileLoader.cs

Lines changed: 102 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ private async void DisplayConsentDialog()
161161
public static bool IsStopRequested = false;
162162
public static bool IsTerminated = true;
163163

164+
164165
public async void GetItemsAsync(string path)
165166
{
166167
Stopwatch stopwatch = new Stopwatch();
@@ -173,123 +174,123 @@ public async void GetItemsAsync(string path)
173174
folder = await StorageFolder.GetFolderFromPathAsync(path); // Set location to the current directory specified in path
174175

175176

176-
QueryOptions options = new QueryOptions()
177-
{
178-
FolderDepth = FolderDepth.Shallow,
179-
IndexerOption = IndexerOption.UseIndexerWhenAvailable
177+
QueryOptions options = new QueryOptions()
178+
{
179+
FolderDepth = FolderDepth.Shallow,
180+
IndexerOption = IndexerOption.UseIndexerWhenAvailable
180181

181-
};
182-
string[] otherProperties = new string[]
183-
{
184-
SystemProperties.Title
185-
};
182+
};
183+
string[] otherProperties = new string[]
184+
{
185+
SystemProperties.Title
186+
};
186187

187-
options.SetPropertyPrefetch(PropertyPrefetchOptions.None, otherProperties);
188-
SortEntry sort = new SortEntry()
189-
{
190-
AscendingOrder = true,
191-
PropertyName = "System.ItemNameDisplay"
192-
};
193-
options.SortOrder.Add(sort);
188+
options.SetPropertyPrefetch(PropertyPrefetchOptions.None, otherProperties);
189+
SortEntry sort = new SortEntry()
190+
{
191+
AscendingOrder = true,
192+
PropertyName = "System.ItemNameDisplay"
193+
};
194+
options.SortOrder.Add(sort);
194195

195-
StorageFileQueryResult fileQueryResult = folder.CreateFileQueryWithOptions(options);
196-
StorageFolderQueryResult folderQueryResult = folder.CreateFolderQueryWithOptions(options);
197-
folderList = await folder.GetFoldersAsync(); // Create a read-only list of all folders in location
198-
fileList = await folder.GetFilesAsync(); // Create a read-only list of all files in location
199-
int NumOfFolders = folderList.Count; // How many folders are in the list
200-
int NumOfFiles = fileList.Count; // How many files are in the list
201-
int NumOfItems = NumOfFiles + NumOfFolders;
202-
int NumItemsRead = 0;
203-
204-
if (NumOfItems == 0)
205-
{
206-
TextState.isVisible = Visibility.Visible;
207-
return;
208-
}
209-
210-
PUIH.Header = "Loading " + NumOfItems + " items";
196+
StorageFileQueryResult fileQueryResult = folder.CreateFileQueryWithOptions(options);
197+
StorageFolderQueryResult folderQueryResult = folder.CreateFolderQueryWithOptions(options);
198+
folderList = await folder.GetFoldersAsync(); // Create a read-only list of all folders in location
199+
fileList = await folder.GetFilesAsync(); // Create a read-only list of all files in location
200+
int NumOfFolders = folderList.Count; // How many folders are in the list
201+
int NumOfFiles = fileList.Count; // How many files are in the list
202+
int NumOfItems = NumOfFiles + NumOfFolders;
203+
int NumItemsRead = 0;
204+
205+
if (NumOfItems == 0)
206+
{
207+
TextState.isVisible = Visibility.Visible;
208+
return;
209+
}
211210

212-
if (NumOfItems >= 250)
213-
{
214-
PVIS.isVisible = Visibility.Visible;
215-
}
211+
PUIH.Header = "Loading " + NumOfItems + " items";
216212

217-
if(NumOfFolders > 0)
218-
{
219-
foreach (StorageFolder fol in folderList)
213+
if (NumOfItems >= 250)
220214
{
221-
if(IsStopRequested)
222-
{
223-
IsStopRequested = false;
224-
IsTerminated = true;
225-
return;
226-
}
227-
int ProgressReported = (NumItemsRead * 100 / NumOfItems);
228-
UpdateProgUI(ProgressReported);
229-
gotFolName = fol.Name.ToString();
230-
gotFolDate = fol.DateCreated.ToString();
231-
gotFolPath = fol.Path.ToString();
232-
gotFolType = "Folder";
233-
gotFolImg = Visibility.Visible;
234-
gotFileImgVis = Visibility.Collapsed;
235-
FilesAndFolders.Add(new ListedItem() { ItemIndex = FilesAndFolders.Count, FileImg = null, FileIconVis = gotFileImgVis, FolderImg = gotFolImg, FileName = gotFolName, FileDate = gotFolDate, FileExtension = gotFolType, FilePath = gotFolPath });
236-
237-
NumItemsRead++;
215+
PVIS.isVisible = Visibility.Visible;
238216
}
239-
240-
}
241217

242-
if(NumOfFiles > 0)
243-
{
244-
foreach (StorageFile f in fileList)
218+
if(NumOfFolders > 0)
245219
{
246-
if (IsStopRequested)
247-
{
248-
IsStopRequested = false;
249-
IsTerminated = true;
250-
return;
251-
}
252-
int ProgressReported = (NumItemsRead * 100 / NumOfItems);
253-
UpdateProgUI(ProgressReported);
254-
gotName = f.Name.ToString();
255-
gotDate = f.DateCreated.ToString(); // In the future, parse date to human readable format
256-
if(f.FileType.ToString() == ".exe")
257-
{
258-
gotType = "Executable";
259-
}
260-
else
261-
{
262-
gotType = f.FileType.ToString();
263-
}
264-
gotPath = f.Path.ToString();
265-
gotFolImg = Visibility.Collapsed;
266-
if (isPhotoAlbumMode == false)
220+
foreach (StorageFolder fol in folderList)
267221
{
268-
const uint requestedSize = 20;
269-
const ThumbnailMode thumbnailMode = ThumbnailMode.ListView;
270-
const ThumbnailOptions thumbnailOptions = ThumbnailOptions.UseCurrentScale;
271-
gotFileImg = await f.GetThumbnailAsync(thumbnailMode, requestedSize, thumbnailOptions);
272-
}
273-
else
274-
{
275-
const uint requestedSize = 275;
276-
const ThumbnailMode thumbnailMode = ThumbnailMode.PicturesView;
277-
const ThumbnailOptions thumbnailOptions = ThumbnailOptions.ResizeThumbnail;
278-
gotFileImg = await f.GetThumbnailAsync(thumbnailMode, requestedSize, thumbnailOptions);
222+
if(IsStopRequested)
223+
{
224+
IsStopRequested = false;
225+
IsTerminated = true;
226+
return;
227+
}
228+
int ProgressReported = (NumItemsRead * 100 / NumOfItems);
229+
UpdateProgUI(ProgressReported);
230+
gotFolName = fol.Name.ToString();
231+
gotFolDate = fol.DateCreated.ToString();
232+
gotFolPath = fol.Path.ToString();
233+
gotFolType = "Folder";
234+
gotFolImg = Visibility.Visible;
235+
gotFileImgVis = Visibility.Collapsed;
236+
FilesAndFolders.Add(new ListedItem() { ItemIndex = FilesAndFolders.Count, FileImg = null, FileIconVis = gotFileImgVis, FolderImg = gotFolImg, FileName = gotFolName, FileDate = gotFolDate, FileExtension = gotFolType, FilePath = gotFolPath });
237+
238+
NumItemsRead++;
279239
}
240+
241+
}
280242

281-
BitmapImage icon = new BitmapImage();
282-
if (gotFileImg != null)
243+
if(NumOfFiles > 0)
244+
{
245+
foreach (StorageFile f in fileList)
283246
{
284-
icon.SetSource(gotFileImg.CloneStream());
247+
if (IsStopRequested)
248+
{
249+
IsStopRequested = false;
250+
IsTerminated = true;
251+
return;
252+
}
253+
int ProgressReported = (NumItemsRead * 100 / NumOfItems);
254+
UpdateProgUI(ProgressReported);
255+
gotName = f.Name.ToString();
256+
gotDate = f.DateCreated.ToString(); // In the future, parse date to human readable format
257+
if(f.FileType.ToString() == ".exe")
258+
{
259+
gotType = "Executable";
260+
}
261+
else
262+
{
263+
gotType = f.FileType.ToString();
264+
}
265+
gotPath = f.Path.ToString();
266+
gotFolImg = Visibility.Collapsed;
267+
if (isPhotoAlbumMode == false)
268+
{
269+
const uint requestedSize = 20;
270+
const ThumbnailMode thumbnailMode = ThumbnailMode.ListView;
271+
const ThumbnailOptions thumbnailOptions = ThumbnailOptions.UseCurrentScale;
272+
gotFileImg = await f.GetThumbnailAsync(thumbnailMode, requestedSize, thumbnailOptions);
273+
}
274+
else
275+
{
276+
const uint requestedSize = 275;
277+
const ThumbnailMode thumbnailMode = ThumbnailMode.PicturesView;
278+
const ThumbnailOptions thumbnailOptions = ThumbnailOptions.ResizeThumbnail;
279+
gotFileImg = await f.GetThumbnailAsync(thumbnailMode, requestedSize, thumbnailOptions);
280+
}
281+
282+
BitmapImage icon = new BitmapImage();
283+
if (gotFileImg != null)
284+
{
285+
icon.SetSource(gotFileImg.CloneStream());
286+
}
287+
gotFileImgVis = Visibility.Visible;
288+
FilesAndFolders.Add(new ListedItem() { FileImg = icon, FileIconVis = gotFileImgVis, FolderImg = gotFolImg, FileName = gotName, FileDate = gotDate, FileExtension = gotType, FilePath = gotPath });
289+
NumItemsRead++;
285290
}
286-
gotFileImgVis = Visibility.Visible;
287-
FilesAndFolders.Add(new ListedItem() { FileImg = icon, FileIconVis = gotFileImgVis, FolderImg = gotFolImg, FileName = gotName, FileDate = gotDate, FileExtension = gotType, FilePath = gotPath });
288-
NumItemsRead++;
289-
}
290291

291292

292-
}
293+
}
293294

294295
PVIS.isVisible = Visibility.Collapsed;
295296
IsTerminated = true;

GenericFileBrowser.xaml

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -131,36 +131,34 @@
131131
</VisualStateManager.VisualStateGroups>
132132

133133

134-
<Grid Tag="{x:Bind Tag, Mode=OneWay}" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Padding="50,0,50,0">
134+
<Grid Tag="{x:Bind Tag, Mode=OneWay}" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Padding="50,0,50,0" VerticalAlignment="Stretch">
135135
<Grid.RowDefinitions>
136-
<RowDefinition Height="20*"/>
137-
<RowDefinition Height="80*"/>
136+
<RowDefinition Height="18*"/>
137+
<RowDefinition Height="82*"/>
138138
</Grid.RowDefinitions>
139139
<TextBlock Name="EmptyText" Visibility="{x:Bind local2:ItemViewModel.TextState.isVisible, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Text="This folder is empty." TextWrapping="Wrap" VerticalAlignment="Top" Margin="475,100,0,0" Canvas.ZIndex="5" Grid.Row="1"/>
140-
<Grid DataContext="{Binding BackObject}" VerticalAlignment="Stretch" Margin="0,0,0,0">
141-
<StackPanel Orientation="Horizontal" Margin="0,0,0,25">
142-
<AppBarButton Style="{ThemeResource AppBarButtonRevealStyle}" x:FieldModifier="public" IsEnabled="{x:Bind local2:ItemViewModel.BS.isEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" x:Name="Back" Content="&#xE76B;" FontFamily="Segoe MDL2 Assets" FontSize="20" VerticalAlignment="Center" Height="50" Width="50">
140+
<Grid DataContext="{Binding BackObject}" VerticalAlignment="Bottom" Margin="0,0,0,20">
141+
<StackPanel Orientation="Vertical">
142+
143+
<StackPanel Orientation="Horizontal" VerticalAlignment="Top" Margin="-15,0,0,0">
144+
<AppBarButton Style="{ThemeResource AppBarButtonRevealStyle}" x:FieldModifier="public" IsEnabled="{x:Bind local2:ItemViewModel.BS.isEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" x:Name="Back" Content="&#xE76B;" FontFamily="Segoe MDL2 Assets" FontSize="20" VerticalAlignment="Center" Height="50" Width="50">
143145

144146
</AppBarButton>
145147
<Grid DataContext="{Binding ForwardObject}" VerticalAlignment="Center">
146148
<AppBarButton Style="{ThemeResource AppBarButtonRevealStyle}" IsEnabled="{x:Bind local2:ItemViewModel.FS.isEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" x:Name="Forward" Content="&#xE76C;" FontFamily="Segoe MDL2 Assets" FontSize="20" VerticalAlignment="Top" Height="50" Width="50" HorizontalAlignment="Left"/>
147149
</Grid>
148150
<AppBarButton x:Name="Refresh" Style="{ThemeResource AppBarButtonRevealStyle}" Content="&#xE72C;" FontFamily="Segoe MDL2 Assets" FontSize="20" VerticalAlignment="Center" Width="50" Height="50" />
151+
<AppBarButton x:Name="AddItem" Style="{ThemeResource AppBarButtonRevealStyle}" Content="&#xE710;" FontFamily="Segoe MDL2 Assets" FontSize="20" VerticalAlignment="Center" Width="50" Height="50" />
152+
<AppBarButton x:Name="Paste" Style="{ThemeResource AppBarButtonRevealStyle}" Content="&#xE77F;" FontFamily="Segoe MDL2 Assets" FontSize="20" VerticalAlignment="Center" Width="50" Height="50" />
153+
<AppBarButton x:Name="GetPath" Style="{ThemeResource AppBarButtonRevealStyle}" Content="&#xF271;" FontFamily="Segoe MDL2 Assets" FontSize="20" VerticalAlignment="Center" Width="50" Height="50" />
154+
<AppBarButton x:Name="ViewMode" Style="{ThemeResource AppBarButtonRevealStyle}" Content="&#xF0E2;" FontFamily="Segoe MDL2 Assets" FontSize="20" VerticalAlignment="Center" Width="50" Height="50" />
155+
149156
</StackPanel>
150157

151-
<AppBarButton x:Name="Menu" Style="{ThemeResource AppBarButtonRevealStyle}" Content="&#xE712;" FontFamily="Segoe MDL2 Assets" FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Right" Width="50" Height="50">
152-
<Button.Flyout>
153-
<MenuFlyout>
154-
<MenuFlyoutItem Name="NewItem" Text="New..."/>
155-
<MenuFlyoutItem Name="PasteItem" Text="Paste"/>
156-
<MenuFlyoutItem Name="CopyPath" Text="Copy Path"/>
157-
<MenuFlyoutItem Name="ViewModeChange" Text="Change View Mode..."/>
158-
</MenuFlyout>
159-
</Button.Flyout>
160-
</AppBarButton>
161158
<ScrollViewer HorizontalScrollMode="Auto" HorizontalScrollBarVisibility="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" >
162-
<TextBlock x:Name="VisiblePath" Text="{x:Bind local:GenericFileBrowser.P.path,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="0,0,0,0" FontFamily="Segoe UI Black" FontWeight="Bold" FontSize="32" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto" VerticalAlignment="Top" HorizontalAlignment="Stretch"></TextBlock>
159+
<TextBlock x:Name="VisiblePath" Text="{x:Bind local:GenericFileBrowser.P.path,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontFamily="Segoe UI Black" FontWeight="Bold" FontSize="32" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto" VerticalAlignment="Top" HorizontalAlignment="Stretch"/>
163160
</ScrollViewer>
161+
</StackPanel>
164162
</Grid>
165163

166164
<Grid Padding="0,25,0,0" HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" Grid.Row="1">

GenericFileBrowser.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public GenericFileBrowser()
6868
Forward.Click += Navigation.NavigationActions.Forward_Click;
6969
Refresh.Click += Navigation.NavigationActions.Refresh_Click;
7070
AllView.DoubleTapped += Interact.Interaction.List_ItemClick;
71-
PasteItem.Click += Interact.Interaction.PasteItem_ClickAsync;
71+
//PasteItem.Click += Interact.Interaction.PasteItem_ClickAsync;
7272

7373
}
7474

SettingsPages/Personalization.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
<ComboBoxItem Content="Dark"/>
3737
</ComboBox.Items>
3838
</ComboBox>
39-
40-
39+
<TextBlock Name="RestartReminder" Visibility="Collapsed" Foreground="Green" Text="Success! Restart app to apply theme." Margin="0,10,0,0"/>
40+
4141
</StackPanel>
4242
</Grid>
4343

SettingsPages/Personalization.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ private void ThemeChooser_SelectionChanged(object sender, SelectionChangedEventA
7171
Debug.WriteLine("Default Mode Enabled");
7272
//SettingsPages.Personalization.TV.ThemeValue = "Default";
7373
}
74+
RestartReminder.Visibility = Visibility.Visible;
7475
}
7576
}
7677

0 commit comments

Comments
 (0)