using System;
|
using System.Collections.Generic;
|
using System.Threading;
|
using HDL_ON.DAL.Server;
|
using HDL_ON.Entity;
|
using HDL_ON.UI.CSS;
|
using Shared;
|
namespace HDL_ON.UI
|
{
|
public partial class AddRoomPage : FrameLayout
|
{
|
#region 控件列表
|
/// <summary>
|
/// 当前窗体
|
/// </summary>
|
FrameLayout bodyView;
|
/// <summary>
|
/// 房间背景区域
|
/// </summary>
|
FrameLayout roomBgView;
|
/// <summary>
|
/// 房间背景显示按钮
|
/// </summary>
|
ImageView btnRoomBg;
|
/// <summary>
|
/// 房间信息编辑区域
|
/// </summary>
|
VerticalScrolViewLayout roomInfoView;
|
/// <summary>
|
///
|
/// </summary>
|
Button btnEditInfoTitle;
|
/// <summary>
|
/// 房间名称Row
|
/// </summary>
|
FrameLayout roomNameRow;
|
/// <summary>
|
/// 房间名称标题按钮
|
/// </summary>
|
Button btnRoomNameTile;
|
/// <summary>
|
/// 房间名称
|
/// </summary>
|
Button btnRoomName;
|
/// <summary>
|
/// 房间名称修改按钮
|
/// </summary>
|
Button btnEditRoomNameIcon;
|
/// <summary>
|
/// 所属楼层
|
/// </summary>
|
FrameLayout floorView;
|
/// <summary>
|
/// 房间所属楼层标题
|
/// </summary>
|
Button btnFloorTitle;
|
/// <summary>
|
/// 房间楼层信息
|
/// </summary>
|
Button btnFloorInfo;
|
/// <summary>
|
/// 房间楼层修改跳转按钮
|
/// </summary>
|
Button btnFloorRight;
|
/// <summary>
|
/// 功能管理区域
|
/// </summary>
|
FrameLayout functionManagemantView;
|
/// <summary>
|
/// 功能管理标题
|
/// </summary>
|
Button btnFunctionManagementTitle;
|
/// <summary>
|
/// 功能管理跳转按钮
|
/// </summary>
|
Button btnFunctionManagementRight;
|
/// <summary>
|
/// 操作选项按钮
|
/// </summary>
|
Button btnOption;
|
|
|
#region 图标选择部分图标
|
/// <summary>
|
/// 背景图选项区域
|
/// </summary>
|
FrameLayout pictureOptionView;
|
/// <summary>
|
/// 背景图选项选择区域
|
/// </summary>
|
VerticalScrolViewLayout optionView;
|
/// <summary>
|
/// 默认图库按钮
|
/// </summary>
|
Button btnDefaultGallery;
|
/// <summary>
|
/// 拍照按钮
|
/// </summary>
|
Button btnTakePicture;
|
/// <summary>
|
/// 相册按钮
|
/// </summary>
|
Button btnAlbum;
|
/// <summary>
|
/// 取消按钮
|
/// </summary>
|
Button btnCancel;
|
#endregion
|
|
|
|
#endregion
|
Room room;
|
int rowCount = 1;
|
Action<Room> backAction;
|
/// <summary>
|
/// 房间的功能列表,房间未保存到云端时,需要缓存起来
|
/// </summary>
|
List<Function> roomFunctions = new List<Function>();
|
|
|
public AddRoomPage(Action<Room> action)
|
{
|
room = new Room();
|
bodyView = this;
|
backAction = action;
|
}
|
|
public void LoadPage()
|
{
|
bodyView.BackgroundColor = CSS_Color.BackgroundColor;
|
new TopViewDiv(bodyView, Language.StringByID(StringId.AddRoom)).LoadTopView();
|
|
roomBgView = new FrameLayout()
|
{
|
Y = Application.GetRealHeight(64),
|
Height = Application.GetRealWidth(232),
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
};
|
bodyView.AddChidren(roomBgView);
|
|
btnRoomBg = new ImageView()
|
{
|
Gravity = Gravity.CenterHorizontal,
|
Y = Application.GetRealWidth(20),
|
Width = Application.GetRealWidth(343),
|
Height = Application.GetRealWidth(192),
|
Radius = (uint)Application.GetRealWidth(12),
|
};
|
roomBgView.AddChidren(btnRoomBg);
|
|
//2020-12-03 修改图片加载方法
|
ImageUtlis.Current.LoadLocalOrNetworkImages(room.backgroundImage, btnRoomBg);
|
|
//房间信息编辑区域
|
roomInfoView = new VerticalScrolViewLayout()
|
{
|
Y = roomBgView.Bottom + Application.GetRealHeight(8),
|
Height = Application.GetRealHeight(50 * 5),
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
ScrollEnabled = false,
|
};
|
bodyView.AddChidren(roomInfoView);
|
|
btnEditInfoTitle = new Button()
|
{
|
Height = Application.GetRealWidth(50),
|
X = Application.GetRealWidth(12),
|
TextColor = CSS_Color.MainColor,
|
TextSize = CSS_FontSize.SubheadingFontSize,
|
TextAlignment = TextAlignment.CenterLeft,
|
IsBold = true,
|
TextID = StringId.EditRoomInfo,
|
};
|
roomInfoView.AddChidren(btnEditInfoTitle);
|
roomInfoView.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor });
|
|
#region 房间名称Row
|
roomNameRow = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(50),
|
};
|
roomInfoView.AddChidren(roomNameRow);
|
rowCount++;
|
|
btnRoomNameTile = new Button()
|
{
|
X = Application.GetRealWidth(16),
|
Width = Application.GetRealWidth(120),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
TextSize = CSS_FontSize.SubheadingFontSize,
|
TextID = StringId.RoomName,
|
};
|
roomNameRow.AddChidren(btnRoomNameTile);
|
|
btnRoomName = new Button()
|
{
|
X = Application.GetRealWidth(100),
|
Width = Application.GetRealWidth(230),
|
TextAlignment = TextAlignment.CenterRight,
|
TextColor = CSS_Color.PromptingColor1,
|
TextSize = CSS_FontSize.TextFontSize,
|
Text = room.roomName
|
};
|
roomNameRow.AddChidren(btnRoomName);
|
|
btnEditRoomNameIcon = new Button()
|
{
|
X = Application.GetRealWidth(333),
|
Gravity = Gravity.CenterVertical,
|
Width = Application.GetMinRealAverage(28),
|
Height = Application.GetMinRealAverage(28),
|
UnSelectedImagePath = "Public/EditIcon.png",
|
};
|
roomNameRow.AddChidren(btnEditRoomNameIcon);
|
roomInfoView.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor });
|
#endregion
|
#region 所属楼层
|
floorView = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(50),
|
};
|
roomInfoView.AddChidren(floorView);
|
rowCount++;
|
btnFloorTitle = new Button()
|
{
|
X = Application.GetRealWidth(16),
|
Width = Application.GetRealWidth(120),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
TextSize = CSS_FontSize.SubheadingFontSize,
|
TextID = StringId.Floor,
|
};
|
floorView.AddChidren(btnFloorTitle);
|
btnFloorInfo = new Button()
|
{
|
X = Application.GetRealWidth(100),
|
Width = Application.GetRealWidth(230),
|
TextAlignment = TextAlignment.CenterRight,
|
TextColor = CSS_Color.PromptingColor1,
|
TextSize = CSS_FontSize.TextFontSize,
|
Text = room.floorName
|
};
|
floorView.AddChidren(btnFloorInfo);
|
btnFloorRight = new Button()
|
{
|
X = Application.GetRealWidth(339),
|
Gravity = Gravity.CenterVertical,
|
Width = Application.GetMinRealAverage(16),
|
Height = Application.GetMinRealAverage(16),
|
UnSelectedImagePath = "Public/Right.png",
|
};
|
floorView.AddChidren(btnFloorRight);
|
roomInfoView.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor });
|
#endregion
|
#region 功能管理
|
functionManagemantView = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(50),
|
};
|
roomInfoView.AddChidren(functionManagemantView);
|
rowCount++;
|
btnFunctionManagementTitle = new Button()
|
{
|
X = Application.GetRealWidth(16),
|
Width = Application.GetRealWidth(120),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
TextSize = CSS_FontSize.SubheadingFontSize,
|
TextID = StringId.FunctionManagement,
|
};
|
functionManagemantView.AddChidren(btnFunctionManagementTitle);
|
btnFunctionManagementRight = new Button()
|
{
|
X = Application.GetRealWidth(339),
|
Gravity = Gravity.CenterVertical,
|
Width = Application.GetMinRealAverage(16),
|
Height = Application.GetMinRealAverage(16),
|
UnSelectedImagePath = "Public/Right.png",
|
};
|
functionManagemantView.AddChidren(btnFunctionManagementRight);
|
#endregion
|
|
roomInfoView.Height = Application.GetRealHeight(51 * rowCount);
|
|
btnOption = new Button()
|
{
|
Y = Application.GetRealHeight(617),
|
Height = Application.GetRealHeight(50),
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
TextAlignment = TextAlignment.Center,
|
TextColor = CSS_Color.MainColor,
|
TextID = StringId.Save,
|
TextSize = CSS_FontSize.SubheadingFontSize,
|
};
|
bodyView.AddChidren(btnOption);
|
|
if (MainPage.Increase)
|
{
|
btnOption.Y = Application.GetRealHeight(607);
|
btnOption.Height = Application.GetRealHeight(60);
|
}
|
|
LoadEventList();
|
}
|
|
/// <summary>
|
/// 加载图标选择选项
|
/// </summary>
|
void LoadPictureOptionView()
|
{
|
var baseView = new FrameLayout()
|
{
|
BackgroundColor = CSS_Color.DialogTransparentColor1,
|
};
|
bodyView.AddChidren(baseView);
|
|
pictureOptionView = new FrameLayout()
|
{
|
Y = Application.GetRealHeight(445),
|
Height = Application.GetRealHeight(250),
|
AnimateSpeed = 0.3f,
|
Animate = Animate.DownToUp,
|
};
|
baseView.AddChidren(pictureOptionView);
|
|
optionView = new VerticalScrolViewLayout()
|
{
|
Gravity = Gravity.CenterHorizontal,
|
Width = Application.GetRealWidth(343),
|
Height = Application.GetRealHeight(150),
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
Radius = (uint)Application.GetRealWidth(12),
|
};
|
pictureOptionView.AddChidren(optionView);
|
|
btnDefaultGallery = new Button()
|
{
|
Height = Application.GetRealHeight(50),
|
TextAlignment = TextAlignment.Center,
|
TextColor = CSS_Color.TextualColor,
|
SelectedTextColor = CSS_Color.MainColor,
|
TextSize = CSS_FontSize.SubheadingFontSize,
|
TextID = StringId.DefaultGallery,
|
};
|
optionView.AddChidren(btnDefaultGallery);
|
|
optionView.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor });
|
|
btnTakePicture = new Button()
|
{
|
Height = Application.GetRealHeight(50),
|
TextAlignment = TextAlignment.Center,
|
TextColor = CSS_Color.TextualColor,
|
SelectedTextColor = CSS_Color.MainColor,
|
TextSize = CSS_FontSize.SubheadingFontSize,
|
TextID = StringId.TakePicture,
|
};
|
optionView.AddChidren(btnTakePicture);
|
|
optionView.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor });
|
|
btnAlbum = new Button()
|
{
|
Height = Application.GetRealHeight(50),
|
TextAlignment = TextAlignment.Center,
|
TextColor = CSS_Color.TextualColor,
|
SelectedTextColor = CSS_Color.MainColor,
|
TextSize = CSS_FontSize.SubheadingFontSize,
|
TextID = StringId.Album,
|
};
|
optionView.AddChidren(btnAlbum);
|
|
optionView.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor });
|
|
btnCancel = new Button()
|
{
|
Gravity = Gravity.CenterHorizontal,
|
Y = Application.GetRealHeight(8) + optionView.Bottom,
|
Width = Application.GetRealWidth(343),
|
Height = Application.GetRealHeight(50),
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
Radius = (uint)Application.GetRealWidth(12),
|
TextID = StringId.Cancel,
|
TextColor = CSS_Color.WarningColor,
|
TextSize = CSS_FontSize.SubheadingFontSize,
|
};
|
pictureOptionView.AddChidren(btnCancel);
|
|
|
LoadEvent_PictureOptionViewEventList(baseView);
|
}
|
|
}
|
|
|
//------------------------------------------------------------------------------------------------------------------------------------
|
public partial class AddRoomPage
|
{
|
/// <summary>
|
/// 加载事件列表
|
/// </summary>
|
void LoadEventList()
|
{
|
LoadEvent_PictureOptionView();
|
LoadEvent_EditRoomName();
|
LoadEvent_SkinBindFloor();
|
LoadEvent_SkipEditFunctionList();
|
LoadEvent_SaveRoom();
|
}
|
|
/// <summary>
|
/// 底部按钮事件
|
/// </summary>
|
void LoadEvent_SaveRoom()
|
{
|
btnOption.MouseUpEventHandler = (sender, e) =>
|
{
|
if (string.IsNullOrEmpty(room.roomName))
|
{
|
new Tip()
|
{
|
CloseTime = 1,
|
Text = Language.StringByID(StringId.RoomNameCannotBeEmpty),
|
Direction = AMPopTipDirection.None,
|
}.Show(bodyView);
|
return;
|
}
|
if (string.IsNullOrEmpty(room.floorName))
|
{
|
new Tip()
|
{
|
CloseTime = 1,
|
Text = Language.StringByID(StringId.PlsBindFloor),
|
Direction = AMPopTipDirection.None,
|
}.Show(bodyView);
|
return;
|
}
|
foreach (var tempRoom in DB_ResidenceData.residenceData.Rooms)
|
{
|
if (room.roomName == tempRoom.roomName)
|
{
|
new PublicAssmebly().TipMsg(StringId.Tip, StringId.AddingFailed_RoomAlreadyExists);
|
return;
|
}
|
}
|
var addResult = SpatialInfo.CurrentSpatial.AddRoom(room);//检查room是否为云端返回的最新数据
|
if (addResult == StateCode.SUCCESS)
|
{
|
var deviceIds = new List<string>();
|
foreach (var f in roomFunctions)
|
{
|
deviceIds.Add(f.deviceId);
|
}
|
var bindResult = FunctionList.List.FunctionsBindRooms(new List<string>() { room.roomId }, deviceIds);
|
if (bindResult == StateCode.SUCCESS)
|
{
|
room.GetRoomFunctions(true);
|
}
|
else
|
{
|
//Utlis.ShowTip(Language.StringByID(StringId.EditFunctionInfoFail) + "\r\nCode:" + pack.Code);
|
}
|
backAction(room);
|
RemoveFromParent();
|
}
|
};
|
}
|
|
/// <summary>
|
/// 显示背景图选择选项
|
/// </summary>
|
void LoadEvent_PictureOptionView()
|
{
|
btnRoomBg.MouseUpEventHandler = (sender, e) =>
|
{
|
LoadPictureOptionView();
|
};
|
}
|
|
/// <summary>
|
/// 加载修改房间名称窗口事件
|
/// </summary>
|
void LoadEvent_EditRoomName()
|
{
|
Action<string> callBack = (str) =>
|
{
|
//房间名称不能为空
|
if (string.IsNullOrEmpty(str))
|
{
|
new Tip()
|
{
|
CloseTime = 1,
|
Text = Language.StringByID(StringId.RoomNameCannotBeEmpty),
|
Direction = AMPopTipDirection.None,
|
}.Show(bodyView);
|
return;
|
}
|
btnRoomName.Text = str;
|
room.roomName = str;
|
};
|
EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
|
{
|
List<string> roomNameList = new List<string>();
|
foreach (var temp in DB_ResidenceData.residenceData.Rooms)
|
{
|
roomNameList.Add(temp.roomName);
|
}
|
new PublicAssmebly().LoadDialog_EditParater(StringId.RoomName, room.roomName, callBack, StringId.RoomNameCannotBeEmpty, StringId.RoomNameAlreadyExists, roomNameList);
|
};
|
btnEditRoomNameIcon.MouseUpEventHandler = eventHandler;
|
roomNameRow.MouseUpEventHandler = eventHandler;
|
btnRoomName.MouseUpEventHandler = eventHandler;
|
}
|
|
/// <summary>
|
/// 跳转绑定楼层界面
|
/// </summary>
|
void LoadEvent_SkinBindFloor()
|
{
|
EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
|
{
|
Action floorsCallBackAction = () =>
|
{
|
btnFloorInfo.Text = room.floorName;
|
};
|
var residentialManagePage = new RoomBinglingFloorPage(floorsCallBackAction, room);
|
MainPage.BasePageView.AddChidren(residentialManagePage);
|
residentialManagePage.LoadPage();
|
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
|
};
|
btnFloorInfo.MouseUpEventHandler = eventHandler;
|
floorView.MouseUpEventHandler = eventHandler;
|
}
|
|
/// <summary>
|
/// 跳转到编辑房间功能界面
|
/// </summary>
|
void LoadEvent_SkipEditFunctionList()
|
{
|
EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
|
{
|
Action<List<Function>> addFunctionAction = (functionList) =>
|
{
|
roomFunctions = functionList;
|
};
|
var residentialManagePage = new RoomEditFunctionPage(room,addFunctionAction);
|
MainPage.BasePageView.AddChidren(residentialManagePage);
|
residentialManagePage.LoadPage();
|
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
|
};
|
btnFunctionManagementRight.MouseUpEventHandler = eventHandler;
|
functionManagemantView.MouseUpEventHandler = eventHandler;
|
}
|
/// <summary>
|
/// 加载背景图选择区域事件列表
|
/// </summary>
|
void LoadEvent_PictureOptionViewEventList(FrameLayout baseView)
|
{
|
pictureOptionView.MouseUpEventHandler = (sender, e) =>
|
{
|
baseView.RemoveFromParent();
|
};
|
|
baseView.MouseUpEventHandler = (sender, e) =>
|
{
|
baseView.RemoveFromParent();
|
};
|
btnCancel.MouseUpEventHandler = (sender, e) =>
|
{
|
baseView.RemoveFromParent();
|
};
|
btnTakePicture.MouseDownEventHandler = (sender, e) =>
|
{
|
btnTakePicture.IsSelected = true;
|
};
|
//拍照
|
btnTakePicture.MouseUpEventHandler = (sender, e) =>
|
{
|
btnTakePicture.IsSelected = false;
|
|
var imageName = Guid.NewGuid().ToString();
|
//var imageName = room.sid;
|
CropImage.TakePicture((imagePath) =>
|
{
|
CropImageCallBack(imagePath);
|
|
}, imageName, 16, 9);
|
|
baseView.RemoveFromParent();
|
};
|
//选择照片
|
btnAlbum.MouseDownEventHandler = (sender, e) =>
|
{
|
btnAlbum.IsSelected = true;
|
};
|
|
btnAlbum.MouseUpEventHandler = (sender, e) =>
|
{
|
btnAlbum.IsSelected = false;
|
|
//从相册选择图片裁剪
|
var imageName = Guid.NewGuid().ToString();
|
//var imageName = room.sid;
|
CropImage.SelectPicture((imagePath) =>
|
{
|
CropImageCallBack(imagePath);
|
|
}, imageName, 16, 9);
|
|
baseView.RemoveFromParent();
|
|
};
|
|
//房间默认图库
|
btnDefaultGallery.MouseUpEventHandler = (sender, e) => {
|
pictureOptionView.Parent.RemoveFromParent();
|
Action<string> action = (obj) => {
|
room.backgroundImage = obj;
|
btnRoomBg.ImagePath = room.backgroundImage;
|
};
|
|
var galleryPage = new RoomGalleryPage(room.backgroundImage, action);
|
MainPage.BasePageView.AddChidren(galleryPage);
|
galleryPage.LoadPage(true);
|
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
|
};
|
}
|
|
/// <summary>
|
/// 裁剪完照片回调,统一处理
|
/// </summary>
|
/// <param name="imagePath">裁剪后的真实路径</param>
|
/// <param name="imageName">自定义的图片名称</param>
|
void CropImageCallBack(string selectImagePath)
|
{
|
if (string.IsNullOrEmpty(selectImagePath) == true)
|
{
|
return;
|
}
|
//上传成功到回调
|
Action<string> uploadSuccessAction = (imageUrl) =>
|
{
|
//2020-12-03 需要讲最新的图片路径同步到云端
|
room.backgroundImage = imageUrl;
|
};
|
//上传图片到云端
|
UploadImage(selectImagePath, btnRoomBg, room, uploadSuccessAction);
|
}
|
|
/// <summary>
|
/// 上传图片方法
|
/// </summary>
|
/// <param name="selectImagePath">裁剪后的图片路径</param>
|
/// <param name="imageView"></param>
|
/// <param name="uploadSuccessAction"></param>
|
void UploadImage(string selectImagePath, ImageView imageView, Room mRoom, Action<string> uploadSuccessAction)
|
{
|
try
|
{
|
//MainPage.Log("SelectPicture 裁剪图片返回路径: " + selectImagePath);
|
//1.读取裁剪后的图片,然后删除
|
var imageBytes = Shared.IO.FileUtils.ReadFile(selectImagePath);
|
System.IO.File.Delete(selectImagePath);
|
|
var waitPage = new Loading();
|
bodyView.AddChidren(waitPage);
|
waitPage.Start(Language.StringByID(StringId.PleaseWait));
|
//开始上传
|
new Thread(() =>
|
{
|
try
|
{
|
var newImageName = mRoom.roomName.Trim() + ".png";
|
var uploadImageObj = new UploadImageObj()
|
{
|
prefix = "Room" + Utlis.GetTimestamp(),
|
fileName = newImageName,
|
uid = mRoom.uid,
|
content = imageBytes,
|
};
|
|
var imageUrl = ImageUtlis.Current.UploadImage(uploadImageObj);
|
if (!string.IsNullOrEmpty(imageUrl) && imageUrl.Contains(newImageName))
|
{
|
//上传成功
|
Application.RunOnMainThread(() =>
|
{
|
//Utlis.WriteLine("上传成功:" + imageUrl);
|
//1.2如果是自定义图片删除之前的
|
if (!string.IsNullOrEmpty(imageView.ImagePath) && !imageView.ImagePath.Contains("Classification/Room/Roombg"))
|
{
|
//Utlis.WriteLine("删除: " + imageView.ImagePath);
|
System.IO.File.Delete(imageView.ImagePath);
|
}
|
//重命名保存
|
Common.FileUtlis.Files.WriteFileByBytes(imageUrl, imageBytes);
|
imageView.ImagePath = null;
|
imageView.ImageBytes = imageBytes;
|
//上传成功
|
Utlis.ShowTip(Language.StringByID(StringId.UploadSuccessfully));
|
uploadSuccessAction?.Invoke(imageUrl);
|
});
|
}
|
else
|
{
|
//上传失败
|
Application.RunOnMainThread(() =>
|
{
|
//上传失败
|
Utlis.ShowTip(Language.StringByID(StringId.UploadFailed));
|
});
|
}
|
|
}
|
catch (Exception ex)
|
{
|
}
|
finally
|
{
|
Application.RunOnMainThread(() =>
|
{
|
if (waitPage != null)
|
{
|
waitPage.RemoveFromParent();
|
waitPage = null;
|
}
|
});
|
}
|
})
|
{ IsBackground = true }.Start();
|
}
|
catch { }
|
}
|
|
}
|
}
|