Skip to content

Commit bade45d

Browse files
committed
Standardize MessageBoxes With Transition to ContentDialog
1 parent 5165b4c commit bade45d

11 files changed

+240
-250
lines changed

ClassicMode.xaml

+15-14
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
xmlns:local1="using:ItemListPresenter"
66
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
77
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
xmlns:UILib="using:Microsoft.UI.Xaml.Controls"
89
xmlns:Windows10version1809="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 7)"
910
mc:Ignorable="d"
1011
Name="ClassicModePage"
@@ -25,13 +26,13 @@
2526
<RowDefinition Height="Auto"/>
2627
<RowDefinition Height="*"/>
2728
</Grid.RowDefinitions>
28-
<Windows10version1809:MenuBar HorizontalAlignment="Left" VerticalAlignment="Stretch">
29-
<MenuBar.Items>
30-
<MenuBarItem Title="File">
29+
<UILib:MenuBar HorizontalAlignment="Left" VerticalAlignment="Stretch">
30+
<UILib:MenuBar.Items>
31+
<UILib:MenuBarItem Title="File">
3132
<MenuFlyoutItem Text="Open"/>
32-
</MenuBarItem>
33-
</MenuBar.Items>
34-
</Windows10version1809:MenuBar>
33+
</UILib:MenuBarItem>
34+
</UILib:MenuBar.Items>
35+
</UILib:MenuBar>
3536
<Grid Name="DragArea" Background="Transparent" Height="40" Grid.Column="1">
3637

3738
</Grid>
@@ -52,22 +53,22 @@
5253
<SplitView DisplayMode="Inline" IsPaneOpen="True" HorizontalAlignment="Stretch" Margin="0,0,0,0" Grid.RowSpan="1" Grid.Row="1" VerticalAlignment="Stretch">
5354
<SplitView.Pane>
5455
<Grid Background="{StaticResource SystemControlAcrylicWindowMediumHighBrush}">
55-
<TreeView ScrollViewer.HorizontalScrollMode="Enabled" Expanding="DirectoryView_Expanding" Windows10version1809:ItemsSource="{x:Bind local1:ItemViewModel.ClassicFolderList}" Name="DirectoryView">
56-
<Windows10version1809:TreeView.ItemTemplate>
56+
<UILib:TreeView ScrollViewer.HorizontalScrollMode="Enabled" Expanding="DirectoryView_Expanding" UILib:ItemsSource="{x:Bind local1:ItemViewModel.ClassicFolderList}" Name="DirectoryView">
57+
<UILib:TreeView.ItemTemplate>
5758
<DataTemplate>
58-
<TreeViewItem ItemsSource="{Binding Children}" HasUnrealizedChildren="True">
59-
<TreeViewItem.Content>
59+
<UILib:TreeViewItem ItemsSource="{Binding Children}" HasUnrealizedChildren="True">
60+
<UILib:TreeViewItem.Content>
6061
<StackPanel Orientation="Horizontal">
6162
<FontIcon Margin="0,0,10,0" Visibility="{Binding FolderImg}" Glyph="&#xE8D5;" FontFamily="Segoe MDL2 Assets" Foreground="#ffe793"/>
6263
<TextBlock Text="{Binding FileName}"/>
6364
</StackPanel>
64-
</TreeViewItem.Content>
65-
</TreeViewItem>
65+
</UILib:TreeViewItem.Content>
66+
</UILib:TreeViewItem>
6667
</DataTemplate>
67-
</Windows10version1809:TreeView.ItemTemplate>
68+
</UILib:TreeView.ItemTemplate>
6869

6970

70-
</TreeView>
71+
</UILib:TreeView>
7172
</Grid>
7273
</SplitView.Pane>
7374
<Grid/>

ClassicMode.xaml.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ public ClassicMode()
2626
ItemViewModel viewModel = new ItemViewModel(@"C:\", ClassicView);
2727
}
2828

29-
private void DirectoryView_Expanding(TreeView sender, TreeViewExpandingEventArgs args)
29+
30+
private void DirectoryView_Expanding(Microsoft.UI.Xaml.Controls.TreeView sender, Microsoft.UI.Xaml.Controls.TreeViewExpandingEventArgs args)
3031
{
3132
if (args.Node.HasUnrealizedChildren)
3233
{

FileLoader.cs

+42-47
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ public class ItemViewModel
4444
{
4545
public static ObservableCollection<Classic_ListedFolderItem> classicFolderList = new ObservableCollection<Classic_ListedFolderItem>();
4646
public static ObservableCollection<Classic_ListedFolderItem> ClassicFolderList { get { return classicFolderList; } }
47-
public ObservableCollection<ListedItem> classicFileList = new ObservableCollection<ListedItem>();
48-
public ObservableCollection<ListedItem> ClassicFileList { get { return classicFileList; } }
47+
public static ObservableCollection<ListedItem> classicFileList = new ObservableCollection<ListedItem>();
48+
public static ObservableCollection<ListedItem> ClassicFileList { get { return classicFileList; } }
4949

5050
public static ObservableCollection<ListedItem> filesAndFolders = new ObservableCollection<ListedItem>();
5151
public static ObservableCollection<ListedItem> FilesAndFolders { get { return filesAndFolders; } }
@@ -59,21 +59,21 @@ public class ItemViewModel
5959
string VideosPath = Environment.GetFolderPath(Environment.SpecialFolder.MyVideos);
6060

6161
StorageFolder folder;
62-
string gotName;
63-
string gotDate;
64-
string gotType;
65-
string gotPath;
66-
string gotFolName;
67-
string gotFolDate;
68-
string gotFolPath;
69-
string gotFolType;
70-
Visibility gotFileImgVis;
71-
Visibility gotFolImg;
72-
StorageItemThumbnail gotFileImg;
62+
static string gotName;
63+
static string gotDate;
64+
static string gotType;
65+
static string gotPath;
66+
static string gotFolName;
67+
static string gotFolDate;
68+
static string gotFolPath;
69+
static string gotFolType;
70+
static Visibility gotFileImgVis;
71+
static Visibility gotFolImg;
72+
static StorageItemThumbnail gotFileImg;
7373
public static ObservableCollection<Classic_ListedFolderItem> ChildrenList;
74-
public IReadOnlyList<StorageFolder> folderList;
75-
public IReadOnlyList<StorageFile> fileList;
76-
public bool isPhotoAlbumMode;
74+
public static IReadOnlyList<StorageFolder> folderList;
75+
public static IReadOnlyList<StorageFile> fileList;
76+
public static bool isPhotoAlbumMode;
7777
public static string pageName;
7878

7979
public static ItemViewModel vm;
@@ -203,6 +203,10 @@ private async void DisplayConsentDialog()
203203
public static bool IsStopRequested = false;
204204
public static bool IsTerminated = true;
205205

206+
public static int NumOfItems;
207+
public static int NumItemsRead;
208+
public static int NumOfFiles;
209+
public static int NumOfFolders;
206210
public async void GetItemsAsync(string path)
207211
{
208212
Stopwatch stopwatch = new Stopwatch();
@@ -215,15 +219,14 @@ public async void GetItemsAsync(string path)
215219
folder = await StorageFolder.GetFolderFromPathAsync(path); // Set location to the current directory specified in path
216220
folderList = await folder.GetFoldersAsync(); // Create a read-only list of all folders in location
217221
fileList = await folder.GetFilesAsync(); // Create a read-only list of all files in location
218-
int NumOfFolders = folderList.Count; // How many folders are in the list
219-
int NumOfFiles = fileList.Count; // How many files are in the list
220-
int NumOfItems = NumOfFiles + NumOfFolders;
221-
int NumItemsRead = 0;
222+
NumOfFolders = folderList.Count; // How many folders are in the list
223+
NumOfFiles = fileList.Count; // How many files are in the list
224+
NumOfItems = NumOfFiles + NumOfFolders;
225+
NumItemsRead = 0;
222226

223227
if (NumOfItems == 0)
224228
{
225229
TextState.isVisible = Visibility.Visible;
226-
//return;
227230
}
228231

229232
PUIH.Header = "Loading " + NumOfItems + " items";
@@ -233,12 +236,11 @@ public async void GetItemsAsync(string path)
233236
{
234237
PVIS.isVisible = Visibility.Visible;
235238
}
236-
237-
if(NumOfFolders > 0)
239+
if (NumOfFolders > 0)
238240
{
239241
foreach (StorageFolder fol in folderList)
240242
{
241-
if(IsStopRequested)
243+
if (IsStopRequested)
242244
{
243245
IsStopRequested = false;
244246
IsTerminated = true;
@@ -252,7 +254,7 @@ public async void GetItemsAsync(string path)
252254
gotFolType = "Folder";
253255
gotFolImg = Visibility.Visible;
254256
gotFileImgVis = Visibility.Collapsed;
255-
257+
256258

257259
if (pageName == "ClassicModePage")
258260
{
@@ -266,10 +268,10 @@ public async void GetItemsAsync(string path)
266268

267269
NumItemsRead++;
268270
}
269-
271+
270272
}
271273

272-
if(NumOfFiles > 0)
274+
if (NumOfFiles > 0)
273275
{
274276
foreach (StorageFile f in fileList)
275277
{
@@ -283,7 +285,7 @@ public async void GetItemsAsync(string path)
283285
UpdateProgUI(ProgressReported);
284286
gotName = f.Name.ToString();
285287
gotDate = f.DateCreated.ToString(); // In the future, parse date to human readable format
286-
if(f.FileType.ToString() == ".exe")
288+
if (f.FileType.ToString() == ".exe")
287289
{
288290
gotType = "Executable";
289291
}
@@ -315,7 +317,7 @@ public async void GetItemsAsync(string path)
315317
}
316318
gotFileImgVis = Visibility.Visible;
317319

318-
if(pageName == "ClassicModePage")
320+
if (pageName == "ClassicModePage")
319321
{
320322
ClassicFileList.Add(new ListedItem() { FileImg = icon, FileIconVis = gotFileImgVis, FolderImg = gotFolImg, FileName = gotName, FileDate = gotDate, FileExtension = gotType, FilePath = gotPath });
321323
}
@@ -326,14 +328,15 @@ public async void GetItemsAsync(string path)
326328
NumItemsRead++;
327329
}
328330

329-
331+
330332
}
331-
if(pageName != "ClassicModePage")
333+
if (pageName != "ClassicModePage")
332334
{
333335
PVIS.isVisible = Visibility.Collapsed;
334336
}
335-
337+
336338
IsTerminated = true;
339+
337340
}
338341
catch (UnauthorizedAccessException)
339342
{
@@ -344,7 +347,6 @@ public async void GetItemsAsync(string path)
344347

345348
}
346349

347-
348350
public static ProgressPercentage progressPER = new ProgressPercentage();
349351

350352
public static ProgressPercentage PROGRESSPER
@@ -365,30 +367,23 @@ public static int UpdateProgUI(int level)
365367
return (int)level;
366368
}
367369

368-
public static void DisplayCollisionUIWithArgs(string header, string subHeader)
370+
public static async void DisplayCollisionUIWithArgs(string header, string subHeader)
369371
{
370372
CollisionBoxHeader.Header = header;
371373
CollisionBoxSubHeader.SubHeader = subHeader;
372-
CollisionUIVisibility.isVisible = Visibility.Visible;
374+
await GenericFileBrowser.collisionBox.ShowAsync();
375+
//CollisionUIVisibility.isVisible = Visibility.Visible;
373376
}
374377

375-
public static void DisplayReviewUIWithArgs(string header, string subHeader)
378+
public static async void DisplayReviewUIWithArgs(string header, string subHeader)
376379
{
377380
ConflictBoxHeader.Header = header;
378381
ConflictBoxSubHeader.SubHeader = subHeader;
379-
ConflictUIVisibility.isVisible = Visibility.Visible;
380-
}
381-
382-
public static void DisplayProgUIWithArgs(string headerText, string messageText, string buttonText, int initialProgBarLevel)
383-
{
384-
PUIH.Header = headerText;
385-
PUIP.Path = messageText;
386-
ButtonText.buttonText = buttonText;
387-
PROGRESSPER.prog = initialProgBarLevel;
388-
PVIS.isVisible = Visibility.Visible;
382+
await GenericFileBrowser.reviewBox.ShowAsync();
383+
//ConflictUIVisibility.isVisible = Visibility.Visible;
389384
}
390385

391-
public static async void FillTreeNode(object item, TreeView EntireControl)
386+
public static async void FillTreeNode(object item, Microsoft.UI.Xaml.Controls.TreeView EntireControl)
392387
{
393388
var PathToFillFrom = (item as Classic_ListedFolderItem).FilePath;
394389
StorageFolder FolderFromPath = await StorageFolder.GetFolderFromPathAsync(PathToFillFrom);

Files.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<AssemblyName>Files</AssemblyName>
1212
<DefaultLanguage>en-US</DefaultLanguage>
1313
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
14-
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.17763.0</TargetPlatformVersion>
14+
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.18327.0</TargetPlatformVersion>
1515
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
1616
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
1717
<FileAlignment>512</FileAlignment>

0 commit comments

Comments
 (0)