/// <summary>
 /// Removes the provided Archive from the file index.</summary>
 private async void RemoveArchive(ArchiveViewModel archive)
 {
     if (archive != null && archive is ArchiveViewModel && archive.Archive != null)
     {
         await Index.RemoveArchiveAsync(archive.Archive);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Rescans the provided Archive and refreshes all file hashes, nodes and the directory structure.</summary>
        /// <param name="archive">The Archive that should be updated.</param>
        /// <param name="cancellationToken">Cancellation token for the async operation.</param>
        /// <param name="progress">Progress object used to report the progress of the operation.</param>
        /// <param name="statusText">Progress object used to provide feedback over the current status of the operation.</param>
        /// <param name="label">The display name for the new archive.</param>
        public async Task UpdateArchiveAsync(ArchiveViewModel archive, CancellationToken cancellationToken, IProgress <int> progress, IProgress <string> statusText)
        {
            IsOperationInProgress = true;

            await index.UpdateArchiveAsync(archive.Archive, cancellationToken, progress, statusText);

            IsOperationInProgress = false;
        }
        /// <summary>
        /// Removes the provided Archive from the file index.</summary>
        private async Task RemoveArchive(ArchiveViewModel archive)
        {
            var confirmDiag = new OKCancelPopupViewModel("Do you want to delete Archive " + archive.Label + "?\nThis action cannot be undone.", "", "Delete", "No");

            if (confirmDiag.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            // User has confirmed the deletion, continue
            if (archive != null && archive is ArchiveViewModel && archive.Archive != null)
            {
                await Index.RemoveArchiveAsync(archive.Archive);
            }
        }