Skip to content

Commit 09a4f95

Browse files
committed
Show consentDialog if broadeFileAccess is not granted
1 parent ad02a83 commit 09a4f95

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

Files/App.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using System.IO;
2020
using System.Linq;
2121
using System.Collections.ObjectModel;
22+
using System.Threading.Tasks;
2223
using Windows.Devices.Enumeration;
2324
using Windows.Devices.Portable;
2425
using Windows.ApplicationModel.Core;
@@ -63,7 +64,7 @@ public static ProHome OccupiedInstance
6364

6465
public App()
6566
{
66-
this.InitializeComponent();
67+
this.InitializeComponent();
6768
this.Suspending += OnSuspending;
6869
consentDialog = new Dialogs.ConsentDialog();
6970
propertiesDialog = new Dialogs.PropertiesDialog();

Files/Filesystem/Drives.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,19 @@ public class DrivesManager
2424

2525
public DrivesManager()
2626
{
27-
GetDrives(Drives);
28-
GetVirtualDrivesList(Drives);
27+
/*
28+
try
29+
{
30+
GetDrives(Drives);
31+
GetVirtualDrivesList(Drives);
32+
}
33+
catch (AggregateException e)
34+
{
35+
Console.WriteLine(e);
36+
new Dialogs.ConsentDialog().ShowAsync();
37+
}
38+
*/
39+
2940

3041
_deviceWatcher = DeviceInformation.CreateWatcher(StorageDevice.GetDeviceSelector());
3142
_deviceWatcher.Added += DeviceAdded;

Files/ProHome.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@
330330
</uilib:NavigationView.MenuItemTemplate>
331331
</uilib:NavigationView>
332332
<TextBlock Visibility="Visible" Margin="8,-16,0,0" Text="Drives" FontSize="14" FontWeight="SemiBold" Padding="0" VerticalAlignment="Stretch"/>
333-
<uilib:NavigationView Style="{StaticResource NavigationViewStyle_Fixed}" PaneTitle="Drives" OpenPaneLength="225" Padding="0" IsTitleBarAutoPaddingEnabled="False" PaneDisplayMode="Left" ItemInvoked="DrivesList_ItemInvoked" x:FieldModifier="public" IsPaneOpen="True" IsSettingsVisible="False" IsPaneToggleButtonVisible="False" IsBackButtonVisible="Collapsed" MenuItemsSource="{x:Bind local:App.AppSettings.foundDrives2}" SelectionChanged="DrivesList_SelectionChanged" x:Name="DrivesList">
333+
<uilib:NavigationView Style="{StaticResource NavigationViewStyle_Fixed}" PaneTitle="Drives" OpenPaneLength="225" Padding="0" IsTitleBarAutoPaddingEnabled="False" PaneDisplayMode="Left" ItemInvoked="DrivesList_ItemInvoked" x:FieldModifier="public" IsPaneOpen="True" IsSettingsVisible="False" IsPaneToggleButtonVisible="False" IsBackButtonVisible="Collapsed" MenuItemsSource="{x:Bind local:App.AppSettings.DrivesManager.Drives}" SelectionChanged="DrivesList_SelectionChanged" x:Name="DrivesList">
334334
<uilib:NavigationView.MenuItemTemplate>
335335
<DataTemplate x:DataType="local2:DriveItem">
336336
<uilib:NavigationViewItem Padding="0" Tag="{x:Bind tag}">

Files/View Models/SettingsViewModel.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System;
44
using System.Collections.Generic;
55
using System.Collections.ObjectModel;
6+
using System.IO;
67
using System.Linq;
78
using System.Text;
89
using System.Threading.Tasks;
@@ -20,7 +21,7 @@ public class SettingsViewModel : ViewModelBase
2021
{
2122
ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;
2223

23-
public DrivesManager Drives { get; }
24+
public DrivesManager DrivesManager { get; }
2425

2526
public SettingsViewModel()
2627
{
@@ -29,9 +30,9 @@ public SettingsViewModel()
2930
DetectDateTimeFormat();
3031
DetectSidebarOpacity();
3132

32-
Drives = new DrivesManager();
33+
DrivesManager = new DrivesManager();
3334

34-
foundDrives = Drives.Drives;
35+
foundDrives = DrivesManager.Drives;
3536
}
3637

3738
private void DetectSidebarOpacity()
@@ -248,13 +249,12 @@ public TimeStyle DisplayedTimeStyle
248249
}
249250
}
250251

252+
[Obsolete]
251253
public static ObservableCollection<DriveItem> foundDrives = new ObservableCollection<DriveItem>();
252254

253-
public ObservableCollection<DriveItem> foundDrives2 => foundDrives;
254-
255255
public void Dispose()
256256
{
257-
Drives.Dispose();
257+
DrivesManager.Dispose();
258258
}
259259
}
260260
}

0 commit comments

Comments
 (0)