public async Task MoveDocumentAsync( MyDocument document, ObservableCollection <MyDocument> documents, string name) { var newPath = folderAffirm(null, null); if (newPath == null) { return; } newPath = $"{newPath}\\{document.Name}.docx"; try { await Task.Run(() => FileService.Move(document.Name, newPath)); var tempProtocol = document; tempProtocol.Name = newPath; documents.Remove(document); documents.Add(tempProtocol); NotifyPropertyChanged(name); } catch (Exception e) { await actionAffirm("Ошибка", e.Message, true); } }
public void RemoveDocument(MyDocument document, ObservableCollection <MyDocument> collection, string name) { if (name == null) { throw new ArgumentNullException(nameof(name)); } collection.Remove(document); }
public async Task OpenWithDefaultAppAsync(MyDocument document) { await Task.Run(() => FileService.OpenWithDefaultApp(document?.Name)); }