Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/DynamoCoreWpf/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,7 @@ Dynamo.PackageManager.PublishPackageViewModel.SiteUrl.get -> string
Dynamo.PackageManager.PublishPackageViewModel.SiteUrl.set -> void
Dynamo.PackageManager.PublishPackageViewModel.SubmitCommand.get -> Prism.Commands.DelegateCommand
Dynamo.PackageManager.PublishPackageViewModel.ToggleMoreCommand.get -> Prism.Commands.DelegateCommand
Dynamo.PackageManager.PublishPackageViewModel.UploadCancelled -> System.Action
Dynamo.PackageManager.PublishPackageViewModel.UploadHandle.get -> Dynamo.PackageManager.PackageUploadHandle
Dynamo.PackageManager.PublishPackageViewModel.UploadHandle.set -> void
Dynamo.PackageManager.PublishPackageViewModel.Uploading.get -> bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,11 @@ public bool HasChanges
/// </summary>
private bool IsPublishFromLocalPackage = false;

/// <summary>
/// Notifies the view model that the user has cancelled the upload
/// </summary>
public event Action UploadCancelled;

#endregion

internal PublishPackageViewModel()
Expand Down Expand Up @@ -2348,6 +2353,8 @@ private void Submit()
MessageBoxResult response = DynamoModel.IsTestMode ? MessageBoxResult.OK : MessageBoxService.Show(Owner, Resources.PrePackagePublishMessage, Resources.PrePackagePublishTitle, MessageBoxButton.OKCancel, MessageBoxImage.Information);
if (response == MessageBoxResult.Cancel)
{
// Notify the front-end that the user has cancelled the upload
UploadCancelled?.Invoke();
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ private void OnDataContextChanged(object sender, DependencyPropertyChangedEventA
{
previousViewModel.PropertyChanged -= PublishPackageViewModel_PropertyChanged;
previousViewModel.PublishSuccess -= PublishPackageViewModel_PublishSuccess;
previousViewModel.UploadCancelled -= OnUploadCancelled;
}

// Cast and assign the new DataContext
Expand All @@ -170,9 +171,10 @@ private void OnDataContextChanged(object sender, DependencyPropertyChangedEventA
{
publishPackageViewModel.PropertyChanged += PublishPackageViewModel_PropertyChanged;
publishPackageViewModel.PublishSuccess += PublishPackageViewModel_PublishSuccess;
previousViewModel.UploadCancelled += OnUploadCancelled;

// Only send updates if the application has been loaded
if(_applicationLoaded) UpdateFromBackEnd();
if (_applicationLoaded) UpdateFromBackEnd();
}
}

Expand Down Expand Up @@ -558,6 +560,14 @@ private async void SendResetProgress()
}
}

private async void SendUploadCancel()
{
if (dynWebView?.CoreWebView2 != null)
{
await dynWebView.CoreWebView2.ExecuteScriptAsync($"window.receiveUploadCancel();");
}
}

private async void SendDialogResult(string msg)
{
var payload = new { result = msg };
Expand Down Expand Up @@ -729,6 +739,15 @@ internal void UpdateCompatibilityMatrix(string jsonPayload)
);
if (compatibilityMatrix == null) return;

// Replace any 'x' in the max field with '*'
foreach (var item in compatibilityMatrix)
{
if (!string.IsNullOrWhiteSpace(item.max))
{
item.max = item.max.Replace("x", "*");
}
}

publishPackageViewModel.CompatibilityMatrix = compatibilityMatrix;

LogMessage("Compatibility matrix updated successfully.");
Expand Down Expand Up @@ -836,6 +855,15 @@ internal void ShowDialog(string title, string message)
}
}

/// <summary>
/// Notify the front-end that the upload was cancelled
/// </summary>
/// <exception cref="NotImplementedException"></exception>
private void OnUploadCancelled()
{
SendUploadCancel();
}

#endregion

#region Utility
Expand Down Expand Up @@ -1041,6 +1069,7 @@ protected virtual void Dispose(bool disposing)
{
this.publishPackageViewModel.PropertyChanged -= PublishPackageViewModel_PropertyChanged;
this.publishPackageViewModel.PublishSuccess -= PublishPackageViewModel_PublishSuccess;
this.previousViewModel.UploadCancelled -= OnUploadCancelled;
}

if (this.dynWebView != null && this.dynWebView.CoreWebView2 != null)
Expand All @@ -1052,6 +1081,7 @@ protected virtual void Dispose(bool disposing)
_disposed = true;
}
}

#endregion
}

Expand Down
Loading