| | |
| | | using System.Collections.Generic; |
| | | using System.Globalization; |
| | | using Shared.Common; |
| | | using Shared.Phone.Device.CommonForm; |
| | | using Shared.Phone.Device.Room; |
| | | using static ZigBee.Device.Scene; |
| | | |
| | | namespace Shared.Phone.Device.Category |
| | | { |
| | | public class CategoryAddScene:FrameLayout |
| | | public class CategoryAddScene : FrameLayout |
| | | { |
| | | #region ◆ 变量____________________________ |
| | | /// <summary> |
| | | /// bodyFrameLayout |
| | | /// </summary> |
| | | private FrameLayout bodyFrameLayout; |
| | | |
| | | #endregion |
| | | |
| | | public static string ImagePath; |
| | | public static string SceneText; |
| | | |
| | | public static Shared.Common.Room CurrentRoom; |
| | | public static List<SceneTargetDeviceUI> sceneTargetDevicesList=new List<SceneTargetDeviceUI>{}; |
| | | |
| | | public static List<SceneTargetDeviceUI> sceneTargetDevicesList = new List<SceneTargetDeviceUI> { }; |
| | | /// <summary> |
| | | /// 记录编辑前的设备列表 |
| | | /// </summary> |
| | |
| | | /// 图片来源 0--本地图库 1--拍照 2--系统图库 |
| | | /// </summary> |
| | | public static int IconType = 0; |
| | | |
| | | /// <summary> |
| | | /// 添加目标后的展示列表 |
| | | /// </summary> |
| | |
| | | { |
| | | string devImgPath = string.Empty; |
| | | string devNameText = string.Empty; |
| | | if (targetDevice.Type==0) |
| | | if (targetDevice.Type == 0) |
| | | { |
| | | if (targetDevice.DeviceUI == null || targetDevice.DeviceUI.CommonDevice == null) continue; |
| | | devImgPath = targetDevice.DeviceUI.IconPath; |
| | | devNameText = targetDevice.DeviceUI.CommonDevice.DeviceEpointName; |
| | | } |
| | | else if(targetDevice.Type==1) |
| | | else if (targetDevice.Type == 1) |
| | | { |
| | | devImgPath = "Item/Timer.png"; |
| | | devNameText = $"{targetDevice.DelayTime} {Language.StringByID(R.MyInternationalizationString.Second)}"; |
| | | } |
| | | else if(targetDevice.Type==2) |
| | | else if (targetDevice.Type == 2) |
| | | { |
| | | devImgPath = "Item/Scene.png"; |
| | | devNameText = targetDevice.SceneName; |
| | |
| | | { |
| | | /////******暂时先不加延时,安卓控件有问题*******//// |
| | | var tList = new List<string> { }; |
| | | for(int i=1;i<=60;i++) |
| | | for (int i = 1; i <= 60; i++) |
| | | { |
| | | tList.Add($"{i} {Language.StringByID(R.MyInternationalizationString.Second)}"); |
| | | } |
| | | //1-60秒 |
| | | PickerView.Show(tList, (obj) => |
| | | { |
| | | targetDevice.DelayTime =int.Parse(tList[obj].Split(' ')[0]); |
| | | },0,"",Language.StringByID(R.MyInternationalizationString.Confrim)); |
| | | //PickerView.Show(tList, (obj) => |
| | | // { |
| | | // targetDevice.DelayTime = int.Parse(obj.Split(' ')[0]); |
| | | // }, Language.StringByID(R.MyInternationalizationString.Confrim)); |
| | | }; |
| | | //删除设备 |
| | | devRight.MouseUpEventHandler += (sender, e) => |
| | |
| | | var detail = new CategorySceneSelectLightSetting(); |
| | | UserView.HomePage.Instance.AddChidren(detail); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | detail.Show(targetDevice.DeviceUI,targetDevice.SceneTargetDeviceUIID, taskList[0].Data1); |
| | | detail.Show(targetDevice.DeviceUI, targetDevice.SceneTargetDeviceUIID, taskList[0].Data1); |
| | | } |
| | | else if (targetDevice.DeviceUI.CommonDevice.Type == ZigBee.Device.DeviceType.AirSwitch) |
| | | { |
| | |
| | | UserView.HomePage.Instance.AddChidren(detail); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | UserView.HomePage.Instance.ScrollEnabled = false; |
| | | if(taskList[0].TaskType==1) |
| | | if (taskList[0].TaskType == 1) |
| | | { |
| | | detail.Show(targetDevice.DeviceUI, targetDevice.SceneTargetDeviceUIID, taskList[0].Data1, taskList[0].Data2); |
| | | } |
| | | else if(taskList[0].TaskType==3) |
| | | else if (taskList[0].TaskType == 3) |
| | | { |
| | | detail.Show(targetDevice.DeviceUI, targetDevice.SceneTargetDeviceUIID, taskList[0].TaskType, taskList[0].Data1); |
| | | |
| | |
| | | var delayTimeView = new CategorySceneSelectedDelayTime(); |
| | | UserView.HomePage.Instance.AddChidren(delayTimeView); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | delayTimeView.Show(1,targetDevice.SceneTargetDeviceUIID); |
| | | delayTimeView.Show(1, targetDevice.SceneTargetDeviceUIID); |
| | | } |
| | | //场景 |
| | | else if (targetDevice.Type == 2) |
| | |
| | | var sceneView = new CategorySceneSelectedScene(); |
| | | UserView.HomePage.Instance.AddChidren(sceneView); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | sceneView.Show(sceneTargetDevicesList,1,targetDevice.SceneTargetDeviceUIID); |
| | | sceneView.Show(sceneTargetDevicesList, 1, targetDevice.SceneTargetDeviceUIID); |
| | | } |
| | | } |
| | | devIMG.MouseUpEventHandler += detailMouseUpEventHandler; |
| | |
| | | /// </summary> |
| | | public void Show() |
| | | { |
| | | #region topview |
| | | var topBGView = new FrameLayout()
{
Height = Application.GetRealHeight(CommonPage.Navigation_Height),
BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor
};
AddChidren(topBGView);
var topView = new FrameLayout()
{
Y = Application.GetRealHeight(CommonPage.NavigationTitle_Y),
Height = Application.GetRealHeight(CommonPage.Navigation_Height - CommonPage.NavigationTitle_Y),
BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor,
};
AddChidren(topView); |
| | | var title = new Button() |
| | | { |
| | | TextAlignment = TextAlignment.Center, |
| | | TextID = R.MyInternationalizationString.AddScence, |
| | | TextSize = 20, |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | Width = Application.GetRealWidth(CommonPage.AppRealWidth - 500), |
| | | Gravity = Gravity.CenterHorizontal |
| | | }; |
| | | topView.AddChidren(title); |
| | | var back = new Device.CommonForm.BackButton() { };
topView.AddChidren(back); |
| | | back.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | this.RemoveFromParent(); |
| | | }; |
| | | #endregion |
| | | AddTop(); |
| | | |
| | | #region midFL |
| | | var midFL = new FrameLayout() |
| | | AddBodyView(); |
| | | |
| | | } |
| | | |
| | | #region Add____________________________________ |
| | | |
| | | /// <summary> |
| | | /// AddTop |
| | | /// </summary> |
| | | public void AddTop() |
| | | { |
| | | var top = new TopFrameLayout(); |
| | | AddChidren(top); |
| | | top.InitTopview(); |
| | | top.SetTopTitle(R.MyInternationalizationString.AddScence); |
| | | top.backButton.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | Height = Application.GetRealHeight(CommonPage.AppRealHeight - CommonPage.Navigation_Height), |
| | | Y = topView.Bottom, |
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, |
| | | RemoveFromParent(); |
| | | }; |
| | | this.AddChidren(midFL); |
| | | #endregion |
| | | #region 背景图 名称 区域 执行目标 |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// AddBodyView |
| | | /// </summary> |
| | | public void AddBodyView() |
| | | { |
| | | bodyFrameLayout = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(184), |
| | | Height = Application.GetRealHeight(1737), |
| | | BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor, |
| | | }; |
| | | AddChidren(bodyFrameLayout); |
| | | |
| | | var imgFL = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(556), |
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor |
| | | }; |
| | | bodyFrameLayout.AddChidren(imgFL); |
| | | |
| | | var backGround = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(50), |
| | | Width = Application.GetRealWidth(980), |
| | | Height = Application.GetRealHeight(350), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Radius = CommonPage.BigFormRadius, |
| | | Width = Application.GetRealWidth(930), |
| | | Height = Application.GetRealHeight(464), |
| | | Gravity = Gravity.Center, |
| | | Radius = (uint)Application.GetRealHeight(CommonFormResouce.BigFormRadius), |
| | | UnSelectedImagePath = ImagePath |
| | | }; |
| | | midFL.AddChidren(backGround); |
| | | //--场景名 |
| | | var sceneNameFL = new FrameLayout() |
| | | imgFL.AddChidren(backGround); |
| | | |
| | | var infoFL = new FrameLayout |
| | | { |
| | | Y = backGround.Bottom + Application.GetRealHeight(100), |
| | | Height = Application.GetRealHeight(170), |
| | | Y = imgFL.Bottom + Application.GetRealHeight(23), |
| | | Height = Application.GetRealHeight(418), |
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor |
| | | }; |
| | | midFL.AddChidren(sceneNameFL); |
| | | var sceneNameTip = new Button() |
| | | bodyFrameLayout.AddChidren(infoFL); |
| | | |
| | | var infoEdit = new Button |
| | | { |
| | | X = Application.GetRealWidth(50), |
| | | Height = Application.GetRealHeight(70), |
| | | Width = Application.GetRealWidth(300), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = 12, |
| | | TextColor = ZigbeeColor.Current.GXCButtonTipColor, |
| | | TextID = R.MyInternationalizationString.SceneName, |
| | | X=Application.GetRealWidth(CommonFormResouce.X_Left), |
| | | Height = Application.GetRealHeight(130), |
| | | Width=Application.GetRealWidth(700), |
| | | TextID = R.MyInternationalizationString.EditInfo, |
| | | TextColor = ZigbeeColor.Current.GXCTextDeepBlackColor, |
| | | TextAlignment=TextAlignment.CenterLeft, |
| | | TextSize=14 |
| | | }; |
| | | sceneNameFL.AddChidren(sceneNameTip); |
| | | var sceneNameET = new EditText() |
| | | { |
| | | X = Application.GetRealWidth(50), |
| | | Y = sceneNameTip.Bottom, |
| | | Height = Application.GetRealHeight(100) - 1, |
| | | Width = Application.GetRealWidth(700), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = 20, |
| | | PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputSceneName), |
| | | PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor, |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | }; |
| | | sceneNameFL.AddChidren(sceneNameET); |
| | | var sceneNameLine = new Button() |
| | | { |
| | | Y = sceneNameET.Bottom, |
| | | Height = 1, |
| | | BackgroundColor = ZigbeeColor.Current.GXCLineColor |
| | | }; |
| | | sceneNameFL.AddChidren(sceneNameLine); |
| | | //zone |
| | | var zoneFL = new FrameLayout() |
| | | { |
| | | Y = sceneNameFL.Bottom, |
| | | Height = Application.GetRealHeight(170), |
| | | }; |
| | | midFL.AddChidren(zoneFL); |
| | | var zoneTip = new Button() |
| | | { |
| | | X = Application.GetRealWidth(50), |
| | | Height = Application.GetRealHeight(70), |
| | | Width = Application.GetRealWidth(300), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = 12, |
| | | TextColor = ZigbeeColor.Current.GXCButtonTipColor, |
| | | TextID = R.MyInternationalizationString.BelongZone, |
| | | }; |
| | | zoneFL.AddChidren(zoneTip); |
| | | var zone = new Button() |
| | | { |
| | | X = Application.GetRealWidth(50), |
| | | Y = sceneNameTip.Bottom, |
| | | Height = Application.GetRealHeight(100) - 1, |
| | | Width = Application.GetRealWidth(500), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = 20, |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | Text = CurrentRoom.Name |
| | | }; |
| | | zoneFL.AddChidren(zone); |
| | | var zoneRight = new Device.CommonForm.SelectedStatuButton() |
| | | { |
| | | X = Application.GetRealWidth(1080 - 150), |
| | | Width = Application.GetMinRealAverage(110), |
| | | Height = Application.GetMinRealAverage(110), |
| | | UnSelectedImagePath = "Item/Next.png", |
| | | SelectedImagePath="Item/NextSelected.png", |
| | | Gravity = Gravity.CenterVertical |
| | | }; |
| | | zoneFL.AddChidren(zoneRight); |
| | | var zoneLine = new Button() |
| | | { |
| | | Y = zone.Bottom, |
| | | Height = 1, |
| | | BackgroundColor = ZigbeeColor.Current.GXCLineColor |
| | | }; |
| | | zoneFL.AddChidren(zoneLine); |
| | | //添加执行目标 |
| | | infoFL.AddChidren(infoEdit); |
| | | |
| | | |
| | | var nameRow = new DeviceInfoEditRow(130); |
| | | nameRow.Init(); |
| | | nameRow.SetTipTitle(R.MyInternationalizationString.SceneName); |
| | | nameRow.SetPlaceHoldText(R.MyInternationalizationString.PleaseInputSceneName); |
| | | infoFL.AddChidren(nameRow); |
| | | |
| | | var zoneRow = new DeviceInfoRow(257); |
| | | zoneRow.Init(); |
| | | zoneRow.SetTipTitle(R.MyInternationalizationString.BelongZone); |
| | | zoneRow.SetTitle(CurrentRoom.Name); |
| | | infoFL.AddChidren(zoneRow); |
| | | |
| | | var targetFL = new FrameLayout() |
| | | { |
| | | Y = zoneFL.Bottom, |
| | | Height = Application.GetRealHeight(170), |
| | | Y = infoFL.Bottom + Application.GetRealHeight(23), |
| | | Height = Application.GetRealHeight(334), |
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor |
| | | }; |
| | | midFL.AddChidren(targetFL); |
| | | bodyFrameLayout.AddChidren(targetFL); |
| | | |
| | | var target = new Button() |
| | | { |
| | | X = Application.GetRealWidth(50), |
| | | Y = sceneNameTip.Bottom, |
| | | Height = Application.GetRealHeight(170) - 1, |
| | | Width = Application.GetRealWidth(500), |
| | | X = Application.GetRealWidth(CommonFormResouce.X_Left), |
| | | Y = Application.GetRealHeight(46), |
| | | Height = Application.GetRealHeight(127) - 1, |
| | | Width = Application.GetRealWidth(600), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = 20, |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | TextID = R.MyInternationalizationString.AddRoomScentTargetAction, |
| | | Gravity = Gravity.CenterVertical |
| | | TextID = R.MyInternationalizationString.AddScentTargetAction, |
| | | }; |
| | | targetFL.AddChidren(target); |
| | | var targetAdd = new Device.CommonForm.SelectedStatuButton() |
| | | |
| | | var targetAdd = new SelectedStatuButton() |
| | | { |
| | | X = Application.GetRealWidth(1080 - 150), |
| | | Width = Application.GetMinRealAverage(110), |
| | | Height = Application.GetMinRealAverage(110), |
| | | X = Application.GetRealWidth(950), |
| | | Y = Application.GetRealHeight(46), |
| | | Width = Application.GetMinRealAverage(72), |
| | | Height = Application.GetMinRealAverage(72), |
| | | UnSelectedImagePath = "Item/Add.png", |
| | | SelectedImagePath="Item/AddSelected.png", |
| | | Gravity = Gravity.CenterVertical |
| | | SelectedImagePath = "Item/AddSelected.png", |
| | | }; |
| | | targetFL.AddChidren(targetAdd); |
| | | var targetLine = new Button() |
| | | { |
| | | Y = target.Bottom, |
| | | Height = 1, |
| | | BackgroundColor = ZigbeeColor.Current.GXCLineColor |
| | | BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2 |
| | | }; |
| | | targetFL.AddChidren(targetLine); |
| | | |
| | | //添加目标后的展示列表 |
| | | TargetListScrolView = new VerticalScrolViewLayout() |
| | | { |
| | | Y = targetFL.Bottom, |
| | | Height = Application.GetRealHeight(340+170), |
| | | Y = targetLine.Bottom, |
| | | Height = Application.GetRealHeight(173), |
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor |
| | | }; |
| | | midFL.AddChidren(TargetListScrolView); |
| | | confirmBtn = new CommonForm.CompleteButton() |
| | | { |
| | | TextID = R.MyInternationalizationString.NextStep, |
| | | }; |
| | | targetFL.AddChidren(TargetListScrolView); |
| | | |
| | | confirmBtn = new CommonForm.CompleteButton(1656, 907, 127); |
| | | AddChidren(confirmBtn); |
| | | |
| | | RefreshTargetListView(); |
| | | |
| | | #region 背景图 名称 区域 执行目标 |
| | | |
| | | |
| | | |
| | | if (!string.IsNullOrEmpty(SceneText)) |
| | | { |
| | | sceneNameET.Text = SceneText; |
| | | nameRow.NameText.Text = SceneText; |
| | | } |
| | | if(CurrentRoom!=null) |
| | | if (CurrentRoom != null) |
| | | { |
| | | |
| | | } |
| | | if(Modify) |
| | | if (Modify) |
| | | { |
| | | title.TextID = R.MyInternationalizationString.ModifyScene; |
| | | //title.TextID = R.MyInternationalizationString.ModifyScene; |
| | | oldRoom = CurrentRoom; |
| | | if (ModifySceneUI != null && ModifySceneUI.IsSharedScene) |
| | | { |
| | | sceneNameET.Enable = false; |
| | | nameRow.NameText.Enable = false; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region event |
| | | //记录输入场景名 |
| | | sceneNameET.TextChangeEventHandler += (sender, e) => |
| | | nameRow.NameText.TextChangeEventHandler += (sender, e) => |
| | | { |
| | | SceneText = sceneNameET.Text.Trim(); |
| | | SceneText = nameRow.NameText.Text.Trim(); |
| | | }; |
| | | |
| | | |
| | | //选择背景图 |
| | | EventHandler<MouseEventArgs> backGroundIMGHander = (sender, e) => |
| | | { |
| | | if(CurrentRoom.IsSharedRoom) |
| | | if (CurrentRoom.IsSharedRoom) |
| | | { |
| | | RoomCommon.ShowTipRoomIsShared(); |
| | | return; |
| | | } |
| | | |
| | | |
| | | var localPic = new CategorySceneSelectImgByLocal(); |
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(localPic); |
| | | Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; |
| | |
| | | IconType = 0; |
| | | }; |
| | | |
| | | //var selectDialog = new Dialog() |
| | | //{ |
| | | //}; |
| | | //selectDialog.Show(); |
| | | |
| | | //var itemFL = new FrameLayout() |
| | | //{ |
| | | // Y = Application.GetRealHeight(1920 - 600), |
| | | // Width = Application.GetRealWidth(900), |
| | | // Height = Application.GetRealHeight(550), |
| | | // Radius = CommonPage.BigFormRadius, |
| | | // //BackgroundColor=ZigbeeColor.Current.GXCBackgroundColor, |
| | | // Gravity = Gravity.CenterHorizontal |
| | | //}; |
| | | //selectDialog.AddChidren(itemFL); |
| | | |
| | | //var localPicBtn = new Button() |
| | | //{ |
| | | // Height = Application.GetRealHeight(130) - 1, |
| | | // TextID = R.MyInternationalizationString.LocalPic, |
| | | // TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | // TextAlignment = TextAlignment.Center, |
| | | // BackgroundColor = ZigbeeColor.Current.GXCTextWhiteColor |
| | | //}; |
| | | //itemFL.AddChidren(localPicBtn); |
| | | //var localPicLine = new Button() |
| | | //{ |
| | | // Y = localPicBtn.Bottom, |
| | | // Height = 1, |
| | | // BackgroundColor = ZigbeeColor.Current.GXCLineColor, |
| | | //}; |
| | | //itemFL.AddChidren(localPicLine); |
| | | |
| | | //var takePhotoBtn = new Button() |
| | | //{ |
| | | // Y = localPicLine.Bottom, |
| | | // Height = Application.GetRealHeight(130) - 1, |
| | | // TextID = R.MyInternationalizationString.TakePhoto, |
| | | // TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | // TextAlignment = TextAlignment.Center, |
| | | // BackgroundColor = ZigbeeColor.Current.GXCTextWhiteColor |
| | | //}; |
| | | //itemFL.AddChidren(takePhotoBtn); |
| | | //var takePhotoLine = new Button() |
| | | //{ |
| | | // Y = takePhotoBtn.Bottom, |
| | | // Height = 1, |
| | | // BackgroundColor = ZigbeeColor.Current.GXCLineColor, |
| | | //}; |
| | | //itemFL.AddChidren(takePhotoLine); |
| | | |
| | | //var systemPicBtn = new Button() |
| | | //{ |
| | | // Y = takePhotoLine.Bottom, |
| | | // Height = Application.GetRealHeight(130), |
| | | // TextID = R.MyInternationalizationString.SystemPic, |
| | | // TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | // TextAlignment = TextAlignment.Center, |
| | | // BackgroundColor = ZigbeeColor.Current.GXCTextWhiteColor |
| | | //}; |
| | | //itemFL.AddChidren(systemPicBtn); |
| | | |
| | | |
| | | //var cancelBtn = new Button() |
| | | //{ |
| | | // Y = systemPicBtn.Bottom + Application.GetRealHeight(30), |
| | | // Height = Application.GetRealHeight(150), |
| | | // TextID = R.MyInternationalizationString.Cancel, |
| | | // TextColor = ZigbeeColor.Current.GXCTextWhiteColor, |
| | | // BackgroundColor = ZigbeeColor.Current.GXCButtonBlueColor, |
| | | // TextAlignment = TextAlignment.Center, |
| | | //}; |
| | | //itemFL.AddChidren(cancelBtn); |
| | | |
| | | ////本地图库 |
| | | //localPicBtn.MouseUpEventHandler += (send, ee) => |
| | | //{ |
| | | // selectDialog.Close(); |
| | | // var localPic = new CategorySceneSelectImgByLocal(); |
| | | // Shared.Phone.UserView.HomePage.Instance.AddChidren(localPic); |
| | | // Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; |
| | | // localPic.Show(); |
| | | // localPic.action = () => |
| | | // { |
| | | // backGround.UnSelectedImagePath = ImagePath; |
| | | // IconType = 0; |
| | | // }; |
| | | //}; |
| | | ////拍照 |
| | | //takePhotoBtn.MouseUpEventHandler += (send, ee) => |
| | | //{ |
| | | // var tradeTime = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo); |
| | | // selectDialog.Close(); |
| | | // Camera.TakePicture((obj) => |
| | | // { |
| | | // if (obj == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // backGround.UnSelectedImagePath = $"ScenePicture{tradeTime}.png"; |
| | | // ImagePath = $"{Config.Instance.HomeId}/{backGround.UnSelectedImagePath}"; |
| | | // IconType = 1; |
| | | // }, $"ScenePicture{tradeTime}.png"); |
| | | //}; |
| | | ////系统图库 |
| | | //systemPicBtn.MouseUpEventHandler += (send, ee) => |
| | | //{ |
| | | // var tradeTime = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo); |
| | | // selectDialog.Close(); |
| | | // Camera.SelectPicture((obj) => |
| | | // { |
| | | // if (obj == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // backGround.UnSelectedImagePath = $"ScenePicture{tradeTime}.png"; |
| | | // ImagePath = $"{Config.Instance.HomeId}/{backGround.UnSelectedImagePath}"; |
| | | // IconType = 2; |
| | | // }, $"ScenePicture{tradeTime}.png"); |
| | | //}; |
| | | //cancelBtn.MouseUpEventHandler += (send, ee) => |
| | | //{ |
| | | // selectDialog.Close(); |
| | | //}; |
| | | |
| | | }; |
| | | backGround.MouseUpEventHandler += backGroundIMGHander; |
| | | //区域 |
| | |
| | | selectRoom.SelectedRoomAction = (room) => |
| | | { |
| | | CurrentRoom = room; |
| | | zone.Text = CurrentRoom.Name; |
| | | zoneRow.NameText.Text = CurrentRoom.Name; |
| | | }; |
| | | selectRoom.Show(); |
| | | }; |
| | | zoneRight.MouseUpEventHandler += zoneHander; |
| | | zoneFL.MouseUpEventHandler += zoneHander; |
| | | zone.MouseUpEventHandler += zoneHander; |
| | | zoneRow.NextBtn.MouseUpEventHandler += zoneHander; |
| | | zoneRow.TipBtn.MouseUpEventHandler += zoneHander; |
| | | zoneRow.MouseUpEventHandler += zoneHander; |
| | | //执行目标-添加执行设备 |
| | | EventHandler<MouseEventArgs> targetAddHander = (sender, e) => |
| | | { |
| | |
| | | var selectedTimerBtn = new Device.CommonForm.SelectedStatuButton() |
| | | { |
| | | Y = selectedSceneLine.Bottom, |
| | | Height = Application.GetRealHeight(selectRow_Height)-1, |
| | | Height = Application.GetRealHeight(selectRow_Height) - 1, |
| | | TextID = R.MyInternationalizationString.TimeSpan, |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | BackgroundColor = ZigbeeColor.Current.GXCTextWhiteColor, |
| | |
| | | var sceneView = new CategorySceneSelectedScene(); |
| | | UserView.HomePage.Instance.AddChidren(sceneView); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | if(Modify) |
| | | if (Modify) |
| | | { |
| | | sceneView.Show(sceneTargetDevicesList,-1, "", false, ModifySceneUI.Id); |
| | | sceneView.Show(sceneTargetDevicesList, -1, "", false, ModifySceneUI.Id); |
| | | } |
| | | else |
| | | { |
| | |
| | | CommonPage.Loading.Start(); |
| | | //修改--先判断场景名是否改变,再移除设备,再添加设备 |
| | | ModifySceneUI.IconPath = ImagePath; |
| | | if (ModifySceneUI.Name != sceneNameET.Text.Trim()) |
| | | if (ModifySceneUI.Name != nameRow.NameText.Text.Trim()) |
| | | { |
| | | if (Shared.Common.Room.AllRoomSceneUIList.Find(s => s.Name == sceneNameET.Text.Trim()) != null) |
| | | if (Shared.Common.Room.AllRoomSceneUIList.Find(s => s.Name == nameRow.NameText.Text.Trim()) != null) |
| | | { |
| | | Common.CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.TheSceneHadExist); |
| | | return; |
| | | } |
| | | //修改名字 |
| | | var r = await ZigBee.Device.Scene.RenameSceneAsync(ModifySceneUI.Id, sceneNameET.Text.Trim()); |
| | | var r = await ZigBee.Device.Scene.RenameSceneAsync(ModifySceneUI.Id, nameRow.NameText.Text.Trim()); |
| | | var reName = r.sceneRenameResponseData.Result; |
| | | if (reName == 0) |
| | | { |
| | |
| | | else if (reName == 1) |
| | | { |
| | | //成功 |
| | | ModifySceneUI.Name = sceneNameET.Text.Trim(); |
| | | ModifySceneUI.Name = nameRow.NameText.Text.Trim(); |
| | | |
| | | } |
| | | else if (reName == 2) |
| | |
| | | } |
| | | sceneRemoveMemberData.DeviceList = removeSceneDeviceListInfoList; |
| | | sceneRemoveMemberData.ScenesId = ModifySceneUI.Id; |
| | | var result = await CurrentRoom.ModifyScene(ModifySceneUI,sceneRemoveMemberData, memberDataList); |
| | | var result = await CurrentRoom.ModifyScene(ModifySceneUI, sceneRemoveMemberData, memberDataList); |
| | | if (result == 1) |
| | | { |
| | | if(oldRoom!=CurrentRoom) |
| | | if (oldRoom != CurrentRoom) |
| | | { |
| | | oldRoom.SceneUIList.Remove(ModifySceneUI); |
| | | oldRoom.SceneUIFilePathList.Remove(ModifySceneUI.FileName); |
| | |
| | | //新增 |
| | | else |
| | | { |
| | | if (string.IsNullOrEmpty(sceneNameET.Text)) |
| | | if (string.IsNullOrEmpty(nameRow.NameText.Text)) |
| | | { |
| | | var alert = new Alert(Language.StringByID(R.MyInternationalizationString.TIP), Language.StringByID(R.MyInternationalizationString.SceneNameCannotBeNull), Language.StringByID(R.MyInternationalizationString.Close)); |
| | | alert.Show(); |
| | |
| | | { |
| | | try |
| | | { |
| | | if (Shared.Common.Room.AllRoomSceneUIList.Find(s => s.Name == sceneNameET.Text.Trim()) != null) |
| | | if (Shared.Common.Room.AllRoomSceneUIList.Find(s => s.Name == nameRow.NameText.Text.Trim()) != null) |
| | | { |
| | | Common.CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.TheSceneHadExist); |
| | | return; |
| | |
| | | CommonPage.Loading.Start(); |
| | | var memberDataList = new List<ZigBee.Device.Scene.AddSceneMemberData>(); |
| | | //累加延时 |
| | | int AddedDelayTime = 0; |
| | | int AddedDelayTime = 0; |
| | | for (int i = 0; i < sceneTargetDevicesList.Count; i++) |
| | | { |
| | | var sceneTarget = sceneTargetDevicesList[i]; |
| | |
| | | |
| | | if (beforeSceneTarget != null && beforeSceneTarget.Type == 1) |
| | | { |
| | | if(i-1>=0) |
| | | if (i - 1 >= 0) |
| | | { |
| | | for(int k=i-1;k>=0;k--) |
| | | for (int k = i - 1; k >= 0; k--) |
| | | { |
| | | if(sceneTargetDevicesList[k] == null || sceneTargetDevicesList[k].Type != 1) |
| | | if (sceneTargetDevicesList[k] == null || sceneTargetDevicesList[k].Type != 1) |
| | | { |
| | | break; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | var result = await CurrentRoom.AddScene(sceneNameET.Text, backGround.UnSelectedImagePath, memberDataList); |
| | | var result = await CurrentRoom.AddScene(nameRow.NameText.Text, backGround.UnSelectedImagePath, memberDataList); |
| | | if (result == 1) |
| | | { |
| | | RemoveFromParent(); |
| | |
| | | } |
| | | }; |
| | | #endregion |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |