예제 #1
0
        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;
        }
예제 #2
0
        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;
        }
예제 #3
0
        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);
        }