Browse Source

Add tracked download test in debug

pull/109/head
Ionite 1 year ago
parent
commit
aa14d5d396
No known key found for this signature in database
  1. 31
      StabilityMatrix.Avalonia/ViewModels/SettingsViewModel.cs

31
StabilityMatrix.Avalonia/ViewModels/SettingsViewModel.cs

@ -45,6 +45,7 @@ public partial class SettingsViewModel : PageViewModelBase
private readonly IPrerequisiteHelper prerequisiteHelper;
private readonly IPyRunner pyRunner;
private readonly ServiceManager<ViewModelBase> dialogFactory;
private readonly ITrackedDownloadService trackedDownloadService;
public SharedState SharedState { get; }
@ -103,13 +104,15 @@ public partial class SettingsViewModel : PageViewModelBase
IPrerequisiteHelper prerequisiteHelper,
IPyRunner pyRunner,
ServiceManager<ViewModelBase> dialogFactory,
SharedState sharedState)
SharedState sharedState,
ITrackedDownloadService trackedDownloadService)
{
this.notificationService = notificationService;
this.settingsManager = settingsManager;
this.prerequisiteHelper = prerequisiteHelper;
this.pyRunner = pyRunner;
this.dialogFactory = dialogFactory;
this.trackedDownloadService = trackedDownloadService;
SharedState = sharedState;
@ -406,6 +409,32 @@ public partial class SettingsViewModel : PageViewModelBase
// Use try-catch to generate traceback information
throw new OperationCanceledException("Example Message");
}
[RelayCommand]
private async Task DebugTrackedDownload()
{
var textFields = new TextBoxField[]
{
new()
{
Label = "Url",
},
new()
{
Label = "File path"
}
};
var dialog = DialogHelper.CreateTextEntryDialog("Add download", "", textFields);
if (await dialog.ShowAsync() == ContentDialogResult.Primary)
{
var url = textFields[0].Text;
var filePath = textFields[1].Text;
var download = trackedDownloadService.NewDownload(new Uri(url), new FilePath(filePath));
download.Start();
}
}
#endregion
#region Info Section

Loading…
Cancel
Save