/// <summary> /// Called when the file selected. /// </summary> public void OnFileSelection(FileSelectionEventValue value) { if (value.Paths.Count() <= 1) { this.SelectedFolderName = Path.GetFileName(value.Paths.First()); return; } this.SelectedFolderName = string.Join(' ', value.Paths.Select(p => $"\"{Path.GetFileName(p)}\"")); }
/// <summary> /// Runs when the SelectedItemChanged event occurs in the DataGrid displaying a file. /// </summary> private void OnSelection() { var selectedFiles = this.CurrentFileSystems.Where(f => f.IsSelected); if (this.SelectionTarget != TargetFileType.FileAndFolder) { var fileType = this.SelectionTarget == TargetFileType.FileOnly ? FileType.File : FileType.Folder; selectedFiles = selectedFiles.Where(f => f.FileType == fileType); } if (!selectedFiles.Any()) { return; } var value = new FileSelectionEventValue() { Paths = selectedFiles.Select(f => f.Path), TargetFileType = this.SelectionTarget, }; this.eventAggregator.GetEvent <FileSelectionEvent>().Publish(value); }
/// <summary> /// Called when the file selected. /// </summary> public void OnFileSelection(FileSelectionEventValue value) { this.SaveFileName = Path.GetFileName(value.Paths.First()); }