@@ -48,9 +48,11 @@ public class ItemViewModel<PageType> where PageType : class
48
48
49
49
private const int _step = 250 ;
50
50
51
+ private ProHome tabInstance ;
52
+
51
53
public ItemViewModel ( )
52
54
{
53
-
55
+ tabInstance = GetCurrentSelectedTabInstance < ProHome > ( ) ;
54
56
_filesAndFolders = new ObservableCollection < ListedItem > ( ) ;
55
57
_classicFileList = new ObservableCollection < ListedItem > ( ) ;
56
58
_classicFolderList = new ObservableCollection < Classic_ListedFolderItem > ( ) ;
@@ -60,91 +62,91 @@ public ItemViewModel()
60
62
ClassicFolderList = new ReadOnlyObservableCollection < Classic_ListedFolderItem > ( _classicFolderList ) ;
61
63
if ( typeof ( PageType ) == typeof ( GenericFileBrowser ) )
62
64
{
63
- ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as GenericFileBrowser ) . emptyTextGFB . Visibility = Visibility . Collapsed ;
65
+ ( tabInstance . accessibleContentFrame . Content as GenericFileBrowser ) . emptyTextGFB . Visibility = Visibility . Collapsed ;
64
66
}
65
67
else if ( typeof ( PageType ) == typeof ( PhotoAlbum ) )
66
68
{
67
- ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as PhotoAlbum ) . EmptyTextPA . Visibility = Visibility . Collapsed ;
69
+ ( tabInstance . accessibleContentFrame . Content as PhotoAlbum ) . EmptyTextPA . Visibility = Visibility . Collapsed ;
68
70
}
69
71
else if ( typeof ( PageType ) == typeof ( AddItem ) )
70
72
{
71
- if ( ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as GenericFileBrowser ) != null )
73
+ if ( ( tabInstance . accessibleContentFrame . Content as GenericFileBrowser ) != null )
72
74
{
73
- ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as GenericFileBrowser ) . emptyTextGFB . Visibility = Visibility . Collapsed ;
75
+ ( tabInstance . accessibleContentFrame . Content as GenericFileBrowser ) . emptyTextGFB . Visibility = Visibility . Collapsed ;
74
76
}
75
- else if ( ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as PhotoAlbum ) != null )
77
+ else if ( ( tabInstance . accessibleContentFrame . Content as PhotoAlbum ) != null )
76
78
{
77
- ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as PhotoAlbum ) . EmptyTextPA . Visibility = Visibility . Collapsed ;
79
+ ( tabInstance . accessibleContentFrame . Content as PhotoAlbum ) . EmptyTextPA . Visibility = Visibility . Collapsed ;
78
80
}
79
81
}
80
82
81
- GetCurrentSelectedTabInstance < ProHome > ( ) . HomeItems . PropertyChanged += HomeItems_PropertyChanged ;
82
- GetCurrentSelectedTabInstance < ProHome > ( ) . ShareItems . PropertyChanged += ShareItems_PropertyChanged ;
83
- GetCurrentSelectedTabInstance < ProHome > ( ) . LayoutItems . PropertyChanged += LayoutItems_PropertyChanged ;
84
- GetCurrentSelectedTabInstance < ProHome > ( ) . AlwaysPresentCommands . PropertyChanged += AlwaysPresentCommands_PropertyChanged ;
83
+ tabInstance . HomeItems . PropertyChanged += HomeItems_PropertyChanged ;
84
+ tabInstance . ShareItems . PropertyChanged += ShareItems_PropertyChanged ;
85
+ tabInstance . LayoutItems . PropertyChanged += LayoutItems_PropertyChanged ;
86
+ tabInstance . AlwaysPresentCommands . PropertyChanged += AlwaysPresentCommands_PropertyChanged ;
85
87
}
86
88
87
89
private void AlwaysPresentCommands_PropertyChanged ( object sender , System . ComponentModel . PropertyChangedEventArgs e )
88
90
{
89
- if ( GetCurrentSelectedTabInstance < ProHome > ( ) . AlwaysPresentCommands . isEnabled == true )
91
+ if ( tabInstance . AlwaysPresentCommands . isEnabled == true )
90
92
{
91
- GetCurrentSelectedTabInstance < ProHome > ( ) . AlwaysPresentCommands . isEnabled = true ;
93
+ tabInstance . AlwaysPresentCommands . isEnabled = true ;
92
94
}
93
95
else
94
96
{
95
- GetCurrentSelectedTabInstance < ProHome > ( ) . AlwaysPresentCommands . isEnabled = false ;
97
+ tabInstance . AlwaysPresentCommands . isEnabled = false ;
96
98
}
97
99
}
98
100
99
101
private void LayoutItems_PropertyChanged ( object sender , System . ComponentModel . PropertyChangedEventArgs e )
100
102
{
101
- if ( GetCurrentSelectedTabInstance < ProHome > ( ) . LayoutItems . isEnabled == true )
103
+ if ( tabInstance . LayoutItems . isEnabled == true )
102
104
{
103
- GetCurrentSelectedTabInstance < ProHome > ( ) . LayoutItems . isEnabled = true ;
105
+ tabInstance . LayoutItems . isEnabled = true ;
104
106
}
105
107
else
106
108
{
107
- GetCurrentSelectedTabInstance < ProHome > ( ) . LayoutItems . isEnabled = false ;
109
+ tabInstance . LayoutItems . isEnabled = false ;
108
110
}
109
111
}
110
112
111
113
private void ShareItems_PropertyChanged ( object sender , System . ComponentModel . PropertyChangedEventArgs e )
112
114
{
113
- if ( GetCurrentSelectedTabInstance < ProHome > ( ) . ShareItems . isEnabled == true )
115
+ if ( tabInstance . ShareItems . isEnabled == true )
114
116
{
115
- GetCurrentSelectedTabInstance < ProHome > ( ) . ShareItems . isEnabled = true ;
117
+ tabInstance . ShareItems . isEnabled = true ;
116
118
}
117
119
else
118
120
{
119
- GetCurrentSelectedTabInstance < ProHome > ( ) . ShareItems . isEnabled = false ;
121
+ tabInstance . ShareItems . isEnabled = false ;
120
122
}
121
123
}
122
124
123
125
private void HomeItems_PropertyChanged ( object sender , System . ComponentModel . PropertyChangedEventArgs e )
124
126
{
125
- if ( GetCurrentSelectedTabInstance < ProHome > ( ) . HomeItems . isEnabled == true )
127
+ if ( tabInstance . HomeItems . isEnabled == true )
126
128
{
127
- GetCurrentSelectedTabInstance < ProHome > ( ) . HomeItems . isEnabled = true ;
129
+ tabInstance . HomeItems . isEnabled = true ;
128
130
}
129
131
else
130
132
{
131
- GetCurrentSelectedTabInstance < ProHome > ( ) . HomeItems . isEnabled = false ;
133
+ tabInstance . HomeItems . isEnabled = false ;
132
134
}
133
135
134
136
}
135
137
136
138
public void AddFileOrFolder ( ListedItem item )
137
139
{
138
140
_filesAndFolders . Add ( item ) ;
139
- if ( ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as GenericFileBrowser ) != null || ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as PhotoAlbum ) != null )
141
+ if ( ( tabInstance . accessibleContentFrame . Content as GenericFileBrowser ) != null || ( tabInstance . accessibleContentFrame . Content as PhotoAlbum ) != null )
140
142
{
141
143
if ( typeof ( PageType ) == typeof ( GenericFileBrowser ) )
142
144
{
143
- ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as GenericFileBrowser ) . emptyTextGFB . Visibility = Visibility . Collapsed ;
145
+ ( tabInstance . accessibleContentFrame . Content as GenericFileBrowser ) . emptyTextGFB . Visibility = Visibility . Collapsed ;
144
146
}
145
147
else if ( typeof ( PageType ) == typeof ( PhotoAlbum ) )
146
148
{
147
- ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as PhotoAlbum ) . EmptyTextPA . Visibility = Visibility . Collapsed ;
149
+ ( tabInstance . accessibleContentFrame . Content as PhotoAlbum ) . EmptyTextPA . Visibility = Visibility . Collapsed ;
148
150
}
149
151
}
150
152
@@ -155,15 +157,15 @@ public void RemoveFileOrFolder(ListedItem item)
155
157
_filesAndFolders . Remove ( item ) ;
156
158
if ( _filesAndFolders . Count == 0 )
157
159
{
158
- if ( ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as GenericFileBrowser ) != null || ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as PhotoAlbum ) != null )
160
+ if ( ( tabInstance . accessibleContentFrame . Content as GenericFileBrowser ) != null || ( tabInstance . accessibleContentFrame . Content as PhotoAlbum ) != null )
159
161
{
160
162
if ( typeof ( PageType ) == typeof ( GenericFileBrowser ) )
161
163
{
162
- ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as GenericFileBrowser ) . emptyTextGFB . Visibility = Visibility . Visible ;
164
+ ( tabInstance . accessibleContentFrame . Content as GenericFileBrowser ) . emptyTextGFB . Visibility = Visibility . Visible ;
163
165
}
164
166
else if ( typeof ( PageType ) == typeof ( PhotoAlbum ) )
165
167
{
166
- ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as PhotoAlbum ) . EmptyTextPA . Visibility = Visibility . Visible ;
168
+ ( tabInstance . accessibleContentFrame . Content as PhotoAlbum ) . EmptyTextPA . Visibility = Visibility . Visible ;
167
169
}
168
170
}
169
171
}
@@ -200,7 +202,7 @@ public static T GetCurrentSelectedTabInstance<T>()
200
202
201
203
public async void DisplayConsentDialog ( )
202
204
{
203
- await GetCurrentSelectedTabInstance < ProHome > ( ) . permissionBox . ShowAsync ( ) ;
205
+ await tabInstance . permissionBox . ShowAsync ( ) ;
204
206
}
205
207
206
208
public async void AddItemsToCollectionAsync ( string path , Page currentPage )
@@ -212,14 +214,14 @@ public async void AddItemsToCollectionAsync(string path, Page currentPage)
212
214
213
215
_cancellationTokenSource = new CancellationTokenSource ( ) ;
214
216
215
- //GetCurrentSelectedTabInstance<ProHome>() .TextState.isVisible = Visibility.Collapsed;
217
+ //tabInstance .TextState.isVisible = Visibility.Collapsed;
216
218
if ( typeof ( PageType ) == typeof ( GenericFileBrowser ) )
217
219
{
218
- ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as GenericFileBrowser ) . TextState . isVisible = Visibility . Collapsed ;
220
+ ( tabInstance . accessibleContentFrame . Content as GenericFileBrowser ) . TextState . isVisible = Visibility . Collapsed ;
219
221
}
220
222
else if ( typeof ( PageType ) == typeof ( PhotoAlbum ) )
221
223
{
222
- ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as PhotoAlbum ) . TextState . isVisible = Visibility . Collapsed ;
224
+ ( tabInstance . accessibleContentFrame . Content as PhotoAlbum ) . TextState . isVisible = Visibility . Collapsed ;
223
225
}
224
226
225
227
_filesAndFolders . Clear ( ) ;
@@ -230,11 +232,11 @@ public async void AddItemsToCollectionAsync(string path, Page currentPage)
230
232
231
233
if ( typeof ( PageType ) == typeof ( GenericFileBrowser ) )
232
234
{
233
- ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as GenericFileBrowser ) . progressBar . Visibility = Visibility . Visible ;
235
+ ( tabInstance . accessibleContentFrame . Content as GenericFileBrowser ) . progressBar . Visibility = Visibility . Visible ;
234
236
}
235
237
else if ( typeof ( PageType ) == typeof ( PhotoAlbum ) )
236
238
{
237
- ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as PhotoAlbum ) . progressBar . Visibility = Visibility . Visible ;
239
+ ( tabInstance . accessibleContentFrame . Content as PhotoAlbum ) . progressBar . Visibility = Visibility . Visible ;
238
240
}
239
241
240
242
switch ( Universal . path )
@@ -268,8 +270,8 @@ public async void AddItemsToCollectionAsync(string path, Page currentPage)
268
270
269
271
//History.AddToHistory(Universal.path);
270
272
271
- GetCurrentSelectedTabInstance < ProHome > ( ) . BackButton . IsEnabled = GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . CanGoBack ;
272
- GetCurrentSelectedTabInstance < ProHome > ( ) . ForwardButton . IsEnabled = GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . CanGoForward ;
273
+ tabInstance . BackButton . IsEnabled = tabInstance . accessibleContentFrame . CanGoBack ;
274
+ tabInstance . ForwardButton . IsEnabled = tabInstance . accessibleContentFrame . CanGoForward ;
273
275
274
276
switch ( await _rootFolder . GetIndexedStateAsync ( ) )
275
277
{
@@ -354,11 +356,11 @@ public async void AddItemsToCollectionAsync(string path, Page currentPage)
354
356
{
355
357
if ( typeof ( PageType ) == typeof ( GenericFileBrowser ) )
356
358
{
357
- ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as GenericFileBrowser ) . TextState . isVisible = Visibility . Visible ;
359
+ ( tabInstance . accessibleContentFrame . Content as GenericFileBrowser ) . TextState . isVisible = Visibility . Visible ;
358
360
}
359
361
else if ( typeof ( PageType ) == typeof ( PhotoAlbum ) )
360
362
{
361
- ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as PhotoAlbum ) . TextState . isVisible = Visibility . Visible ;
363
+ ( tabInstance . accessibleContentFrame . Content as PhotoAlbum ) . TextState . isVisible = Visibility . Visible ;
362
364
}
363
365
}
364
366
stopwatch . Stop ( ) ;
@@ -397,11 +399,11 @@ public async void AddItemsToCollectionAsync(string path, Page currentPage)
397
399
398
400
if ( typeof ( PageType ) == typeof ( GenericFileBrowser ) )
399
401
{
400
- ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as GenericFileBrowser ) . progressBar . Visibility = Visibility . Collapsed ;
402
+ ( tabInstance . accessibleContentFrame . Content as GenericFileBrowser ) . progressBar . Visibility = Visibility . Collapsed ;
401
403
}
402
404
else if ( typeof ( PageType ) == typeof ( PhotoAlbum ) )
403
405
{
404
- ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as PhotoAlbum ) . progressBar . Visibility = Visibility . Collapsed ;
406
+ ( tabInstance . accessibleContentFrame . Content as PhotoAlbum ) . progressBar . Visibility = Visibility . Collapsed ;
405
407
}
406
408
}
407
409
@@ -444,13 +446,13 @@ private async Task AddFolder(StorageFolder folder, CancellationToken token)
444
446
FileSize = null ,
445
447
RowIndex = _filesAndFolders . Count
446
448
} ) ;
447
- if ( ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as GenericFileBrowser ) != null )
449
+ if ( ( tabInstance . accessibleContentFrame . Content as GenericFileBrowser ) != null )
448
450
{
449
- ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as GenericFileBrowser ) . emptyTextGFB . Visibility = Visibility . Collapsed ;
451
+ ( tabInstance . accessibleContentFrame . Content as GenericFileBrowser ) . emptyTextGFB . Visibility = Visibility . Collapsed ;
450
452
}
451
- else if ( ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as PhotoAlbum ) != null )
453
+ else if ( ( tabInstance . accessibleContentFrame . Content as PhotoAlbum ) != null )
452
454
{
453
- ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as PhotoAlbum ) . EmptyTextPA . Visibility = Visibility . Collapsed ;
455
+ ( tabInstance . accessibleContentFrame . Content as PhotoAlbum ) . EmptyTextPA . Visibility = Visibility . Collapsed ;
454
456
}
455
457
}
456
458
else if ( typeof ( PageType ) == typeof ( ClassicMode ) )
@@ -556,11 +558,11 @@ private async Task AddFile(StorageFile file, CancellationToken token)
556
558
557
559
if ( typeof ( PageType ) == typeof ( GenericFileBrowser ) )
558
560
{
559
- ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as GenericFileBrowser ) . emptyTextGFB . Visibility = Visibility . Collapsed ;
561
+ ( tabInstance . accessibleContentFrame . Content as GenericFileBrowser ) . emptyTextGFB . Visibility = Visibility . Collapsed ;
560
562
}
561
563
else if ( typeof ( PageType ) == typeof ( PhotoAlbum ) )
562
564
{
563
- ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as PhotoAlbum ) . EmptyTextPA . Visibility = Visibility . Collapsed ;
565
+ ( tabInstance . accessibleContentFrame . Content as PhotoAlbum ) . EmptyTextPA . Visibility = Visibility . Collapsed ;
564
566
}
565
567
}
566
568
else
@@ -595,15 +597,15 @@ public async void FileContentsChanged(IStorageQueryResultBase sender, object arg
595
597
await CoreApplication . MainView . CoreWindow . Dispatcher . RunAsync ( CoreDispatcherPriority . Normal ,
596
598
( ) =>
597
599
{
598
- if ( ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as GenericFileBrowser ) != null || ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as PhotoAlbum ) != null )
600
+ if ( ( tabInstance . accessibleContentFrame . Content as GenericFileBrowser ) != null || ( tabInstance . accessibleContentFrame . Content as PhotoAlbum ) != null )
599
601
{
600
602
if ( typeof ( PageType ) == typeof ( GenericFileBrowser ) )
601
603
{
602
- ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as GenericFileBrowser ) . progressBar . Visibility = Visibility . Visible ;
604
+ ( tabInstance . accessibleContentFrame . Content as GenericFileBrowser ) . progressBar . Visibility = Visibility . Visible ;
603
605
}
604
606
else if ( typeof ( PageType ) == typeof ( PhotoAlbum ) )
605
607
{
606
- ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as PhotoAlbum ) . progressBar . Visibility = Visibility . Visible ;
608
+ ( tabInstance . accessibleContentFrame . Content as PhotoAlbum ) . progressBar . Visibility = Visibility . Visible ;
607
609
}
608
610
}
609
611
} ) ;
@@ -661,15 +663,15 @@ await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPrio
661
663
await CoreApplication . MainView . CoreWindow . Dispatcher . RunAsync ( CoreDispatcherPriority . Normal ,
662
664
( ) =>
663
665
{
664
- if ( ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as GenericFileBrowser ) != null || ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as PhotoAlbum ) != null )
666
+ if ( ( tabInstance . accessibleContentFrame . Content as GenericFileBrowser ) != null || ( tabInstance . accessibleContentFrame . Content as PhotoAlbum ) != null )
665
667
{
666
668
if ( typeof ( PageType ) == typeof ( GenericFileBrowser ) )
667
669
{
668
- ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as GenericFileBrowser ) . progressBar . Visibility = Visibility . Collapsed ;
670
+ ( tabInstance . accessibleContentFrame . Content as GenericFileBrowser ) . progressBar . Visibility = Visibility . Collapsed ;
669
671
}
670
672
else if ( typeof ( PageType ) == typeof ( PhotoAlbum ) )
671
673
{
672
- ( GetCurrentSelectedTabInstance < ProHome > ( ) . accessibleContentFrame . Content as PhotoAlbum ) . progressBar . Visibility = Visibility . Collapsed ;
674
+ ( tabInstance . accessibleContentFrame . Content as PhotoAlbum ) . progressBar . Visibility = Visibility . Collapsed ;
673
675
}
674
676
}
675
677
} ) ;
0 commit comments