public async void SetPinInfoListAsync(FileObjectViewItem folder, string message, IStorageManager iStorageManager, int currentPlatformIndex) { // Set Mutex true and Show Process Indicator this.FileObjectViewModel.IsDataLoaded = true; this.FileObjectViewModel.IsDataLoading = true; this.SetListUnableAndShowMessage(uiPinInfoList, message, uiPinInfoMessage); this.SetProgressIndicator(true); // Wait tasks await App.TaskManager.WaitSignInTask(currentPlatformIndex); await App.TaskManager.WaitSignOutTask(currentPlatformIndex); // If it haven't signed out before working below code, do it. if (iStorageManager.GetAccount() != null) { // Delete selected file and If folder null, set root. this.SelectedFile.Clear(); if (folder == null) { this.Dispatcher.BeginInvoke(() => { uiPinInfoCurrentPath.Text = ""; }); this.FolderRootTree.Clear(); this.FoldersTree.Clear(); FileObject rootFolder = await iStorageManager.GetRootFolderAsync(); folder = new FileObjectViewItem(); folder.Id = rootFolder.Id; } // Get files and push to stack tree. List<FileObject> files = await iStorageManager.GetFilesFromFolderAsync(folder.Id); if (!message.Equals(AppResources.Refreshing)) { this.FolderRootTree.Push(folder); this.FoldersTree.Push(files); } // Set file list visible and current path. base.Dispatcher.BeginInvoke(() => { // Set file tree to list. uiPinInfoList.Visibility = Visibility.Visible; uiPinInfoCurrentPath.Text = this.GetCurrentPath(); this.FileObjectViewModel.SetItems(files, true); }); // If there exists file, show it. // Otherwise, show no file message. if (files.Count > 0) { base.Dispatcher.BeginInvoke(() => { uiPinInfoMessage.Visibility = Visibility.Collapsed; }); } else { base.Dispatcher.BeginInvoke(() => { uiPinInfoMessage.Text = AppResources.NoFileInFolderMessage; }); } } else { this.Dispatcher.BeginInvoke(() => { uiPinInfoListGrid.Visibility = Visibility.Collapsed; uiPinInfoSignInGrid.Visibility = Visibility.Visible; }); } // Set Mutex false and Hide Process Indicator this.SetProgressIndicator(false); this.FileObjectViewModel.IsDataLoading = false; }