using System;
using UIKit;
using Shared.IOS.TBL;
namespace Shared
{
///
/// 拍照或者选择图片
///
public static class CropImage
{
/////
///// 拍照或者读取图片完成时调用的动作,string==null表示用户取消了拍照或者取消选择图片,string!=null,表示图片的路径
/////
//internal static Action _callback;
/////
///// 文件名
/////
//internal static string _fileName;
///
/// 选择类型是拍照
///
internal static readonly int TypeCamera = 101;
///
/// 选择图片
///
internal static readonly int TypePicture = 102;
private static CropImageUtlis mCropImageUtlis;
static CropImage()
{
//mCropImageUtlis = new CropImageUtlis();
}
///
/// 拍照
///
/// 回调函数
/// 文件名
public static void TakePicture(Action callback, string fileName , int mRATIO_X = 1, int mRATIO_Y = 1, int OutputYSize = 200)
{
//_fileName = fileName;
mCropImageUtlis = new CropImageUtlis(Application.currentVC , TypeCamera, fileName, mRATIO_X, mRATIO_Y, (obj) => {
if (obj != null && obj.Length > 0)
{
callback?.Invoke(obj);
}
else {
callback?.Invoke(null);
}
mCropImageUtlis = null;
});
}
///
/// 选择图片
///
/// 回调函数
/// 文件名
public static void SelectPicture(Action callback, string fileName, int mRATIO_X = 1, int mRATIO_Y = 1, int OutputYSize = 200)
{
//_fileName = fileName;
mCropImageUtlis = new CropImageUtlis(Application.currentVC , TypePicture, fileName, mRATIO_X, mRATIO_Y, (obj) => {
if (obj != null && obj.Length > 0)
{
callback?.Invoke(obj);
}
else
{
callback?.Invoke(null);
}
mCropImageUtlis = null;
});
}
/////
///// OnCropImageeCallback
/////
//public class OnCropImageeCallback : Java.Lang.Object, IOnCropImageeCallback
//{
// Action mAction;
// public OnCropImageeCallback(Action action)
// {
// mAction = action;
// }
// public void OnSaveCallback(string p0)
// {
// mAction?.Invoke(p0);
// }
//}
}
}