14
14
15
15
16
16
17
+ using Interact ;
17
18
using ItemListPresenter ;
18
19
using System ;
19
20
using System . ComponentModel ;
@@ -30,6 +31,8 @@ namespace Files
30
31
public sealed partial class MainPage : Page
31
32
{
32
33
public static NavigationView nv ;
34
+ public static Frame accessibleContentFrame ;
35
+ public static AutoSuggestBox accessibleAutoSuggestBox ;
33
36
string DesktopPath = Environment . GetFolderPath ( Environment . SpecialFolder . DesktopDirectory ) ;
34
37
string DocumentsPath = Environment . GetFolderPath ( Environment . SpecialFolder . MyDocuments ) ;
35
38
string DownloadsPath = Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) + @"\Downloads" ;
@@ -41,7 +44,7 @@ public MainPage()
41
44
{
42
45
this . InitializeComponent ( ) ;
43
46
this . IsTextScaleFactorEnabled = true ;
44
-
47
+ accessibleContentFrame = ContentFrame ;
45
48
var CoreTitleBar = CoreApplication . GetCurrentView ( ) . TitleBar ;
46
49
CoreTitleBar . ExtendViewIntoTitleBar = true ;
47
50
Window . Current . SetTitleBar ( DragArea ) ;
@@ -50,7 +53,7 @@ public MainPage()
50
53
titleBar . ButtonHoverBackgroundColor = Color . FromArgb ( 75 , 10 , 10 , 10 ) ;
51
54
titleBar . ButtonHoverBackgroundColor = Color . FromArgb ( 75 , 10 , 10 , 10 ) ;
52
55
nv = navView ;
53
-
56
+ accessibleAutoSuggestBox = auto_suggest ;
54
57
}
55
58
56
59
private static SelectItem select = new SelectItem ( ) ;
@@ -59,91 +62,108 @@ public MainPage()
59
62
private void navView_ItemSelected ( NavigationView sender , NavigationViewSelectionChangedEventArgs args )
60
63
{
61
64
NavigationViewItem item = args . SelectedItem as NavigationViewItem ;
65
+
62
66
63
- if ( item . Name == "homeIc" )
64
- {
65
- ContentFrame . Navigate ( typeof ( YourHome ) ) ;
66
- auto_suggest . PlaceholderText = "Search Recents" ;
67
- }
68
- else if ( item . Name == "DesktopIC" )
69
- {
70
- ItemViewModel . TextState . isVisible = Visibility . Collapsed ;
71
- ContentFrame . Navigate ( typeof ( GenericFileBrowser ) , DesktopPath ) ;
72
- auto_suggest . PlaceholderText = "Search Desktop" ;
73
- }
74
- else if ( item . Name == "DocumentsIC" )
75
- {
76
- ItemViewModel . TextState . isVisible = Visibility . Collapsed ;
77
- ContentFrame . Navigate ( typeof ( GenericFileBrowser ) , DocumentsPath ) ;
78
- auto_suggest . PlaceholderText = "Search Documents" ;
79
- }
80
- else if ( item . Name == "DownloadsIC" )
81
- {
82
- ItemViewModel . TextState . isVisible = Visibility . Collapsed ;
83
- ContentFrame . Navigate ( typeof ( GenericFileBrowser ) , DownloadsPath ) ;
84
- auto_suggest . PlaceholderText = "Search Downloads" ;
85
- }
86
- else if ( item . Name == "PicturesIC" )
87
- {
88
- ItemViewModel . TextState . isVisible = Visibility . Collapsed ;
89
- ContentFrame . Navigate ( typeof ( PhotoAlbum ) , PicturesPath ) ;
90
- auto_suggest . PlaceholderText = "Search Pictures" ;
91
- }
92
- else if ( item . Name == "MusicIC" )
93
- {
94
- ItemViewModel . TextState . isVisible = Visibility . Collapsed ;
95
- ContentFrame . Navigate ( typeof ( GenericFileBrowser ) , MusicPath ) ;
96
- auto_suggest . PlaceholderText = "Search Music" ;
97
- }
98
- else if ( item . Name == "VideosIC" )
67
+ if ( item . Content . Equals ( "Settings" ) )
99
68
{
100
- ItemViewModel . TextState . isVisible = Visibility . Collapsed ;
101
- ContentFrame . Navigate ( typeof ( GenericFileBrowser ) , VideosPath ) ;
102
- auto_suggest . PlaceholderText = "Search Videos" ;
103
- }
104
- else if ( item . Name == "LocD_IC" )
105
- {
106
- ItemViewModel . TextState . isVisible = Visibility . Collapsed ;
107
- ContentFrame . Navigate ( typeof ( GenericFileBrowser ) , @"C:\" ) ;
108
- auto_suggest . PlaceholderText = "Search" ;
109
- }
110
- else if ( item . Name == "OneD_IC" )
111
- {
112
- ItemViewModel . TextState . isVisible = Visibility . Collapsed ;
113
- ContentFrame . Navigate ( typeof ( GenericFileBrowser ) , OneDrivePath ) ;
114
- auto_suggest . PlaceholderText = "Search OneDrive" ;
115
- }
116
- else if ( item . Content . Equals ( "Settings" ) )
117
- {
118
- ContentFrame . Navigate ( typeof ( Settings ) ) ;
69
+ //ContentFrame.Navigate(typeof(Settings));
119
70
}
120
71
}
121
72
122
-
123
-
73
+
74
+
124
75
125
76
private void auto_suggest_QuerySubmitted ( AutoSuggestBox sender , AutoSuggestBoxQuerySubmittedEventArgs args )
126
77
{
127
-
78
+
128
79
}
129
80
130
81
private void navView_Loaded ( object sender , RoutedEventArgs e )
131
82
{
132
-
133
- foreach ( NavigationViewItemBase item in navView . MenuItems )
83
+
84
+ foreach ( NavigationViewItemBase NavItemChoice in nv . MenuItems )
134
85
{
135
- if ( item is NavigationViewItem && item . Name . ToString ( ) == "homeIc" )
86
+ if ( NavItemChoice is NavigationViewItem && NavItemChoice . Name . ToString ( ) == "homeIc" )
136
87
{
137
- Select . itemSelected = item ;
88
+ Select . itemSelected = NavItemChoice ;
138
89
break ;
139
90
}
140
91
}
92
+ ContentFrame . Navigate ( typeof ( YourHome ) ) ;
141
93
auto_suggest . IsEnabled = true ;
142
94
auto_suggest . PlaceholderText = "Search Recents" ;
143
95
}
144
- }
145
96
97
+ private void NavView_ItemInvoked ( NavigationView sender , NavigationViewItemInvokedEventArgs args )
98
+ {
99
+
100
+ var item = args . InvokedItem ;
101
+
102
+ //var item = Interaction.FindParent<NavigationViewItemBase>(args.InvokedItem as DependencyObject);
103
+ if ( args . IsSettingsInvoked == true )
104
+ {
105
+ ContentFrame . Navigate ( typeof ( Settings ) ) ;
106
+ }
107
+ else
108
+ {
109
+ if ( item . ToString ( ) == "Home" )
110
+ {
111
+ ContentFrame . Navigate ( typeof ( YourHome ) ) ;
112
+ auto_suggest . PlaceholderText = "Search Recents" ;
113
+ }
114
+ else if ( item . ToString ( ) == "Desktop" )
115
+ {
116
+ ItemViewModel . TextState . isVisible = Visibility . Collapsed ;
117
+ ContentFrame . Navigate ( typeof ( GenericFileBrowser ) , DesktopPath ) ;
118
+ auto_suggest . PlaceholderText = "Search Desktop" ;
119
+ }
120
+ else if ( item . ToString ( ) == "Documents" )
121
+ {
122
+ ItemViewModel . TextState . isVisible = Visibility . Collapsed ;
123
+ ContentFrame . Navigate ( typeof ( GenericFileBrowser ) , DocumentsPath ) ;
124
+ auto_suggest . PlaceholderText = "Search Documents" ;
125
+ }
126
+ else if ( item . ToString ( ) == "Downloads" )
127
+ {
128
+ ItemViewModel . TextState . isVisible = Visibility . Collapsed ;
129
+ ContentFrame . Navigate ( typeof ( GenericFileBrowser ) , DownloadsPath ) ;
130
+ auto_suggest . PlaceholderText = "Search Downloads" ;
131
+ }
132
+ else if ( item . ToString ( ) == "Pictures" )
133
+ {
134
+ ItemViewModel . TextState . isVisible = Visibility . Collapsed ;
135
+ ContentFrame . Navigate ( typeof ( PhotoAlbum ) , PicturesPath ) ;
136
+ auto_suggest . PlaceholderText = "Search Pictures" ;
137
+ }
138
+ else if ( item . ToString ( ) == "Music" )
139
+ {
140
+ ItemViewModel . TextState . isVisible = Visibility . Collapsed ;
141
+ ContentFrame . Navigate ( typeof ( GenericFileBrowser ) , MusicPath ) ;
142
+ auto_suggest . PlaceholderText = "Search Music" ;
143
+ }
144
+ else if ( item . ToString ( ) == "Videos" )
145
+ {
146
+ ItemViewModel . TextState . isVisible = Visibility . Collapsed ;
147
+ ContentFrame . Navigate ( typeof ( GenericFileBrowser ) , VideosPath ) ;
148
+ auto_suggest . PlaceholderText = "Search Videos" ;
149
+ }
150
+ else if ( item . ToString ( ) == "Local Disk" )
151
+ {
152
+ ItemViewModel . TextState . isVisible = Visibility . Collapsed ;
153
+ ContentFrame . Navigate ( typeof ( GenericFileBrowser ) , @"C:\" ) ;
154
+ auto_suggest . PlaceholderText = "Search" ;
155
+ }
156
+ else if ( item . ToString ( ) == "OneDrive" )
157
+ {
158
+ ItemViewModel . TextState . isVisible = Visibility . Collapsed ;
159
+ ContentFrame . Navigate ( typeof ( GenericFileBrowser ) , OneDrivePath ) ;
160
+ auto_suggest . PlaceholderText = "Search OneDrive" ;
161
+ }
146
162
163
+ }
164
+ }
165
+
166
+ }
147
167
public class SelectItem : INotifyPropertyChanged
148
168
{
149
169
@@ -173,5 +193,6 @@ private void NotifyPropertyChanged(string info)
173
193
PropertyChanged ? . Invoke ( this , new PropertyChangedEventArgs ( info ) ) ;
174
194
}
175
195
176
- }
196
+ }
197
+
177
198
}
0 commit comments