DownloadChangedEventArgs.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // Copyright (c) 2024 Vuplex Inc. All rights reserved.
  2. //
  3. // Licensed under the Vuplex Commercial Software Library License, you may
  4. // not use this file except in compliance with the License. You may obtain
  5. // a copy of the License at
  6. //
  7. // https://vuplex.com/commercial-library-license
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. using System;
  15. namespace Vuplex.WebView {
  16. /// <summary>
  17. /// Event args for IWithDownloads.DownloadProgressChanged.
  18. /// </summary>
  19. public class DownloadChangedEventArgs : EventArgs {
  20. public DownloadChangedEventArgs(string contentType, string filePath, string id, float progress, ProgressChangeType type, string url) {
  21. ContentType = contentType;
  22. FilePath = filePath;
  23. Id = id;
  24. Progress = progress;
  25. Type = type;
  26. Url = url;
  27. }
  28. /// <summary>
  29. /// The mime type indicated by the Content-Type response header,
  30. /// or `null` if no content type was specified.
  31. /// </summary>
  32. public readonly string ContentType;
  33. /// <summary>
  34. /// The full file path of the downloaded file. Files are downloaded to
  35. /// Application.temporaryCachePath, but you can move them to a different
  36. /// location after they finish downloading.
  37. /// </summary>
  38. public readonly string FilePath;
  39. /// <summary>
  40. /// An identifier for the file, which can be used to track the
  41. /// file's download progress across multiple invocations of the DownloadProgressChanged event.
  42. /// </summary>
  43. public readonly string Id;
  44. /// <summary>
  45. /// The estimated download progress, normalized to a float between 0 and 1.
  46. /// Note that not all platforms support intermediate progress updates.
  47. /// </summary>
  48. public readonly float Progress;
  49. /// <summary>
  50. /// The download progress event type. Note that not all platforms
  51. /// support the Updated event type.
  52. /// </summary>
  53. public readonly ProgressChangeType Type;
  54. /// <summary>
  55. /// The URL from which the file was downloaded.
  56. /// </summary>
  57. public readonly string Url;
  58. }
  59. }