Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
 public void RemoveDocument(MyDocument document, ObservableCollection <MyDocument> collection, string name)
 {
     if (name == null)
     {
         throw new ArgumentNullException(nameof(name));
     }
     collection.Remove(document);
 }
Ejemplo n.º 3
0
 public async Task OpenWithDefaultAppAsync(MyDocument document)
 {
     await Task.Run(() => FileService.OpenWithDefaultApp(document?.Name));
 }