2021-01-25 02:05:18 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2021-01-30 22:39:56 +08:00
|
|
|
|
using System.Linq;
|
2021-01-25 02:05:18 +08:00
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace AntDesign
|
|
|
|
|
{
|
|
|
|
|
public class ImageService
|
|
|
|
|
{
|
2021-01-30 22:39:56 +08:00
|
|
|
|
public event Action<ImageRef> ImagePreviewOpened;
|
2021-01-25 02:05:18 +08:00
|
|
|
|
|
2021-01-30 22:39:56 +08:00
|
|
|
|
public event Action<ImageRef> ImagePreviewClosed;
|
2021-01-25 02:05:18 +08:00
|
|
|
|
|
2021-01-30 22:39:56 +08:00
|
|
|
|
public ImageRef OpenImages(IList<Image> images)
|
2021-01-25 02:05:18 +08:00
|
|
|
|
{
|
2021-01-30 22:39:56 +08:00
|
|
|
|
if (images?.Any() != true)
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
var imageRef = new ImageRef(images, this);
|
|
|
|
|
|
|
|
|
|
ImagePreviewOpened?.Invoke(imageRef);
|
|
|
|
|
|
|
|
|
|
return imageRef;
|
2021-01-25 02:05:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-30 22:39:56 +08:00
|
|
|
|
public void CloseImage(ImageRef iamgeRef)
|
2021-01-25 02:05:18 +08:00
|
|
|
|
{
|
2021-01-30 22:39:56 +08:00
|
|
|
|
ImagePreviewClosed?.Invoke(iamgeRef);
|
2021-01-25 02:05:18 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|