@@ -14,7 +14,6 @@ namespace Files
1414 public sealed partial class AddItem : Page
1515 {
1616 public ListView addItemsChoices ;
17- public ItemViewModel < AddItem > instanceViewModel ;
1817 public AddItem ( )
1918 {
2019 this . InitializeComponent ( ) ;
@@ -27,14 +26,7 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
2726 {
2827 base . OnNavigatedTo ( eventArgs ) ;
2928 var parameters = eventArgs . Parameter ;
30- if ( parameters . GetType ( ) == typeof ( GenericFileBrowser ) )
31- {
32- instanceViewModel = new ItemViewModel < AddItem > ( ) ;
33- }
34- else if ( parameters . GetType ( ) == typeof ( PhotoAlbum ) )
35- {
36- instanceViewModel = new ItemViewModel < AddItem > ( ) ;
37- }
29+
3830 }
3931
4032 public static List < AddListItem > AddItemsList = new List < AddListItem > ( ) ;
@@ -52,7 +44,7 @@ public T GetCurrentSelectedTabInstance<T>()
5244 {
5345 Frame rootFrame = Window . Current . Content as Frame ;
5446 var instanceTabsView = rootFrame . Content as InstanceTabsView ;
55- var selectedTabContent = ( ( instanceTabsView . tabView . SelectedItem as TabViewItem ) . Content as Grid ) ;
47+ var selectedTabContent = ( ( InstanceTabsView . tabView . SelectedItem as TabViewItem ) . Content as Grid ) ;
5648 foreach ( UIElement uiElement in selectedTabContent . Children )
5749 {
5850 if ( uiElement . GetType ( ) == typeof ( Frame ) )
@@ -69,11 +61,11 @@ private async void ListView_ItemClick(object sender, ItemClickEventArgs e)
6961 string currentPath = null ;
7062 if ( TabInstance . accessibleContentFrame . SourcePageType == typeof ( GenericFileBrowser ) )
7163 {
72- currentPath = ( TabInstance . accessibleContentFrame . Content as GenericFileBrowser ) . instanceViewModel . Universal . path ;
64+ currentPath = TabInstance . instanceViewModel . Universal . path ;
7365 }
7466 else if ( TabInstance . accessibleContentFrame . SourcePageType == typeof ( PhotoAlbum ) )
7567 {
76- currentPath = ( TabInstance . accessibleContentFrame . Content as PhotoAlbum ) . instanceViewModel . Universal . path ;
68+ currentPath = TabInstance . instanceViewModel . Universal . path ;
7769 }
7870 StorageFolder folderToCreateItem = await StorageFolder . GetFolderFromPathAsync ( currentPath ) ;
7971 RenameDialog renameDialog = new RenameDialog ( ) ;
@@ -84,12 +76,12 @@ private async void ListView_ItemClick(object sender, ItemClickEventArgs e)
8476 if ( userInput != "" )
8577 {
8678 var folder = await folderToCreateItem . CreateFolderAsync ( userInput , CreationCollisionOption . FailIfExists ) ;
87- instanceViewModel . AddFileOrFolder ( new ListedItem ( folder . FolderRelativeId ) { FileName = userInput , FileDateReal = DateTimeOffset . Now , EmptyImgVis = Visibility . Collapsed , FolderImg = Visibility . Visible , FileIconVis = Visibility . Collapsed , FileType = "Folder" , FileImg = null , FilePath = ( instanceViewModel . Universal . path + "\\ " + userInput ) } ) ;
79+ TabInstance . instanceViewModel . AddFileOrFolder ( new ListedItem ( folder . FolderRelativeId ) { FileName = userInput , FileDateReal = DateTimeOffset . Now , EmptyImgVis = Visibility . Collapsed , FolderImg = Visibility . Visible , FileIconVis = Visibility . Collapsed , FileType = "Folder" , FileImg = null , FilePath = ( TabInstance . instanceViewModel . Universal . path + "\\ " + userInput ) } ) ;
8880 }
8981 else
9082 {
9183 var folder = await folderToCreateItem . CreateFolderAsync ( "New Folder" , CreationCollisionOption . GenerateUniqueName ) ;
92- instanceViewModel . AddFileOrFolder ( new ListedItem ( folder . FolderRelativeId ) { FileName = userInput , FileDateReal = DateTimeOffset . Now , EmptyImgVis = Visibility . Collapsed , FolderImg = Visibility . Visible , FileIconVis = Visibility . Collapsed , FileType = "Folder" , FileImg = null , FilePath = ( instanceViewModel . Universal . path + "\\ " + userInput ) } ) ;
84+ TabInstance . instanceViewModel . AddFileOrFolder ( new ListedItem ( folder . FolderRelativeId ) { FileName = userInput , FileDateReal = DateTimeOffset . Now , EmptyImgVis = Visibility . Collapsed , FolderImg = Visibility . Visible , FileIconVis = Visibility . Collapsed , FileType = "Folder" , FileImg = null , FilePath = ( TabInstance . instanceViewModel . Universal . path + "\\ " + userInput ) } ) ;
9385 }
9486 }
9587 else if ( ( e . ClickedItem as AddListItem ) . Header == "Text Document" )
@@ -99,12 +91,12 @@ private async void ListView_ItemClick(object sender, ItemClickEventArgs e)
9991 if ( userInput != "" )
10092 {
10193 var folder = await folderToCreateItem . CreateFileAsync ( userInput + ".txt" , CreationCollisionOption . FailIfExists ) ;
102- instanceViewModel . AddFileOrFolder ( new ListedItem ( folder . FolderRelativeId ) { FileName = userInput , FileDateReal = DateTimeOffset . Now , EmptyImgVis = Visibility . Visible , FolderImg = Visibility . Collapsed , FileIconVis = Visibility . Collapsed , FileType = "Text Document" , FileImg = null , FilePath = ( instanceViewModel . Universal . path + "\\ " + userInput + ".txt" ) , DotFileExtension = ".txt" } ) ;
94+ TabInstance . instanceViewModel . AddFileOrFolder ( new ListedItem ( folder . FolderRelativeId ) { FileName = userInput , FileDateReal = DateTimeOffset . Now , EmptyImgVis = Visibility . Visible , FolderImg = Visibility . Collapsed , FileIconVis = Visibility . Collapsed , FileType = "Text Document" , FileImg = null , FilePath = ( TabInstance . instanceViewModel . Universal . path + "\\ " + userInput + ".txt" ) , DotFileExtension = ".txt" } ) ;
10395 }
10496 else
10597 {
10698 var folder = await folderToCreateItem . CreateFileAsync ( "New Text Document" + ".txt" , CreationCollisionOption . GenerateUniqueName ) ;
107- instanceViewModel . AddFileOrFolder ( new ListedItem ( folder . FolderRelativeId ) { FileName = userInput , FileDateReal = DateTimeOffset . Now , EmptyImgVis = Visibility . Visible , FolderImg = Visibility . Collapsed , FileIconVis = Visibility . Collapsed , FileType = "Text Document" , FileImg = null , FilePath = ( instanceViewModel . Universal . path + "\\ " + userInput + ".txt" ) , DotFileExtension = ".txt" } ) ;
99+ TabInstance . instanceViewModel . AddFileOrFolder ( new ListedItem ( folder . FolderRelativeId ) { FileName = userInput , FileDateReal = DateTimeOffset . Now , EmptyImgVis = Visibility . Visible , FolderImg = Visibility . Collapsed , FileIconVis = Visibility . Collapsed , FileType = "Text Document" , FileImg = null , FilePath = ( TabInstance . instanceViewModel . Universal . path + "\\ " + userInput + ".txt" ) , DotFileExtension = ".txt" } ) ;
108100 }
109101 }
110102 else if ( ( e . ClickedItem as AddListItem ) . Header == "Bitmap Image" )
@@ -114,12 +106,12 @@ private async void ListView_ItemClick(object sender, ItemClickEventArgs e)
114106 if ( userInput != "" )
115107 {
116108 var folder = await folderToCreateItem . CreateFileAsync ( userInput + ".bmp" , CreationCollisionOption . FailIfExists ) ;
117- instanceViewModel . AddFileOrFolder ( new ListedItem ( folder . FolderRelativeId ) { FileName = userInput , FileDateReal = DateTimeOffset . Now , EmptyImgVis = Visibility . Visible , FolderImg = Visibility . Collapsed , FileIconVis = Visibility . Collapsed , FileType = "BMP File" , FileImg = null , FilePath = ( instanceViewModel . Universal . path + "\\ " + userInput + ".bmp" ) , DotFileExtension = ".bmp" } ) ;
109+ TabInstance . instanceViewModel . AddFileOrFolder ( new ListedItem ( folder . FolderRelativeId ) { FileName = userInput , FileDateReal = DateTimeOffset . Now , EmptyImgVis = Visibility . Visible , FolderImg = Visibility . Collapsed , FileIconVis = Visibility . Collapsed , FileType = "BMP File" , FileImg = null , FilePath = ( TabInstance . instanceViewModel . Universal . path + "\\ " + userInput + ".bmp" ) , DotFileExtension = ".bmp" } ) ;
118110 }
119111 else
120112 {
121113 var folder = await folderToCreateItem . CreateFileAsync ( "New Bitmap Image" + ".bmp" , CreationCollisionOption . GenerateUniqueName ) ;
122- instanceViewModel . AddFileOrFolder ( new ListedItem ( folder . FolderRelativeId ) { FileName = userInput , FileDateReal = DateTimeOffset . Now , EmptyImgVis = Visibility . Visible , FolderImg = Visibility . Collapsed , FileIconVis = Visibility . Collapsed , FileType = "BMP File" , FileImg = null , FilePath = ( instanceViewModel . Universal . path + "\\ " + userInput + ".bmp" ) , DotFileExtension = ".bmp" } ) ;
114+ TabInstance . instanceViewModel . AddFileOrFolder ( new ListedItem ( folder . FolderRelativeId ) { FileName = userInput , FileDateReal = DateTimeOffset . Now , EmptyImgVis = Visibility . Visible , FolderImg = Visibility . Collapsed , FileIconVis = Visibility . Collapsed , FileType = "BMP File" , FileImg = null , FilePath = ( TabInstance . instanceViewModel . Universal . path + "\\ " + userInput + ".bmp" ) , DotFileExtension = ".bmp" } ) ;
123115 }
124116 }
125117 }
0 commit comments