|
|
|
@ -198,6 +198,7 @@ public partial class CheckpointFolder : ViewModelBase
|
|
|
|
|
var textBox = new TextBox(); |
|
|
|
|
var dialog = new ContentDialog |
|
|
|
|
{ |
|
|
|
|
Title = "Folder name", |
|
|
|
|
Content = textBox, |
|
|
|
|
DefaultButton = ContentDialogButton.Primary, |
|
|
|
|
PrimaryButtonText = "OK", |
|
|
|
@ -231,6 +232,8 @@ public partial class CheckpointFolder : ViewModelBase
|
|
|
|
|
/// Imports files to the folder. Reports progress to instance properties. |
|
|
|
|
/// </summary> |
|
|
|
|
public async Task ImportFilesAsync(IEnumerable<string> files, bool convertToConnected = false) |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
Progress.Value = 0; |
|
|
|
|
var copyPaths = files.ToDictionary(k => k, v => Path.Combine(DirectoryPath, Path.GetFileName(v))); |
|
|
|
@ -259,11 +262,11 @@ public partial class CheckpointFolder : ViewModelBase
|
|
|
|
|
{ |
|
|
|
|
var hashProgress = new Progress<ProgressReport>(report => |
|
|
|
|
{ |
|
|
|
|
Progress.IsIndeterminate = false; |
|
|
|
|
Progress.IsIndeterminate = report.IsIndeterminate; |
|
|
|
|
Progress.Value = report.Percentage; |
|
|
|
|
Progress.Text = modelFilesCount > 1 ? |
|
|
|
|
$"Computing metadata for {modelFile.Info.Name} ({i}/{modelFilesCount})" : |
|
|
|
|
$"Computing metadata for {report.Title}"; |
|
|
|
|
$"Computing metadata for {modelFile.Name} ({i}/{modelFilesCount})" : |
|
|
|
|
$"Computing metadata for {modelFile.Name}"; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
var hashBlake3 = await FileHash.GetBlake3Async(modelFile, hashProgress); |
|
|
|
@ -322,16 +325,20 @@ public partial class CheckpointFolder : ViewModelBase
|
|
|
|
|
"Import complete. No connected data found.", |
|
|
|
|
> 0 when failCount > 0 => |
|
|
|
|
$"Import complete. Found connected data for {successCount} of {totalCount} models.", |
|
|
|
|
1 when failCount == 0 => |
|
|
|
|
"Import complete. Found connected data for 1 model.", |
|
|
|
|
_ => $"Import complete. Found connected data for all {totalCount} models." |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
DelayedClearProgress(TimeSpan.FromSeconds(1.5)); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
Progress.Text = "Import complete"; |
|
|
|
|
Progress.Value = 100; |
|
|
|
|
await IndexAsync(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
finally |
|
|
|
|
{ |
|
|
|
|
DelayedClearProgress(TimeSpan.FromSeconds(1.5)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -345,6 +352,7 @@ public partial class CheckpointFolder : ViewModelBase
|
|
|
|
|
{ |
|
|
|
|
IsImportInProgress = false; |
|
|
|
|
Progress.Value = 0; |
|
|
|
|
Progress.IsIndeterminate = false; |
|
|
|
|
Progress.Text = string.Empty; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|