public override async void Activate(object parameter, NavigationMode navigationMode) { base.Activate(parameter, navigationMode); await _fileService.IsInitialized.Task; ShouldShowPlaceholder = FileGroups.Any(x => x.Files.Any()) ? Visibility.Collapsed : Visibility.Visible; }
private async void DeleteFile(BindableStorageFile item) { FileService.FileLocation location = _fileService.GetFileLocation(item); await _fileService.DeleteFileAsync((StorageFile)item.BackingFile, location); if (item == ActiveFile) { ActiveFile = null; } ShouldShowPlaceholder = FileGroups.Any(x => x.Files.Any()) ? Visibility.Collapsed : Visibility.Visible; }
private async Task OpenFile(StorageFile file) { bool isValid = await _fileService.ValidateFileAsync(file); if (!isValid) { MessageDialog dialog = new MessageDialog("The file you tried to open was not formatted correctly. Are you sure it's a two-column comma-delimited file?", "Unable to read file"); await dialog.ShowAsync(); return; } AddFileDialogOutput output = await ShowAddFileDialog(file.Name); if (output == null) { return; } string contents = await FileIO.ReadTextAsync(file); ActiveFile = await _fileService.SaveAndEncryptFileAsync(contents, output.FileName, output.Password); ShouldShowPlaceholder = FileGroups.Any(x => x.Files.Any()) ? Visibility.Collapsed : Visibility.Visible; _codeDictionary = await GetCodes(output.Password); }