BaseImageHelper.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // ******************************************************************
  2. // Copyright (c) Microsoft. All rights reserved.
  3. // This code is licensed under the MIT License (MIT).
  4. // THE CODE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  5. // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  7. // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  8. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  9. // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
  10. // THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
  11. // ******************************************************************
  12. using System;
  13. using Microsoft.Toolkit.Uwp.Notifications.Adaptive.Elements;
  14. namespace Microsoft.Toolkit.Uwp.Notifications
  15. {
  16. internal static class BaseImageHelper
  17. {
  18. internal static void SetSource(ref string destination, string value)
  19. {
  20. if (value == null)
  21. {
  22. throw new ArgumentNullException(nameof(value));
  23. }
  24. destination = value;
  25. }
  26. internal static Element_AdaptiveImage CreateBaseElement(IBaseImage curr)
  27. {
  28. if (curr.Source == null)
  29. {
  30. throw new NullReferenceException("Source property is required.");
  31. }
  32. return new Element_AdaptiveImage()
  33. {
  34. Src = curr.Source,
  35. Alt = curr.AlternateText,
  36. AddImageQuery = curr.AddImageQuery
  37. };
  38. }
  39. }
  40. }